Skip to content

test(worktrees): wait for commands before checkout operations - #483

Merged
nixuuu merged 1 commit into
devfrom
test/flaky-branch-alias
Nov 10, 2026
Merged

nixuuu merged 1 commit into
devfrom
test/flaky-branch-alias

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 10, 2026

Copy link
Copy Markdown
Member

The alias-checkout test can observe threadReady / idle before the createThread command acknowledgment is persisted. Its final branch switch can therefore correctly fail with “A thread is using this directory.” This is a fixture readiness race: holding that acknowledgment reproduced idle with a pending command and the exact refusal; releasing it allowed the switch. No product lock remained held after settlement.

Add a shared fixture wait for idle, terminal turns and acknowledged admission commands, including checkout aliases without a worktree ID. Also wait for the worktree inventory to stop reporting busy and, for managed worktrees, provide a scan status. Reuse it in tree setup, branch switching, lifecycle/automation cleanup and local/linked external-worktree adoption. Poll only observations; branch-switch and post-delete/settings cleanup assertions remain direct, with no sleeps or mutation retries.

Validation:

  • thread-branches.test.ts, sequential file runs: unchanged baseline 30/30; final version 30/30 (8 tests per run). The natural flake did not reproduce in the baseline; the acknowledgment-gated diagnostic reproduced its failure window. An earlier implementation also passed 30/30 before the external-worktree scan condition was corrected.
  • All 67 tests in 11 other fixture-consumer files passed, one file at a time, on the final version.
  • bun run typecheck, bun run lint, bun run format:check and git diff --check passed.
  • Full-suite check:tmp, generation checks and web build were not run locally in this focused verification scope.

Based on dev after #482 merged. CI evidence: https://github.com/itsoltech/canopy/actions/runs/42792779962/attempts/1

Related: #481
Related: #482

Wait for durable turn and admission command settlement before fixture setup proceeds, including checkout aliases without worktree IDs. Reuse the wait before branch changes and cleanup, retaining scan readiness for managed worktrees.

Related: #481

Related: #482
@nixuuu
nixuuu merged commit 0e4a885 into dev Nov 10, 2026
9 checks passed
@nixuuu
nixuuu deleted the test/flaky-branch-alias branch November 10, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant