Skip to content

Bug: issue #924 failed verification — 5 expected tests missing and timing-dependent polling loops in 3 tests #946

Description

@JoshuaRowePhantom

Missing implementation

Original issue: #924 — Blocked: #805/#888 blocked by test timeouts in GitWorktreeReviewWorkspaceTabViewModelTests

Verification gap: tests missing / criteria violation

Detail:

Gap 1: Five expected tests from the issue's 'Expected Tests' table are absent from Phantom.Workspaces.Tests/GitWorktreeReviewWorkspaceTabViewModelTests.cs

  1. RefreshAsync_ConcurrentInvocations_DoesNotMissIsRefreshingTrueEvent — Regression guard: attach \PropertyChanged\ while \IsRefreshing == true\ (constructor refresh in flight), trigger a second refresh, assert the observer eventually sees \ alse\ and that \CurrentRefresh\ completes. This is the only test that would catch a recurrence of the missed-notification race.
  2. RefreshAsync_CancelledMidFlight_LeavesIsRefreshingConsistent — Force cancellation of an in-flight refresh via a follow-up refresh, then assert \CurrentRefresh\ completes and \IsRefreshing == false\ at the end of the latest refresh.
  3. RefreshAsync_SecondCallCancelsFirst_OldTaskCompletesWithoutMutatingVisibleState — Guards the atomic-swap invariant from GitWorktreeReviewWorkspaceTabViewModel tests fail when TargetBranch changed immediately after adding sentinel commits #888: cancelled refresh Bump actions/checkout from 4 to 7 #1 must not mutate \CommitList\ / \FileList\ / \FileDiffs.
  4. CurrentRefresh_AfterConstructor_IsNonNullAndAwaitable — Dedicated contract test for the new public property (the behaviour exists inline in other tests but there is no standalone contract test).
  5. CurrentRefresh_AfterTargetBranchChange_IsReplacedWithNewTask — Ensures the task reference is actually replaced after a branch change (not just that the new task completes).

Gap 2: Timing-dependent polling loops in 3 tests

The following three tests in GitWorktreeReviewWorkspaceTabViewModelTests.cs use while (vm.FileDiffs.Count == 0) { await Task.Delay(50); } as their primary synchronization mechanism for initial diff loading, which is a polling loop violating the timing-dependent test criterion:

  • GitWorktreeReviewWorkspaceTabViewModel_ContextLines_TriggersRebuild
  • GitWorktreeReviewWorkspaceTabViewModel_ContextLines_Zero_ShowsOnlyChangedLines
  • GitWorktreeReviewWorkspaceTabViewModel_ContextLines_LargeValue_ShowsExtendedContext

These should be replaced with event-driven synchronization (e.g., subscribe to \FileDiffs.CollectionChanged\ with a \TaskCompletionSource\ before the VM is created, or expose a \CurrentRefresh\ await pattern that covers the initial diff build).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions