Skip to content

[Bug]: Windows CI flake in auth password-hashing contention test (auth-core.test.ts:489, #464) #506

Closed

Description

@jimhoyd

Observed

Scheduled nightly verify run on main failed with exactly one test failure out of 213 tests in packages/auth, only on the windows-latest, node 22 matrix cell — every other OS/Node combination (ubuntu ×3, macos ×3, windows 24/26) passed.

Failed run: https://github.com/jimhoyd-com/urlcode/actions/runs/35862542419/job/107186074946

Failing test

packages/auth/test/auth-core.test.ts:489, password hashing queues briefly under contention instead of refusing every caller past two (#464):

test('password hashing queues briefly under contention instead of refusing every caller past two (#464)', async (t) => {
    const { service } = await setup(t), altPassword = 'a different synthetic passphrase 1';
    await service.register({ email: '[email protected]', password });
    await service.register({ email: '[email protected]', password: altPassword });
    // Only two password derivations run concurrently process-wide; without a bounded wait queue,
    // every caller beyond the first two used to fail immediately with password_hash_busy instead
    // of waiting briefly for a slot.
    const attempts = Array.from({ length: 6 }, (_, index) => service.login({ email: index % 2 ? '[email protected]' : '[email protected]', password: index % 2 ? password : altPassword, client: '198.51.100.' + (index + 1) }));
    const results = await Promise.allSettled(attempts);
    assert.deepEqual(results.map(r => r.status), Array(6).fill('fulfilled'));
});

Failure detail

AssertionError, one of the six Promise.allSettled results came back 'rejected' instead of the expected 'fulfilled':

Expected values to be strictly deep-equal:
+ actual - expected
  [
    'fulfilled', 'fulfilled', 'fulfilled', 'fulfilled', 'fulfilled',
+   'rejected'
-   'fulfilled'
  ]

This test intentionally races 6 concurrent logins against a process-wide 2-slot concurrent password-derivation limit, asserting the bounded wait queue lets every caller past the first two wait briefly for a slot rather than being refused with password_hash_busy. On a loaded/slower Windows CI runner, the queue wait for the tail callers can plausibly exceed whatever timeout or budget governs that queue, causing a real password_hash_busy rejection instead of an eventual fulfillment — a timing assumption baked into the test rather than a functional regression.

Related prior art

Similar in flavor to #339 (Windows CI flakiness in packages/admin's auth-store worker startup, fixed via a configurable startup budget in #424) — but this is a different code path (in-process password-hash concurrency queue in auth-core.ts, not the cross-process auth-store worker), so likely needs its own fix rather than being the same root cause.

Suggested next step

Capture the actual queue-wait/rejection timing on the next Windows failure (similar to how #339 added stage reporting) to tell whether this is a fixed too-tight budget vs. genuine runner-wide slowness, then either raise the queue's wait budget for CI or make it configurable the way #424 did for the auth-store worker.

What was not verified

Single occurrence (n=1) on this specific run; not yet confirmed to be reproducible or how frequently it recurs.

Activity

  1. added
    bug
    on Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions