Skip to content

test(computers): isolate cursor handoff from revision recovery - #521

Merged
nixuuu merged 1 commit into
devfrom
test/mirror-cursor-handoff
Nov 10, 2026
Merged

nixuuu merged 1 commit into
devfrom
test/mirror-cursor-handoff

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 10, 2026

Copy link
Copy Markdown
Member

The native cursor-handoff test can overlap the five-second durable revision probe while its turn runs. Probe deadlines align to wall-clock intervals, so this can happen even during a short test. The gateway supervisor correctly opens a new WatchThread when the revision advances, but the test counted that new RPC's initial snapshot against the original subscription's native-event assertion. CI attempt 1 shows reason: "revision" immediately before the failure: https://github.com/itsoltech/canopy/actions/runs/42855632346/attempts/1.

Observe a single home WatchThread over the real gateway link, wait for its initial delta against the committed mirror cursor, and then require both a completed turn and an advanced watch_cursor. Liveness and coalescing stay enabled. Keep the native-event assertion and the prohibition on any further snapshot or delta, including across that revision heartbeat. The existing mirror-first/UI-checkpoint tests and the separate liveness suite retain coverage of routed reads and automatic recovery. Document this distinction in docs/linked-computers.md.

This is a test race with intentional recovery, with no production or protocol change. PR #484 fixed the separate ended-stream readiness race in this file. PR #509's bot-list cache invalidations do not enter this thread revision path; the shared probe in #410 compares durable revisions against snapshot checkpoints even when native events arrived successfully.

Verification

  • Unchanged baseline: 30/30 sequential full-file runs passed, 360 tests, zero failures or skips, with private temp cleanup passing every time. The natural flake did not reproduce locally.
  • Finished change: 30/30 sequential full-file runs passed, another 360 tests, zero failures or skips, with private temp cleanup passing every time. Every native-handoff test waited for the normal revision heartbeat; no sleeps or timing overrides remain.
  • Controlled reproduction with a temporary 1 ms home revision probe: the original test failed at the reported no-extra-snapshot/delta assertion after reason: "revision"; the revised test passed with the same fast probe and liveness/coalescing enabled. The timing override was removed.
  • Mutation check: temporarily duplicating the home stream's initial delta made the revised test fail at the retained no-extra-snapshot/delta assertion while still receiving native events. The mutation was removed.
  • bun install, bun run format, bun run typecheck, bun run lint, bun run format:check, and git diff --check passed. Self-review covered the test boundary, cursor acknowledgement, native-event coverage, revision heartbeat, cancellation, and unchanged recovery behavior. No UI copy changed.

All repeated file runs used TMPDIR=/var/tmp bun run check:tmp tests/integration/thread-mirror-deltas.test.ts, one test process at a time. Broader unfiltered tests, generation checks, and the web build were not run under the workspace's focused verification limits. Based on latest dev at task start, 7317c3bc6.

Related: #484
Related: #410
Related: #509

@nixuuu
nixuuu merged commit 100a827 into dev Nov 10, 2026
9 checks passed
@nixuuu
nixuuu deleted the test/mirror-cursor-handoff branch November 10, 2026 17:23
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