Skip to content

test(providers): gate turn account updates in sign-in race test - #715

Merged
nixuuu merged 1 commit into
devfrom
test/providers-signin-deterministic
Nov 14, 2026
Merged

nixuuu merged 1 commit into
devfrom
test/providers-signin-deterministic

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 14, 2026

Copy link
Copy Markdown
Member

The delayed-rejection test sometimes reads expired before the successful turn's account update runs, even though the turn is already committed. This is a test race: ingestion commits the turn, then awaits settling, broadcasts and agent-bus handling before calling coreTurnLogin. A database count therefore cannot establish that the success has entered ProviderAccounts.afterTurn; the test's no-op queue barrier can run ahead of it.

Observe the real account-update enqueue, keep the rejected account read held until the success is queued, then wait for both real updates to finish before asserting signed_in. Waiting for both independently also catches a stale rejection when ordering is broken. Remove the database-count helper and the two-second sampling loop. Product ordering in provider-accounts.ts and turn-logins.ts stays unchanged.

Related: #696, #700, #703

Verification

  • Stress: 171 passed, 29 failed out of 200 (14.5% failures) before; 200 passed, 0 failed after. Each repetition runs the focused file, including the earlier device-login scenario this case depends on; the target case executes once per repetition. The after run passed all 800/800 tests in 310.99 s. No retries, sleeps or timeout increases were added.
  • The baseline used 48 completed direct repetitions, then 152 with the repository's shared-Postgres runner. The after run used nice -n 10 bun run check:tmp <focused-file> --rerun-each=200; its identical source was staged under a temporary test filename so the unchanged baseline could run alongside it. Both used a private TMPDIR under /var/tmp.
  • Mutation check: bypassing the real queue with update() makes the new test fail with Expected: signed_in / Received: expired. The mutation was confined to a temporary test copy and removed.
  • bun install, bun run typecheck, bun run lint, bun run format:check, and the final focused file: passed, all with nice -n 10 and temp under /var/tmp. The shared-Postgres runner reported no test temp directories left behind.

No UI, protocol or runtime behavior changes.

@nixuuu
nixuuu merged commit 1066812 into dev Nov 14, 2026
9 checks passed
@nixuuu
nixuuu deleted the test/providers-signin-deterministic branch November 14, 2026 12:57
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