test: coverage backfill for v0.38.0 features#399
Merged
Conversation
Adds focused tests to bring six packages above the 70% bar ahead of the v0.38.0 release: - internal/copilotevents 0.0% -> 100.0% - internal/telemetry 64.3% -> 93.6% - internal/mcpmock 67.3% -> 93.3% - internal/snapshot 62.1% -> 82.8% - internal/adversarial 67.2% -> 73.1% - internal/graders/argmatcher 66.2% -> 88.4% Overall coverage: 77.5% -> 79.2%. Tests only; no production code changed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR backfills and expands unit test coverage for several internal packages ahead of the v0.38.0 release, without changing production behavior. The added tests exercise previously untested branches and error paths across telemetry, snapshotting/redaction, MCP mocking, Copilot event helpers, adversarial pack utilities, and arg matcher marshaling.
Changes:
- Added new test suites to improve coverage of telemetry provider initialization/exporter variants and nil-safety behavior.
- Added coverage-focused tests for snapshot policy loading/redaction, compare/bisect divergence reporting, and writer helpers.
- Expanded tests around MCP mock server request handling and arg matcher JSON/YAML edge cases; added Copilot event accessor/bridge tests.
Show a summary per file
| File | Description |
|---|---|
| internal/telemetry/provider_test.go | Adds coverage for Provider.New exporter variants, SetGlobal behavior, and nil-safe methods. |
| internal/snapshot/coverage_test.go | Adds broad coverage for snapshot redaction policy load/merge modes, redaction walkers, and compare/bisect divergence reporting. |
| internal/mcpmock/server_more_test.go | Adds tests for MCP mock server request handling, parameter validation, fixture loading, and stdio serving behavior. |
| internal/graders/argmatcher/coverage_test.go | Adds JSON marshal/unmarshal and compilation coverage for all matcher kinds and error cases. |
| internal/copilotevents/events_test.go | Adds tests for event content/message accessors and raw event wrapping behavior. |
| internal/copilotevents/bridge_test.go | Adds tests for SDK↔agent event bridging, including unknown/raw event handling. |
| internal/adversarial/packs_more_test.go | Adds a small test for pack task relative path expansion behavior. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 2
- Review effort level: Low
Comment on lines
+21
to
+25
| func TestWriterRoot(t *testing.T) { | ||
| require.Equal(t, "", (*Writer)(nil).Root()) | ||
| w := NewWriter("/tmp/snap") | ||
| require.Equal(t, "/tmp/snap", w.Root()) | ||
| } |
Comment on lines
+144
to
+149
| _, span := tr.Start(context.Background(), "noop") | ||
| span.End() | ||
| // And SetGlobal must not panic. | ||
| p.SetGlobal() | ||
| _ = noop.NewTracerProvider() // sanity import use | ||
| } |
Windows holds the file handle open briefly after stdouttrace shuts down, which causes t.TempDir's RemoveAll to fail. Use a manual MkdirTemp with best-effort cleanup so the test passes consistently on windows-latest. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.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.
Audits and backfills test coverage ahead of v0.38.0. Tests only; no production code changed.
Coverage delta
Overall: 77.5% → 79.2%
Out of scope (intentionally skipped)
internal/specverify(66.1%) — not in the explicit backfill scope list for this audit.internal/models(69.8%) — schemaVersion changes (feat: Schema versioning policy and migration tooling for public artifacts #368) live here but the package is outside the explicit scope.Verification
go build ./...✓go vet ./...✓gofmt -l .empty ✓golangci-lint run0 issues ✓go test ./... -race -count=1all pass ✓