test(jobs): close sub-95% residual branches via test seams#54
Merged
Conversation
New org policy forbids coverage waivers, so the three job files that landed below the >=95% mandate are closed using package-var test seams that make otherwise-unreachable defensive arms exercisable while keeping production defaults byte-for-byte identical: - quota_infra.go (93.5% -> 98.4%): route sql.Open through `sqlOpen` and validateSuspendIdent through `validateIdent` package vars. The seams drive the lib/pq lazy-open error fail-open arm (Open never errors at Open time in prod) and the usr_-identifier guard (db_/usr_ share a token so the db check always short-circuits first in prod). - expire_imminent.go (90.4% -> 96.2%): route json.Marshal through a `jsonMarshal` package var to drive the primitive-only-map marshal-error skip branch. - expiry_reminder_email.go (84.0% -> 100%): swap the html/text template package vars for templates whose Execute fails, driving both Sprintf fallback bodies guarded by template.Must at init. All seam overrides restore the production binding in t.Cleanup. CI gate (go build + vet + go test ./... -short) green; full job suite green. 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
New org policy forbids coverage waivers. Three job files landed below the >=95% mandate; this PR closes them using package-var test seams that make otherwise-unreachable defensive arms exercisable, with production defaults byte-for-byte identical.
internal/jobs/quota_infra.gointernal/jobs/expire_imminent.gointernal/jobs/expiry_reminder_email.goSeams
sqlOpen(quota_infra): drives the lib/pq lazy-open error fail-open arm — lib/pq'ssql.Opennever errors at Open time in prod (errors surface lazily on first use).validateIdent(quota_infra): drives theusr_-identifier guard —db_<token>/usr_<token>share the same token, so the db check always short-circuits first for any failing token in prod.jsonMarshal(expire_imminent): drives the primitive-only-map marshal-error skip branch.Executefails, driving both Sprintf fallback bodies guarded bytemplate.Mustat init.All overrides restore the production binding in
t.Cleanup.Test plan
go build ./... && go vet ./...greengo test ./... -short -count=1green (exit 0)cover -funcprofile — all three >=95%Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
🤖 Generated with Claude Code