test(coverage): db runner + straggler packages to ≥95%#146
Merged
Conversation
…pers
Covers the platform-DB boot gate: migration apply + idempotency, schema
version tracking via schema_migrations rows + applied_at preservation,
record-failed warn branch (via view-masking the table), connect-helper
panic paths (bad DSN + unreachable host), Err{DB,Redis}Connect Error +
Unwrap, ConnectRedis happy path, and the ticker.C branch of the pool
stats exporter.
Coverage: 35.1% → 95.7% (rule-22 enumeration: 13 functions, 13 touched;
remaining 4.3% is defensive if-err blocks on embed.FS reads which
provably never fail on a compiled-in directory).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds focused tests for the sub-95% api support packages not owned by
sibling coverage agents:
cliconfig 70.0% → 97.5% (configPath/Load/Save/Clear error branches)
experiments 88.5% → 100% (register panics + empty-variant guard)
circuit 92.3% → 100% (NewBreaker clamps, all State() branches, Name)
cache 85.3% → 97.1% (SET marshal-fail, type-mismatch, Invalidate err)
email 82.3% → 97.0% (breaker ctor/ProviderName/keyless wrappers;
resolveProvider, sendWithKey ledger+suppression
fail-open, brevo/resend provider Send paths,
maskEmail edges)
telemetry 80.4% → 85.7% (OTEL_SERVICE_NAME override, TLS/insecure,
license-key header, sentinel-key paths)
telemetry's remaining gap is two genuinely untriggerable defensive
branches (otlptracegrpc.New / resource.New constructor failures — both
dial lazily and never error with valid args; no injection seam exists,
and tracer.go carries an explicit "do not revert" P0-2 note). All other
owned packages clear the 95% bar. Test-only changes; no production code
touched.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
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
Drives
internal/db(migration runner) and the remaining sub-95% apisupport packages to ≥95% statement coverage. Scoped to DB-runner +
stragglers only (handlers/models/middleware/crypto/providers/plans/
tokens/quota/config/metrics/provisioner/razorpaybilling are owned by
sibling agents and untouched here).
internal/telemetrycannot reach 95% without modifying productiontracer.go: the two uncovered branches areotlptracegrpc.New/resource.Newconstructor failures, which dial lazily and never errorwith valid arguments. There is no injection seam, and the file carries
an explicit P0-2 "do not revert" note — adding a test seam was judged
out of scope / higher-risk than the 6 uncovered statements.
This branch includes the rebased
internal/dbcommit from #139 (rebasedonto current master so the up-to-date-with-base gate is green). If #139
merges first, this can be re-targeted; otherwise this supersedes it.
Test-only changes — no production code modified.
Test plan
go build ./...+go vet ./...clean-short -count=1 -p 1against the test DB-coverprofileconfirms the table aboveNote: a pre-existing flake in
internal/models(
TestCreateStackWithCap_ConcurrentRaceCannotBypassCap) is unrelated tothis PR — that package is untouched here and the test fails identically
on a clean checkout.
🤖 Generated with Claude Code