Repository navigation
Improve ATIF conversion test coverage - #77823
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ Matt Pocock Skills ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Ponytail Reviewer completed successfully!
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.
|
There was a problem hiding this comment.
What this change does: It expands ATIF validation and encoding tests and separates optional fixture output from fixture checks. It also makes several assertions safer.
Should fix
- The encoding test repeats cases already covered by validation and public API tests. Restore the original unmatched-observation test to keep the useful encoding check with less code.
Verdict: Ship.
Lean: -32 lines possible.
Generated by ✂️ Ponytail Reviewer for #77823 · codex · routed: gpt61 medium · ~5 AIC · ⌖ ~1 AIC · ⊞ 185
Comment /ponytail to run again
| var output bytes.Buffer | ||
| require.ErrorContains(t, Encode(&output, trajectory), "unmatched") | ||
| require.Empty(t, output.String()) | ||
| for _, tc := range []struct { |
There was a problem hiding this comment.
- Should fix — Remove duplicate encoding cases:
Encodereturns validation errors directly, while the new validation table covers both cases andTestSpec_PublicAPI_EncodeValidatesBeforeWritingalready checks nil input and empty output. Restore the original unmatched-observation test; this keeps the encoding check while removing 32 lines that would otherwise need maintaining.
🏗️ Design Decision Gate — ADR Needed, No Architectural Decision FoundADR enforcement was triggered by volume: this PR adds 325 lines under Next action: a maintainer should confirm whether this test-only change is exempt. If it is not exempt, add an ADR under 🔍 Evidence
❓ Why no draft ADRA draft ADR needs a real decision with real alternatives. The closest candidates here (test helper placement and assertion style) are local conventions within the existing testify pattern, so an ADR would document style rather than architecture. The 100-line threshold also counts test code. A maintainer may want to decide whether test-only changes should count toward it.
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are present, and the changes add targeted coverage and safer assertions across the affected conversion and validation paths.
No open issues 🎉
What changed in this PR
Improves ATIF conversion test coverage and assertion safety while isolating optional fixture-writing behavior.
Changes:
- Adds table-driven
Trajectory.Validatecases, failing-writerEncodecoverage, and non-objectusagereconciliation tests. - Strengthens raw JSON type checks, setup assertions, and bounds guards.
- Refactors provenance and nested-caller tests, shares the repeating-reader helper, and pins the documented 64 MiB input-limit error.
| File | Description |
|---|---|
| pkg/atif/spec_test.go | Pins the documented 64 MiB input-limit error and removes the local repeating-reader helper. |
| pkg/atif/spec_test_helpers_test.go | Provides the shared repeating-reader test helper. |
| pkg/atif/convert_test.go | Expands validation, metric, encoding, assertion-safety, provenance, and fixture-output test coverage. |
Review effort: Lite (dynamic)
There was a problem hiding this comment.
Found one test-coverage issue: several validation cases only assert the same generic error substring, so they can pass without exercising the named rejection rule. I left an inline comment at the table entry. The remaining changes appear scoped and safe based on static review; tests were not run per review instructions.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.5K
Comment /review to run again
| mutate: func(trajectory *Trajectory) { | ||
| trajectory.Agent.Name = "" | ||
| }, | ||
| want: "supported schema", |
There was a problem hiding this comment.
These cases all assert only the generic supported schema substring, so they do not prove the specific validation rule named by each test. A regression that rejects every malformed trajectory with that same message would still pass the missing-name, missing-version, no-steps, and unsupported-schema cases. Please assert the rule-specific error (or otherwise distinguish the cases) so this table actually covers each rejection path.
Comment MemoryPeek at saved memory (spec-review-history)History |
Comment MemoryPeek at saved memory (review-history)History |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /tdd (coverage and assertion strength). Requesting changes on the provenance metrics tests.
📋 Key Themes & Highlights
Key Themes
- Vacuous provenance metrics assertions: the
phaseandpathcases put"component":"detection"onsession.result, whichisPrimaryEventdrops. TheirCompletionTokens == nilassertions pass regardless of scoping. - Limit-path coverage: the removed
repeatingReaderoversize test inspec_test.gowas replaced by a public-API assertion, which covers the behavior. A convert-level regression test would make the 64 MiB limit branch inconvert.go(lines 96–101) easier to maintain.
Positive Highlights
- ✅
ValidateandEncodetests now cover all rejection branches, andEncodewrites nothing on rejection. - ✅ Good use of table-driven tests with descriptive names.
- ✅
go test,go vet(including theintegrationtag), andgofmtare clean.
Unverified
golangci-lintis not installed in this environment, so the lint status is unknown.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~8 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
| start: `"path":"parent.jsonl","phase":"first"`, | ||
| mismatch: `"path":"parent.jsonl","phase":"second"`, | ||
| match: `"path":"parent.jsonl","phase":"first"`, | ||
| metrics: `"path":"parent.jsonl","phase":"detection","component":"detection"`, |
There was a problem hiding this comment.
[/tdd] This phase case passes for the wrong reason. The session.result line carries "component":"detection", and isPrimaryEvent (pkg/atif/convert.go:182) accepts only an empty or agent component, so the event is dropped before its metrics are read. The path case at line 190 has the same defect.
A local probe showed that without the component, a mismatched phase still reports 999 output tokens, so this test does not establish that phase scopes terminal metrics. Decide the intended scoping rule, then use a primary metrics line and assert the value it should produce.
@copilot please address this.
| require.Len(t, trajectory.Steps[0].Observation.Results, 1) | ||
| assert.Equal(t, "correct scope", trajectory.Steps[0].Observation.Results[0].Content) | ||
| assert.Equal(t, "system", trajectory.Steps[1].Source) | ||
| assert.Nil(t, trajectory.FinalMetrics.CompletionTokens) |
There was a problem hiding this comment.
[/tdd] This Nil assertion is vacuous. With the metrics line above, CompletionTokens is always nil, so the test would still pass if phase scoping broke. Once the metrics line is fixed, assert the concrete expected value (for example require.NotNil followed by assert.Equal(t, int64(999), *trajectory.FinalMetrics.CompletionTokens)).
@copilot please address this.
|
🎉 This pull request is included in a new release. Release: |
ATIF tests missed several
Trajectory.Validaterejection paths and edge cases inEncodeand metric reconciliation. Some assertions could panic on type mismatches, and fixture verification included an opt-in file-writing side effect.Encodefailing-writer test, and non-objectusagereconciliation coverage. Pin the 64 MiB input-limit message.assertfor post-setup conversation and tool validations.