Skip to content

test(coverage/logctx): drive logctx to ≥95% (was 87.1%)#25

Merged
mastermanas805 merged 1 commit into
masterfrom
coverage/logctx-95
May 21, 2026
Merged

test(coverage/logctx): drive logctx to ≥95% (was 87.1%)#25
mastermanas805 merged 1 commit into
masterfrom
coverage/logctx-95

Conversation

@mastermanas805
Copy link
Copy Markdown
Member

Summary

  • Covers Handler.WithGroup (was 0%) by asserting service + commit_id still inject under a named group.
  • Covers the if ctx == nil guard in WithTraceID / WithTID / WithTeamID (each 66.7%) with a table test that round-trips through the matching getter.
  • logctx coverage: 87.1% → 100.0%.

Test plan

  • go test ./logctx -coverprofile=/tmp/l-cov.out
  • go tool cover -func=/tmp/l-cov.out reports 100.0%
  • go vet ./logctx clean
  • No production code touched — tests only

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

🤖 Generated with Claude Code

Adds tests for the uncovered branches in common/logctx:

- WithGroup on the wrapper handler (was 0% — entire function uncovered)
  now exercised via TestHandler_WithGroupPreservesService, which also
  asserts that service + commit_id continue to be injected on records
  emitted through a grouped child handler.
- The `if ctx == nil` guards in WithTraceID / WithTID / WithTeamID
  (each 66.7% — only the happy path was hit) covered by
  TestKeys_WithSettersAcceptNilCtx, which passes an explicitly nil
  context to each setter and round-trips through the matching getter.

Result: logctx coverage 87.1% → 100.0%.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mastermanas805 mastermanas805 merged commit d7d26f3 into master May 21, 2026
9 checks passed
@mastermanas805 mastermanas805 deleted the coverage/logctx-95 branch May 21, 2026 19:27
mastermanas805 added a commit that referenced this pull request May 21, 2026
Caps the cross-repo 95% coverage push for `common`. After PRs #25-#30
landed for crypto/nats/plans/readiness/r2/logctx, the two remaining
storage backends sat at 63.6% (dospaces) and 72.2% (s3).

dospaces -> 100.0% via accessor + customerEndpointURL fallback coverage:
all simple getters (MasterAccessKey, MasterSecretKey, Endpoint, PublicURL,
Bucket, Region, UseTLS) plus the scheme-prefix and already-schemed
endpoint branches inside customerEndpointURL().

s3 -> 97.2% via accessor + IssueTenantCredentials default-fallback +
safeSessionName branch coverage: digits/dashes/underscores retained,
RoleSessionName truncation at 56, customerEndpointURL passthrough for
already-schemed endpoints, RevokeTenantCredentials no-op confirmation,
and AssumeRole error propagation through IssueTenantCredentials.

Total: 94.5% -> 98.0%. Every package now >=95%.

Coverage block (rule 17):

  Symptom:        common total 94.5% < 95% target; per-pkg dospaces/s3 below floor
  Enumeration:    go tool cover -func | sort | grep "<100"
  Sites found:    2 (storageprovider/dospaces, storageprovider/s3)
  Sites touched:  both
  Coverage test:  TestRegistry_AllProvidersSatisfyContract + per-backend
                  registry-walk tests already in place; new coverage files
                  add accessor + edge-branch assertions.
  Live verified:  go test ./... -short -coverprofile cov.out; total = 98.0%

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant