Skip to content

test(relay): two pass contract tests wait for the pass they read the status of - #3568

Merged
devswha merged 1 commit into
mainfrom
test/relay-pass-off-status-wait
Nov 10, 2026
Merged

devswha merged 1 commit into
mainfrom
test/relay-pass-off-status-wait

Conversation

@devswha

@devswha devswha commented Nov 10, 2026

Copy link
Copy Markdown
Owner

What

Test only: server/relay/pass.contract.test.ts. Two tests read pass in the relay status before the PC's pass had necessarily arrived, so they passed or failed by timing. No production code, no sleep, no polling.

  • "with passes off on the relay, a pass that allows no new client sessions is not told in the status" failed the local merge gate of fix(relay): leftovers of the add window: a close also stops an approved comparison, and the expiry timer is capped #3553 under load: pass.state was unavailable instead of ok, in 31 ms (not a timeout). A relay with passes off lets the PC in without its pass, so whether the relay's sync or the pass came first was a matter of timing, and the test read the status right after the sync. The account service's answer is now held until the sync (a signing hook in the fixture), so the pass always comes second and goes out on the open control socket; the test waits for that frame (f.renewal), as its neighbours do.
  • "a pass that allows no new client sessions is told in the status; one that allows them again clears it" was not seen failing, but its wait could be over before the pass it is for. On an enforcing relay a PC with no saved pass may have its first control socket refused before the pass comes; it then asks twice, and the second pass going out as a renewal settles the fixture's one-shot renewal. The PC now starts on a saved pass (f.savePass()), so it asks for none at startup and the only renewal is the test's own. The pass_versions check moved after that renewal, which is now the first request the PC makes.

Validation

  • Each failure reproduced on demand (temporary edits, not in this PR):
    • the reported test with the pass held until the sync and the status read where it used to be: 20 of 20 runs fail with the gate's diff (state unavailable, expected ok);
    • the old second test with its startup order forced (first socket refused before the first pass, second pass after the sync): a renewal went out at startup in 3 of 3 runs, and with the renewal's own pass left unanswered the test failed at once in 5 of 5 (new_sessions: false still there), so its wait had returned without its pass.
  • Under CPU load, both tests (bun test server/relay/pass.contract.test.ts -t "with passes off on the relay|one that allows them again clears it"): 200 runs one after another on 4 CPUs kept busy by 16 spinning processes: 200 pass, 0 fail. 240 runs as 24 copies at once on the same 4 CPUs: 240 pass, 0 fail. The load was pinned to 4 CPUs, not all cores, to leave the other lanes and the gate alone.
  • The load alone did not show the bug: the unfixed test also passed 100 of 100 and 240 of 240 under the same two loads, and 9 of 9 on an idle host in the merge pass's run. The gate's failure needs its own load shape, which is why the proof above forces the order instead.
  • bun test server/relay/pass.contract.test.ts at the pushed head: 20 pass, 0 fail.
  • bun run check fast at the pushed head (5aa034b, on main 14b5e8c): all ok (unit 14496 pass, 0 fail, 50 skip in 878 files). The loops ran on the same test file one main commit earlier (f885760); fix(relay): leftovers of the add window: a close also stops an approved comparison, and the expiry timer is capped #3553 does not touch it.
  • Skipped: check full, browser regressions, Windows and macOS. No changelog fragment: nothing a user notices.

🤖 Generated with Claude Code

…status of

Both read `pass` in the relay status before the PC's pass had necessarily
arrived, so they failed or passed by timing.

- "with passes off on the relay, ..." failed a local merge gate under load
  (`state` `unavailable` instead of `ok`). A relay with passes off lets the PC
  in without its pass, so whether its sync or the pass came first was timing,
  and the test read the status right after the sync. The account service's
  answer is now held until the sync (a `signing` hook in the fixture), so the
  pass always comes second and goes out on the open control socket; the test
  waits for that frame, as its neighbours do.
- "... one that allows them again clears it" waited on the fixture's one-shot
  `renewal`, which a second pass asked for at startup could settle first: an
  enforcing relay may refuse the PC's first control socket before its pass
  comes, and the PC then asks twice. The PC now starts on a saved pass
  (`savePass`), so the only renewal is the test's own.

