Skip to content

test(tools): trim aijson re-tests, keep docker-agent integration#2905

Open
trungutt wants to merge 2 commits into
docker:mainfrom
trungutt:feat/aijson-trim-tests
Open

test(tools): trim aijson re-tests, keep docker-agent integration#2905
trungutt wants to merge 2 commits into
docker:mainfrom
trungutt:feat/aijson-trim-tests

Conversation

@trungutt
Copy link
Copy Markdown
Contributor

@trungutt trungutt commented May 27, 2026

Follow-up to #2899 addressing @rumpl's review comment on pkg/tools/repair_test.go ("Why do we still need this?").

Why

After #2899 swapped the in-tree shape-repair layer for github.com/docker/aijson, most of pkg/tools/repair_test.go became a thin re-test of aijson's own test suite through the NewHandler facade. Every TestNewHandler_* case in that file had a direct TestUnmarshal_* counterpart in aijson.
Keeping both copies means every aijson behavior change has to be mirrored in two places, and the docker-agent suite slowly turns into a brittle snapshot of an external library.

Those three concerns live in pkg/tools/tools_test.go now alongside the other NewHandler tests; the standalone repair_test.go is removed.

Follow-up to docker#2899. The repair_test.go suite shipped in that PR
duplicates github.com/docker/aijson's own test cases through the
NewHandler facade. Per rumpl's review comment, the docker-agent-specific
surface area worth pinning is narrower:

- NewHandler delegates to aijson.Unmarshal (wiring canary)
- the OnRepair hook emits tool_input_repaired with tool + repairs fields
- the hot path stays quiet for well-formed calls

Drop pkg/tools/repair_test.go and add those three tests to the existing
tools_test.go. aijson covers the repair semantics themselves.
@trungutt trungutt marked this pull request as ready for review May 27, 2026 08:13
@trungutt trungutt requested a review from a team as a code owner May 27, 2026 08:13
Copy link
Copy Markdown

@docker-agent docker-agent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟢 APPROVE

The three stated contracts (aijson wiring, tool_input_repaired telemetry, hot-path quiet) are all covered by the new tests and the removal of the duplicate aijson re-tests is well-motivated. Two low-severity observations are left as inline comments.

Comment thread pkg/tools/tools_test.go Outdated
Comment thread pkg/tools/tools_test.go
@aheritier aheritier added area/tools For features/issues/fixes related to the usage of built-in and MCP tools kind/test Test-only changes labels May 27, 2026
Track the exported Kind constant rather than its underlying string value
so the assertion follows the library if aijson ever renames the symbol.
Addresses bot review on PR docker#2905.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/tools For features/issues/fixes related to the usage of built-in and MCP tools kind/test Test-only changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants