Skip to content

fix: make auth store startup budget raisable for slow CI runners (#339) - #424

Merged
jimhoyd merged 1 commit into
mainfrom
fix/339-auth-store-startup-budget
Sep 22, 2026
Merged

jimhoyd merged 1 commit into
mainfrom
fix/339-auth-store-startup-budget

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Refs #339

Cause (unverified)

Locally the pagination test runs in ~0.26s (whole file 1.2s) versus 12-18s on windows-latest, so the failures are almost certainly runner slowness (worker + native SQLite open under load), not a product bug. I could not reproduce on Windows, so this is not confirmed.

Change

  • URLCODE_AUTH_STORE_STARTUP_MS raises the worker readiness budget. Default and floor stay 15000ms, cap 120000ms; invalid or lower values are ignored, so production behavior is unchanged unless an operator opts in.
  • The workspaces CI job sets it to 60000.
  • Unit test for the parsing.

Not addressed

The second symptom (#333, Narrow the user filters after 12.7s) comes from the fixed 5s deadline in exportUserRange, a production bound I deliberately did not loosen. It is the same slowness manifesting later in the test; if it recurs, the test or that bound needs a separate decision. Hence Refs, not Closes.

Verification

lint and typecheck pass; packages/auth (198) and packages/admin (64) tests pass. Full npm run verify stops at check-workspace-links in this worktree because node_modules resolves to the main checkout (environment artifact, not this change).

🤖 Generated with Claude Code

Adds URLCODE_AUTH_STORE_STARTUP_MS (default and floor 15000, cap 120000) and
sets it to 60000 for the workspaces CI job.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@jimhoyd
jimhoyd merged commit 06f2179 into main Sep 22, 2026
35 checks passed
@jimhoyd
jimhoyd deleted the fix/339-auth-store-startup-budget branch September 22, 2026 01:43
jimhoyd added a commit that referenced this pull request Sep 23, 2026
…ners (#506) (#536)

A nightly windows-latest/node22 `verify` run flaked at auth-core.test.ts:489
(#464's contention regression test): the bounded password-hash wait queue's
fixed 2000ms per-waiter timeout let one of 6 concurrent callers time out
instead of getting a slot.

The queue is a HASH_SLOTS=2 semaphore with a HASH_QUEUE_MAX=16 wait list; each
waiter's wait is capped by a single fixed HASH_WAIT_MS. A tail waiter under
6-way contention can sit behind multiple scrypt derivations finishing ahead of
it, so its wait scales with how many derivations must complete first, not just
one. 2000ms is comfortable headroom locally but leaves no margin on a slower
shared CI runner.

Mirrors #424's fix for the analogous auth-store startup flake (#339): add
hashWaitBudgetMs(), reading URLCODE_AUTH_HASH_WAIT_MS to raise (never lower)
the per-waiter budget, default and floor 2000ms, capped at 30000ms. Sets it to
10000ms in the workspace-verify and workspace-integration CI jobs. The queue's
depth/slot bounds and the test's "all 6 must fulfill" guarantee are unchanged
— this raises the timing headroom rather than weakening the assertion #464
introduced.

Adds a focused regression test for the new budget function alongside the
existing #464 contention test, following the style of storeStartupBudgetMs's
test in auth-store.test.ts.

Closes #506

Co-authored-by: Claude Sonnet 5 <[email protected]>
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