test(coverage): drive plans + quota to ≥95%#138
Merged
Conversation
- internal/plans: cover Rank() (was 0%) — total-order, unknown-tier sentinel, yearly-not-auto-normalised, strict-increasing ladder invariant. Package now at 100.0% (was 92.9%). - internal/quota: cover the error/fail-open branches that the integration suite skips — Redis-down pipeline error in CheckAndIncrementToken, redis-error in GetThroughputCount, closed-DB error in CheckStorageQuota (fail-open) and UpdateStorageBytes (does NOT fail open). Also lock the LimitBytes MB→bytes conversion + unlimited sentinel (P2 regression surface 2026-05-17). Package now at 95.0% (was 82.5%). Both use miniredis (already in go.mod) for offline Redis-down simulation; no new deps. 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/plans: 92.9% → 100.0%. CoverRank()(was 0%) — total-order ladder, unknown-tier sentinel (-1), yearly-not-auto-normalised, strict-increasing invariant.internal/quota: 82.5% → 95.0%. Cover the fail-open error branches the integration suite skips:CheckAndIncrementTokenRedis-down pipeline errorGetThroughputCountRedis errorCheckStorageQuotaclosed-DB error (fail-open contract)UpdateStorageBytesclosed-DB error (does NOT fail open — caller retries)LimitBytesMB→bytes conversion + unlimited sentinel (P2 regression surface 2026-05-17)Uses
miniredis(already in go.mod) for offline Redis-down simulation; no new deps.Test plan
go test ./internal/plans -coverprofile=...→ 100.0%go test ./internal/quota -coverprofile=...→ 95.0% (Redis-down tests pass offline; DB-bound tests require CI service containers from ci(coverage): add postgres + redis + mongo service containers #135)go build ./internal/plans ./internal/quota+go vetclean🤖 Generated with Claude Code