Skip to content

test(computers): serialize pairing fixture startup - #582

Merged
nixuuu merged 1 commit into
devfrom
test/pairing-suite-stability
Nov 12, 2026
Merged

nixuuu merged 1 commit into
devfrom
test/pairing-suite-stability

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 12, 2026

Copy link
Copy Markdown
Member

The pairing suite could leave a deliberately persisted pairing_required untouched when restoring the original peer. Its shared fixture starts the runtime before the listener (tests/integration/support/computers.ts:42), so a startup dial races the listener's first address announcement. That announcement retires sockets and aborts dials (apps/gateway/src/computers/runtime-lan.ts:51). The suite's single reconnect tick can observe the closing incoming connection and skip dialing (apps/gateway/src/computers/runtime-connection.ts:149); its next automatic retry is deliberately 60 seconds away, beyond the 5-second assertion window.

This is fixture timing. The #579 failure occurs in restoreB(), after the test intentionally sets pairing_required, not in shared setup or a previous test. The failed job shows two expected server_pin_mismatch probes followed by an aborted startup connection and no subsequent successful handshake. Self-heal writes connected only after a successful pinned handshake (apps/gateway/src/computers/runtime-frames.ts:316–321). There is no evidence here of that write being overwritten.

Pause dialing during fixture startup until its listener and initial address publication have completed. Explicit ticks then establish links, and shared setup/recovery wait for each gateway's own committed connected status. Preserve the cross-version metadata barrier, remove its route-deletion workaround, and extend the persisted-state recovery case with a barrier holding listener startup open.

Validation:

  • With the previous startup helper, the controlled barrier fails deterministically: expected zero startup dials, received one.
  • Five consecutive complete file runs with TMPDIR=/var/tmp nice -n 19 bun run check:tmp ./tests/integration/linked-pairing-recovery.test.ts: 10 passed, 0 failed each time (50 test executions), each about 4.4 seconds; every temp-directory check passed.
  • Changed-file formatting, lint and git diff --check pass. No other local tests run.
  • Pending: two complete consecutive green CI attempts on the same head, rerunning the entire workflow once.

Related: #573
Related: #575
Related: #579

Pause fixture dialing until listener startup and initial route publication finish. Await both handshake commits and cover the startup window with a controlled barrier.

Related: #573

Related: #575
@nixuuu
nixuuu marked this pull request as ready for review November 12, 2026 18:01
@nixuuu
nixuuu merged commit 6d48813 into dev Nov 12, 2026
24 of 26 checks passed
@nixuuu
nixuuu deleted the test/pairing-suite-stability branch November 12, 2026 18:08
nixuuu added a commit that referenced this pull request Nov 12, 2026
The chained-update watchdog test intermittently exposed an empty or
partially written `.update.json` through shell `>` redirection. CI run
43270195463, attempt 2, failed with `SyntaxError: Unexpected EOF` in
`readUpdateRecord`. The production writer has used a private temporary
file, file `fsync`, and atomic rename since its introduction; the
failing fixture bypassed it.

The v2 and v3 fixtures now call the real `confirmStartup` and
`stageBinaryUpdate` APIs. A deterministic write barrier pauses the real
confirmation writer after half its bytes and checks that readers still
see the previous pending record, then the complete confirmation. A torn
authoritative JSON regression checks that corruption remains an error.
No read retries or updater/protocol behavior changes are needed for this
failure. The frozen update protocol is untouched.

Validation: Bun 1.4.4; `bun install --frozen-lockfile`; 10 consecutive
separate executions of `TMPDIR=/var/tmp nice -n 19 bun test
packages/updater/src/binary.test.ts` (8 tests each, 80 passes, 0
failures, about 4 seconds total); repository-wide `bun run lint` and
`bun run format:check`; `git diff --check`. Generation, typecheck, the
full test/temp checks, and builds are left to CI under the local
verification constraints. CI repetition is pending.

History: #10 introduced the shell fixture; this test-only correction
uses `Related:` so it does not trigger a release/promotion hold.

Related: #10
Related: #582
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