test(coverage): drive internal/middleware + crypto to ≥95%#155
Merged
Conversation
middleware was ~51.8%; black-box + white-box suites now cover auth bearer/JWT extraction, fingerprint masking + dedup cap, geo fail-open (+ real MaxMind fixture), rate-limit fail-open on Redis error, idempotency canonicalisation, DPoP helpers, role lookup, and the NewRelic emit path. Also fixes a flaky base64-prefix assertion in the already-merged crypto coverage test (a random nonce can legitimately begin with "v"; the real invariant is "not a vN. versioned envelope"). internal/middleware 95.3% · internal/crypto 95.6% Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
internal/middlewarefrom ~51.8% to 95.3% and keepsinternal/cryptoat 95.6% (both ≥95% target).testdata/), rate-limit fail-open on Redis error + nil-client, idempotency canonicalisation (JSON/multipart + empty-key 400), DPoP helpers (jwkThumbprintBase64URL,requestCanonicalURLfallback,urlMatchesedges),PopulateTeamRoleDB-error path, and the NewRelic emit helpers.v, soTestKeyring_Decrypt_LegacyUnversionednow asserts the real invariant ("not avN.versioned envelope") instead of "does not start with v".Test plan
go test ./internal/middleware ./internal/crypto -coverprofile -count=1 -p 1→ middleware 95.3%, crypto 95.6%, all passgo vet+go buildclean on both packagesorigin/master(passes theup-to-date-with-baseCI gate)make gategreen (ignore pre-existingscan / osv-scan)🤖 Generated with Claude Code