Repository navigation
test(keys): race-detector stress the key-rotation trust path under load - #13
Closed
terraboops wants to merge 1 commit into
Closed
terraboops wants to merge 1 commit into
terraboops wants to merge 1 commit into
Conversation
Concurrency/race audit of key rotation. Source review shows Set (RWMutex over current/retired), Published (RWMutex over the merged union) and the proxy's atomic.Pointer swap are all lock-disciplined. This test backs that with a probe: a rotator churns the signing key while eight signers mint-and-verify, two readers hammer both JWKS views, and a publisher writes/re-reads the shared union — all concurrently, so the suite's -race run flags any missing lock. It also asserts the trust-path invariant: a token minted with the current key stays verifiable through concurrent rotations while inside the overlap window. Result: clean. ~12k-20k sign+verify cycles per run, no data race, invariant holds. The probe was validated by injecting a race (dropping Set.PublicKey's read lock), which -race reliably flagged; the committed code passes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SDfMmeRXGsanqzDDSjL1uU
terraboops
force-pushed
the
test/rotation-race-audit
branch
from
September 27, 2026 08:54
59cb502 to
8ba6740
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What (§1 concurrency/race audit — the key-rotation trust path)
Audits key rotation under concurrency. Source review:
Set(RWMutexovercurrent/retired),Published(RWMutexover the merged union), and the proxy'satomic.Pointerswap are all lock-disciplined. This test backs that with a probe rather than asserting it.TestKeyRotationConcurrencyUnderLoad: a rotator churns the signing key while 8 signers mint-and-verify, 2 readers hammer both JWKS views, and a publisher writes/re-reads the shared union — all concurrently. The suite's-racerun flags any missing lock. It also asserts the trust-path invariant: a token minted with the current key stays verifiable through concurrent rotations while inside the overlap window.Result: clean (no defect)
~12k–20k sign+verify cycles/run, no data race, invariant holds.
Probe validated: I injected a race (dropped
Set.PublicKey's read lock) and-racereliably flaggedDATA RACE; the committed code passes. So the clean result is meaningful, not a probe that can't see races.Durable: CI already runs
go test -race ./..., so this runs on every change.No merge — review only.
🤖 Generated with Claude Code
https://claude.ai/code/session_01SDfMmeRXGsanqzDDSjL1uU