Repository navigation
Description
What happened?
TestProfileMiddleware_RefusalWorkIndependentOfFleet still intermittently fails under -race on a clean upstream checkout after #1337. This is a follow-up to that test-only fix, not a report of a proven production timing side channel.
Verified on unmodified main at f2e58df33724dca64c064ffd229bb8455442ad41, macOS arm64, Go 1.27.1 (the module requires Go 1.26.0). No application patch or new test file was present in the baseline checkout.
Reproduction
go test -race ./internal/server -run '^TestProfileMiddleware_RefusalWorkIndependentOfFleet$' -count=15 -vIn one run, 4 of the 15 parent-test executions failed in 13.137 seconds. Failing subcases included deleted_pin, pin_mismatch,_existing_slug, pin_mismatch,_absent_slug, zero-reach_pin, and scoped,_absent_slug. The measured difference was only one allocation, in either direction:
expected: 33
actual: 34
deleted pin must allocate exactly like the empty fleet on every fleet:
map[4096 hidden servers:34 4096 others:34 no profiles:33 pin only:34]
Another failing reading:
expected: 34
actual: 33
pin mismatch, absent slug must allocate exactly like the empty fleet on every fleet:
map[4096 hidden servers:33 4096 others:33 no profiles:34 pin only:33]
The full internal race suite also hit the same test (scoped,_absent_slug, expected 33 / actual 32), while all 70 other tested packages passed. A subsequent three-repeat focused run passed, consistent with intermittent measurement instability.
Expected behavior
The non-disclosure witness should still catch fleet-proportional work while avoiding intermittent failures from the small allocator bias described in #1337.
Scope and uncertainty
The test already uses retryUntilAllocsMatch(15, 20, ...) and settleBackgroundGoroutines. The clean-checkout reproduction confirms that these mitigations do not always converge in this environment. The precise cause, and whether the same behavior occurs with the CI Go 1.26 toolchain or other operating systems, remain unverified.
No production authorization behavior was changed or bypassed, and no test assertion was weakened. This was discovered while validating the independent MCP OAuth health correction in #1522 and is kept separate from that patch.
Searched existing issues for this test and allocation/race reports; found the merged #1337 but no open follow-up.
Activity
test(server): keep exact allocation parity for the pin-outcome test
fix(server): use canonical OAuth health in MCP upstream list (#1525)
test(server): bound profile-gate allocation parity to a 2-alloc toler…