Repository navigation
test(computers): wait for home snapshots after reconnect - #484
Merged
Merged
Conversation
An offline watch can end after its cached syncing seed without reaching the home. Retry ended watches until a non-syncing full snapshot arrives, and force the offline-to-legacy reconnect in the existing integration test while preserving its full-history and no-delta assertions.
nixuuu
added a commit
that referenced
this pull request
Nov 10, 2026
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
This was referenced Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
During a linked-computer reconnect, an offline
WatchThreadcan end after delivering only its cachedsyncing=truesnapshot.watchUntil()also returns when its stream ends without satisfying the predicate, so the mirror-delta fixture could finishopen()before any home snapshot was requested. The failed release log has no new home-watch subscription before the assertion. This is a test readiness race.Make the file-local
open()retry an ended stream until it observes a full snapshot withsyncing=false, with a bounded condition wait and an explicit completion assertion. Force the failure window in the existing older-home test: wait for disconnection, observe the offline seed, then reconnect the legacy home. Keep the exact 2,999-item home-snapshot assertion, the no-delta assertions and the legacy publisher checks. No product or protocol changes and no fixed sleeps.Failure: https://github.com/itsoltech/canopy/actions/runs/42796634169
Verification
TMPDIR=/var/tmp bun run check:tmp tests/integration/thread-mirror-deltas.test.ts: unchanged baseline 30/30 passed; corrected implementation with controlled reconnect 30/30 passed. Each loop ran 360 tests, with zero failures or skips; all 60 runs confirmed temp-directory cleanup. The natural flake did not reproduce in the baseline.bun install,bun run typecheck,bun run lint,bun run format:checkandgit diff --checkpassed. The final lint correction added only a blank line.check:tmp, generation checks and the web build were not run locally in this focused verification scope.Based on the latest
devat task start,0e4a8855.