Repository navigation
test(threads): await completion before comparing subscribers - #567
Merged
Merged
Conversation
Answer text can arrive before turnFinished, so independently scheduled desktop and phone readers can legitimately have different lastSeq values. Hold the desktop after its answer, let the phone finish, then release it and wait for the specific turn and sequence to converge. Preserve both late cleanup orderings. Related: #350, #541, #566
nixuuu
marked this pull request as ready for review
November 12, 2026 10:48
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.
The late-cleanup integration test compared two live readers' sequence numbers as soon as each contained the answer text. The worker publishes that item before
turnFinished, so an independently scheduled reader can already be at the final sequence while the other still has only the answer. Run 43196187406, attempt 2, job Tests (4/4) failed atthread-multiclient.test.ts:169withExpected: 4n,Received: 3n; both answer-presence waits had succeeded.Wait for completion of the specific sent turn and sequence convergence before comparing readers. Make the timing difference deterministic: publish an in-progress answer through the real scripted worker, pause the desktop reader after applying it, let the paired phone consume completion, assert that the desktop legitimately lags, then release it and verify convergence. Both abort/return cleanup orderings still run over real gateway/worker and paired-phone transports. The gate is released in cleanup, and no production hook or timed sleep is added.
This test uses the legacy local watch path (
sequenceis unset), not #541's sequence-resume reader. The premature equality assertion dates to #350; the captured failure does not show shared-subscription teardown. There are no production changes and noFixes:link. The existing 20 repeated move tests remain unchanged.Validation: changed-file oxfmt/oxlint and
git diff --checkpassed. No local tests, installs, typechecks or builds while the host measurement is running. All required checks and two consecutive complete CI passes on the final head are pending remotely.Related: #350, #541, #566