No sleep, no polling, no production code.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • Updated relay pass tests to cover signing delays, pass renewal after session restrictions change, and renewal after relay synchronization.

The relay pass contract test fixture can delay account-service signing and save a signed pass. The client-session and passes-off tests now control signing timing and check pass renewal behavior.

Changes: Relay pass contract tests

Layer / File(s) Summary
Fixture signing and renewal tests
server/relay/pass.contract.test.ts
The fixture can pause pass signing and save a signed pass for the relay identity. The client-session test checks pass versions [1,2] before confirming the restriction clears. The passes-off test delays signing until sync resolves and waits for the renewal frame.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Merge Risk: Minimal · up to 5aa03

The tests coordinate pass timing without changing production behavior. No merge-blocking risk was identified.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly describes the test changes: two pass contract tests now wait for the pass whose status they inspect.
Description check Passed The description explains the problem, resulting behavior, and validation results. Its “What” heading covers the template’s Change section, and it includes the required Validation section with checks r…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, resulting behavior, and validation results. Its “What” heading covers the template’s Change section, and it includes the required Validation section with checks run and skipped.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 89e6e61 and 5aa034b.

Files selected for processing: 1

  • server/relay/pass.contract.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.

@devswha

devswha commented Nov 10, 2026

Copy link
Copy Markdown
Owner Author

Local merge gate: PASS

Local merge gate: PASS #3568 merge=57bc6293654f head=5aa034bbaa0f main=584d4cc391d1 on herdr-ci-runner:local on devswha-ThinkStation-P620 CPUs 64-127 in 951s, reruns=1

The Linux suites of the required checks (Fast checks, Integration and browser), run on main 584d4cc with this PR's head 5aa034b merged in (local merge 57bc6293654f, not pushed), as groups side by side in the self-hosted CI runner image on herdr-ci-runner:local on devswha-ThinkStation-P620 CPUs 64-127 (22% busy before the start, host load 109.96; shards=4 unit_workers=8 browser_main_workers=2 browser_other_workers=16). Scope: full. Native Windows install and the macOS checks are not part of this gate.

Step Command Result Seconds Counts
fast-install bun install --frozen-lockfile pass 0 -
release-guards bun scripts/release-guards.ts --base 584d4cc391d1 pass 0 -
fast bun run check fast pass 209 tests 14497 pass / 0 fail; check steps 6 ok / 0 failed
integration-install bun install --frozen-lockfile pass 0 -
integration bun run check integration pass 233 tests 1386 pass / 0 fail; check steps 3 ok / 0 failed
browser-main-install bun install --frozen-lockfile pass 0 -
browser-main-build bun run build pass 16 -
browser-main BROWSER_SCRIPTS=ui-regression,ui-contexts-regression bun run check run -- bun scripts/ci-browser-parallel.ts pass 392 browser scripts 2/2 passed
browser-other-install bun install --frozen-lockfile pass 0 -
browser-other-build bun run build && bun run build:shell pass 24 -
browser-other BROWSER_EXCLUDE=<those two> bun run check run -- bun scripts/ci-browser-parallel.ts pass 915 browser scripts 185/185 passed

Reruns:

  • browser scripts/relay-e2e-regression.ts failed, then passed on its automatic second run

Total 951s.

@devswha
devswha merged commit d5bf5c0 into main Nov 10, 2026
20 checks passed
@devswha
devswha deleted the test/relay-pass-off-status-wait branch November 10, 2026 10:39
@devswha

devswha commented Nov 10, 2026

Copy link
Copy Markdown
Owner Author

Merge pass

Merged head 5aa034bbaa0f as d5bf5c0b5ebe on the local merge gate, with no unresolved review threads.

Reviewer Verdict Note
codex CLEAR

One reviewer: owner's test-only PR: one contract test file.

Test-only (server/relay/pass.contract.test.ts): one reviewer (Codex Terra), CLEAR with no findings. Fixes the flake that failed an unrelated local merge gate.

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