Repository navigation
test(adcp/v3): validate wire fixtures against their schemas - #617
Merged
torbenbrodt merged 4 commits intoNov 11, 2026
Merged
Conversation
…id list Prove the fail-closed behaviour of the fixture helper and give the tests a place to record fixtures that are invalid because of a Go type. translateSchema takes the RE2 translation list as a parameter, and TestTranslateSchemaFailsClosed shows that an unlisted pattern, an entry for another location or file, a changed pattern and a bad patternProperties key each fail the load, while pattern-like text in example data is ignored. Without the bundle the helpers now fail when CI is set instead of leaving every fixture unchecked, and skip or log otherwise. TestBundleMissing covers both through a recording test double. knownInvalidFixtures records a fixture by test name and schema, with the link to the issue that tracks the defect, the exact validation error of the raw fixture, and a Patch that repairs that one defect. The raw fixture must fail with exactly that error, and the patched fixture must validate in full, so an entry never stops the rest of the fixture from being checked. An entry fails once its fixture validates, the list is recorded against one bundle version, and TestKnownInvalidFixturesWellFormed fails when schemas/VERSION moves or an entry lacks a link, an error or a patch. The list is empty here. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The fixture helper checked 57 call sites in 14 test files; the other wire fixtures went unchecked, among them the CreativeInput localization fixtures and the capabilities, plan, response-builder and test controller encodings. They now go through assertSchemaValid or the new assertEncodingSchemaValid: 116 call sites in 20 files, several of them table driven. jsonschema-go does not assert the format keyword, so a date-time or URI value is checked for its type only. Many of those fixtures were invalid and are corrected without weakening an assertion: values outside the schema enum (day names, reach unit, catalog type, content rating system, disclosure position and persistence, landing page requirement, forecast method, selection type, feedback source, metric type), idempotency keys under the 16 character minimum, and missing required fields (status, cache_scope, check_id, revision, confirmed_at, publisher_domain, agent_url, source, and the asset_type, width and height of an image). An expected string that named a corrected value or its field order changes with it. Fixtures that are invalid because of a Go type stay as they are and are listed in knownInvalidFixtures, each with its issue link, exact error and a patch for that one defect: an empty products list that GetProductsResponse drops, and responses that SDK builders send with no or an empty envelope status (create_media_buy success, get_media_buys from a list, comply_test_controller). Fixtures that are invalid on purpose, such as canceled false, and a nil optional pointer shown to be omitted, are not validated and say why. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
torbenbrodt
marked this pull request as ready for review
November 11, 2026 10:07
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — test-only PR with no blocking or medium findings.
This PR touches 11 files (all *_test.go plus AGENTS.md); no production, schema, or generated-type changes. It hardens the adcp/v3 schema-fixture helper and extends validation from 57 to 116 call sites.
Checked and clean:
schema_fixture_test.goknown-invalid control flow fails closed; one entry can't mask a second defect;assertKnownInvalid/translateSchemafail-closed on unlisted RE2 patterns.- Global-map mutation in
TestAssertSchemaValidReportsis safe — not.Parallel()in the package, subtests awaited serially, no race. - Fixture value corrections are hand-built test inputs with
wantstrings updated in lockstep; no assertion weakened. - Ten remaining-invalid fixtures are pre-existing SDK wire bugs tracked to issues (#611, #612), not introduced here.
- No touch to
types_gen.go, tmproto signing, identity-agent TEE, protocol-managed skills, or any wire-shape/exported-API — changeset/minor-pathway rules don't apply.
Gate check: gated_paths is false, no high-risk flag, no no-auto-approve team match, no findings. Rows 1–8 do not fire; falls through to row 9 (approve). Note review_decision is REVIEW_REQUIRED, but row 2 only applies when gated_paths is true, which it is not.
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.
Check 1 of #564: wire fixtures in
adcp/v3's tests are validated against their schemas in the pinned bundle, and the helper fails closed. Test code andAGENTS.mdonly; no exported Go changes.What changes
Commit 1: the helper (
schema_fixture_test.go).re2Translations, 23 locations in 11 files, listed by schema pointer), so nothing is skipped.TestTranslateSchemaFailsClosednow proves the load fails for an unlisted pattern, an entry for another location or file, a changed pattern text and a badpatternPropertieskey.CIset,assertSchemaValidandrequireSchemaBundlefail instead of logging; locally they still log or skip. Onlyci.yml's test job runs these tests, after its bundle download step.knownInvalidFixtures(empty in this commit; commit 2 adds its entries) records, per fixture, the owning issue, the exact error it must still produce, and aPatchthat repairs that one defect. A listed fixture must fail with exactly that error and validate fully once patched, so an entry never hides a second defect, and it fails once the fixture becomes valid. The list records its bundle version (3.2.2) and fails whenschemas/VERSIONmoves.Commit 2: the call sites. 116 call sites in 20 files (108
assertSchemaValid, 8 through the newassertEncodingSchemaValid; the helper's own tests not counted), up from 57 in 14. Many fixtures turned out to be schema-invalid and are corrected; each expected string changed with its value. The main ones:mon,tue→monday,tuesday; reach unituser→individuals; disclosureoverlay_top_left→overlay,persistent→continuous; metricroas→conversion_rate; feedback sourcebuyer→buyer_attributiongenerated_core_refs_test.gobuying_mode,proposal_id,total_budget,status,cache_scope,check_id,expires_at,revision, …)generated_core_refs_test.go,inputs_test.go,responses_test.gotvpg→tv_parental; landing pagerequired→any; special categorysports→championship; readinessready→good; forecasthistorical→modeled; selectionsignal_ids→by_id;publisher_domain,SignalID.Sourceand image asset fields addedgenerated_product_refs_test.goproducts→product; preview manifestformat_kind;Deploymentgainsagent_urlinputs_test.go,generated_capabilities_test.goCreativeInputthree-statelocalizationfixtures extended to a full itemcreative_input_test.goTen fixtures stay invalid because the SDK produces them, each owned by an issue:
GetProductsResponse.Productsisomitempty, so an empty products list is not sent.status(create_media_buysuccess,get_media_buys, fivecomply_test_controllerresults).Not in this PR
formatis not asserted byjsonschema-go, so a valid fixture can still carry a malformed date-time.canceled: falseagainstconst: true) and a nil optional pointer shown to be omitted say why in a comment; zero-value and error-path tests and stub payloads, for example inidempotent_test.go,optional_test.go,example_optional_test.go,addtool_test.goandvalidation_test.go(not touched here), are not validated and carry no comment.Checks run locally
go vetandgo test -race ./...inadcp/v3on Go 1.26 and 1.27 withCI=true;golangci-lint; regeneration reproducestypes_gen.go;lint.py --strict;--coverage-max-unreviewed-any 0; the Python generator tests. Each new guard was broken in a copy to show its test fails, including a corrected value put back inside a known-invalid fixture.Related: #564.
🤖 Generated with Claude Code