Wait for the refresh's log lines before counting them #254

Merged
cruelacid merged 1 commit from worktree-diaglog-race into main 2026-10-02 13:26:58 +01:00
Owner

Fixes FLAKE-9.

identity.test.ts, "presents a rotated refresh token once, however many loaders were refused together", failed on main run 1199 (commit 938a4df). The pull request's run 1197 of the same commit had passed it.

The behaviour under test succeeded: three recoveries, one rotation, still signed in. Only the log count failed, reading 0 where 1 was expected. The plugin appends to diag.log through a queue of promises, so a line can land after the call that logged it has returned. The test read the file once, straight away.

It now waits up to 10 s for the refresh line and both join lines, then asserts the exact counts, so a duplicate refresh (the bug this test exists for) still fails. The change is test-only.

Verification

  • pnpm test, pnpm -r typecheck, pnpm lint, build-mirror --check and check-conformance --check all pass.
  • Full container e2e: 160 passed, 2 skipped. identity.test.ts then ran 3 more times in a row, 14/14 each.
  • The race is timing-dependent and was not reproduced on demand, so no before/after run shows the fix working; it rests on reading the log sink.

Changelog

NONE

🤖 Generated with Claude Code

https://claude.ai/code/session_01AsUFqoi4GHKYjFtPbYCgRp

Fixes FLAKE-9. `identity.test.ts`, "presents a rotated refresh token once, however many loaders were refused together", failed on main run 1199 (commit `938a4df`). The pull request's run 1197 of the same commit had passed it. The behaviour under test succeeded: three recoveries, one rotation, still signed in. Only the log count failed, reading 0 where 1 was expected. The plugin appends to `diag.log` through a queue of promises, so a line can land after the call that logged it has returned. The test read the file once, straight away. It now waits up to 10 s for the refresh line and both join lines, then asserts the exact counts, so a duplicate refresh (the bug this test exists for) still fails. The change is test-only. ## Verification - `pnpm test`, `pnpm -r typecheck`, `pnpm lint`, `build-mirror --check` and `check-conformance --check` all pass. - Full container e2e: 160 passed, 2 skipped. `identity.test.ts` then ran 3 more times in a row, 14/14 each. - The race is timing-dependent and was not reproduced on demand, so no before/after run shows the fix working; it rests on reading the log sink. ## Changelog NONE 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01AsUFqoi4GHKYjFtPbYCgRp
Wait for the refresh's log lines before counting them
All checks were successful
Release note / release-note (pull_request) Successful in 15s
CI / build (pull_request) Successful in 5m17s
CI / e2e (pull_request) Successful in 8m42s
CI / promote (pull_request) Has been skipped
CI / build (push) Successful in 5m44s
CI / e2e (push) Successful in 8m34s
CI / promote (push) Successful in 32s
0bd055b756
"presents a rotated refresh token once" read diag.log once, straight after the
three recoveries resolved, and counted "Cloud session refreshed". The plugin
appends to that file through a queue of promises, so the line can land after
the call that logged it has returned: on main run 1199 the refresh had
happened (rotated, still signed in) and the count read 0. It passed on the
pull request's run of the same commit.

It now waits for the refresh line and both joins to arrive, then asserts the
exact counts, so a duplicate refresh — the bug it guards — still fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AsUFqoi4GHKYjFtPbYCgRp
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Nectenda/nectenda!254
No description provided.