Repository navigation
test: poll for the deep-link terminal event, not a fixed flush - #5
Conversation
Greptile SummaryThis PR replaces a fixed-window
Confidence Score: 5/5Safe to merge — test-only change that removes a timing-dependent helper and substitutes a deterministic poll. The change targets an isolated async-timing problem in test infrastructure. The vi.waitFor strategy is idiomatic Vitest and the 5000 ms ceiling is generous enough for CI under load. Negative assertions are correctly ordered after the terminal event. No production code is touched. No files require special attention. Important Files Changed
|
The four deep-link callback tests gated their assertions on
flushAsync(), a fixed 5-microtask + 5 ms window. The callback
pipeline unseals real crypto state (via authkit-session) before the
code exchange, so under parallel test-file load the fixed window lost
the race roughly 1 in 5 full-suite runs ("authenticateWithCode called
0 times").
Each test now awaits vi.waitFor() on its terminal observable event —
the renderer broadcast (sendSpy called once) — with a 5 s timeout
before running its remaining assertions. Negative assertions are safe
because they run after the pipeline has provably completed. The
flushAsync helper (and its orphaned doc comment) is removed as dead
code.
Verified: 12 consecutive full-suite runs green (153/153); lint and
typecheck pass.
5e982be to
dc4121f
Compare
The four deep-link callback tests in
create-auth-kit.spec.tsgated their assertions onflushAsync()— a fixed 5-microtask + 5 ms window. The callback pipeline unseals real crypto state (via authkit-session) before the code exchange, so under parallel test-file load the window lost the race roughly 1 in 5 full-suite runs, failing withauthenticateWithCode/sendSpyat 0 calls while always passing in isolation.Each test now
vi.waitFors its terminal observable event — the renderer broadcast — then runs its remaining assertions. Negative assertions (e.g. "the exchange never ran") stay sound because they execute after the terminal event proves the pipeline completed.flushAsyncis removed as dead code.Verified: 12 consecutive full-suite runs green (153/153); the flake reproduced reliably within ~5 runs before the fix.