Repository navigation
fix(schemas): property IDs and other payloads that two oneOf branches both matched now validate - #9170
Conversation
… both matched now validate
In 11 oneOf unions one payload could satisfy two branches, and the union
rejected it as matching more than one. Where the spec says which shape
wins, the losing branch now refuses the winning branch with
not: { $ref: <winning branch> }. Such a payload resolves to the winner,
and nothing that validated before stops validating: the union now
accepts exactly what either branch accepts.
- property/property-feature-result.json property rejected every property
ID, since core/property-id.json is also a string. The domain-string
branch now refuses property IDs.
- The six content-standards responses rejected a success body that also
lists errors (#3939). Their error branch now refuses a valid success
body.
- adagents.json rejected a file with both a valid authoritative_location
and inline authorized_agents. The inline variant now refuses a valid
URL reference, so validators follow authoritative_location, per
adagents.mdx validation step 2.
- calibration_exemplars pass and fail entries in the create and update
content-standards requests rejected an artifact that also carries type
and value. The URL-reference branch now refuses a valid artifact.
The mutually exclusive either/or unions in #9051 (build-creative-response
branches 0-3, evaluator-spec, v1_pattern, and price-breakdown
adjustments) are left for #8191: a symmetric guard there would only
tighten.
New tests/oneof-overlap-resolution.test.cjs; patch changeset.
Refs #9051, #3939.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Escalate to human review
Escalate — gated schema paths require human/CODEOWNERS approval.
This PR modifies 10 files under static/schemas/source/**, which are under the repo's hard, deterministic approval gate (gated_paths: true). The current review_decision is REVIEW_REQUIRED, not APPROVED, so the gate is NOT satisfied and the PR cannot be auto-approved or plain-commented. Decision table row 2 applies.
The change itself looks clean: it resolves overlapping oneOf branches by adding not to the branch that should give way (#9051/#3939). The reviewer verified the not only prunes the loser branch so no previously-valid payload loses a match, docs cohere (adagents.mdx matches URL-ref-wins), the changeset is a correct patch for a loosening fix, and the oneOf audit is unaffected since the walker does not track not-disjointness. A 191-line test file covers every modified site. No Critical/High/Medium findings.
Escalation reason: Touches gated protocol-schema source files and review_decision is REVIEW_REQUIRED — a human/CODEOWNERS approval is required before merge.
Why human review
- Modifies gated protocol-schema source files under static/schemas/source/** (10 files incl. adagents.json, six content-standards responses, two requests, property-feature-result.json) while review_decision is REVIEW_REQUIRED — hard approval gate requires human/CODEOWNERS APPROVED.
- This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/adagents.json (modified) matches
static/schemas/source/**; static/schemas/source/content-standards/calibrate-content-response.json (modified) matchesstatic/schemas/source/**; static/schemas/source/content-standards/create-content-standards-request.json (modified) matchesstatic/schemas/source/**; static/schemas/source/content-standards/create-content-standards-response.json (modified) matchesstatic/schemas/source/**; static/schemas/source/content-standards/get-content-standards-response.json (modified) matchesstatic/schemas/source/**; static/schemas/source/content-standards/get-media-buy-artifacts-response.json (modified) matchesstatic/schemas/source/**; static/schemas/source/content-standards/list-content-standards-response.json (modified) matchesstatic/schemas/source/**; static/schemas/source/content-standards/update-content-standards-request.json (modified) matchesstatic/schemas/source/**; static/schemas/source/content-standards/validate-content-delivery-response.json (modified) matchesstatic/schemas/source/**; static/schemas/source/property/property-feature-result.json (modified) matchesstatic/schemas/source/**) and the current GitHub review decision is 'REVIEW_REQUIRED', not APPROVED. This is a hard gate enforced in code — Ladon cannot auto-approve until a human/CODEOWNERS approval is recorded, regardless of how clean the diff is.
adcontextprotocol#9170 resolves a file that carries both a valid authoritative_location and inline authorized_agents as the URL reference, following validation step 2 in docs/governance/property/adagents.mdx. The guards here rejected that file, so they come out, with their manifest lines. The core/evaluator-spec.json and v1-canonical-mapping.json v1_pattern guards stay. Refs adcontextprotocol#9051
… 3.3.0-rc.3 cut (adcontextprotocol#9141) No conflicts. The only files both sides changed are package.json and package-lock.json. Resolution ledger: - mechanical: package-lock.json -> textual merge checked: version 3.3.0-rc.3 (main), @adcp/sdk 17.0.0-beta.33 (this branch) in the root entry and in node_modules/@adcp/sdk. - semantic: package.json -> union: main's version bump and its tests/oneof-overlap-resolution.test.cjs in test:schemas; this branch's scripts and SDK version stay. - auto-merged, main only: adcontextprotocol#9170's source schema changes and test, the rc.3 release files (dist/, CHANGELOG.md, .changeset/pre/, static/compliance/published-versions.json). None touch the hooks, the schema and compliance builds, or the server. Checks: - npm run typecheck: pass. - tests/oneof-overlap-resolution.test.cjs: 38 pass. - npm run test:build-schemas-exit-status: 2 pass. - npm run test:build-cache: 43 pass.
Brings in 3 commits from main: adcontextprotocol#9170 (not-guards that resolve 11 overlapping oneOf unions, with tests/oneof-overlap-resolution.test.cjs), adcontextprotocol#9141 (3.3.0-rc.3 version packages) and adcontextprotocol#9176 (rc.3 docs snapshot). Resolution ledger Mechanical files, resolved by rule: - package.json (conflicted): test:schemas keeps both sides' entries, tests/named-schema-extraction.test.cjs from this branch and tests/oneof-overlap-resolution.test.cjs from main, at main's position. Every test file it names exists. The version (3.3.0-rc.3) is main's. - package-lock.json: main's (version field only). Interaction with adcontextprotocol#9170: this branch does not change any file adcontextprotocol#9170 touched. Two of adcontextprotocol#9170's guards point at files this branch changes: content-standards/artifact.json (transcript and transcript_format move to named $defs) and core/property-id.json (an x-max-length-4.0 annotation). Both changes keep the accepted payloads, so each guard still refuses the same values. tests/oneof-overlap-resolution.test.cjs passes on the merged tree (38 of 38), and the named-constraints lint reports no inline copies and no repeated constraints. Proof: schema equivalence against 14651cc with --manifest auto --corpus --witness: 1515 roots, 374 differ, 3056 entries at 41 sites, the same as against 2db59ba; the manifest matches exactly, 41/41 witnesses pass, no corpus verdict changes. The informational channel keeps its 4255 entries at 89 sites; one adagents.json x-max-length-4.0 entry at core/https-url.json is now reported through adcontextprotocol#9170's new not branch instead of /oneOf/0. verify-build: PASS.
Brings in 6 commits from main: adcontextprotocol#9123 (deprecates the single-value form of the scalar-or-list unions), adcontextprotocol#9169 (training agent inventory floors), adcontextprotocol#9171 (PROPOSAL_TERMS_CHANGED), adcontextprotocol#9170 (not-guards that resolve 11 overlapping oneOf unions, with tests/oneof-overlap-resolution.test.cjs), adcontextprotocol#9141 (3.3.0-rc.3 version packages) and adcontextprotocol#9176 (rc.3 docs snapshot). Resolution ledger: - package.json (conflicted): test:schemas keeps both sides' entries, the two equivalence tests from this branch and tests/oneof-overlap-resolution.test.cjs from main, at main's position. Main's test:build-schemas-exit-status auto-merged. Every test file it names exists. The version (3.3.0-rc.3) is main's. - package-lock.json: main's (version field only). - Invariants: no code change needed. The oneof check at the merged tree reports 223 reachable oneOfs, P 219, W 4, U 0, the same as main at 14651cc; adcontextprotocol#9170 resolves 12 of the 16 witnessed overlaps (main at 2db59ba, after adcontextprotocol#9123, still has 16). The 4 left are the either/or unions adcontextprotocol#9170 leaves for adcontextprotocol#8191. The construct catalog still reports its 37 known false alarms and no misses, and tests/oneof-overlap-resolution.test.cjs passes (38 of 38). - Proof: schema equivalence of the merged tree against 14651cc: 1113 roots, 0 differ, class 1, no informational entries.
Brings in 6 commits from main: adcontextprotocol#9123 (deprecates the single-value form of the scalar-or-list unions), adcontextprotocol#9169 (training agent inventory floors), adcontextprotocol#9171 (PROPOSAL_TERMS_CHANGED), adcontextprotocol#9170 (not-guards that resolve 11 overlapping oneOf unions, with tests/oneof-overlap-resolution.test.cjs), adcontextprotocol#9141 (3.3.0-rc.3 version packages) and adcontextprotocol#9176 (rc.3 docs snapshot). Resolution ledger: - package.json (conflicted): test:schemas keeps both sides' entries, the five lint tests from this branch and tests/oneof-overlap-resolution.test.cjs from main, at main's position. Main's test:build-schemas-exit-status auto-merged. Every test file it names exists. The version (3.3.0-rc.3) is main's. - package-lock.json: main's (version field only). - Baseline: adcontextprotocol#9170's error-branch guards are local refs to #/oneOf/0, which the schema-path lint reports as ref-local-not-defs. They are main's schemas, so the seven findings are recorded in scripts/lint-schema-paths-baseline.json with --update-baseline rather than changed here: - adagents.json#/oneOf/1/not/$ref - content-standards/{calibrate-content,create-content-standards, get-content-standards,get-media-buy-artifacts, list-content-standards,validate-content-delivery}-response.json #/oneOf/1/not/$ref Schema paths go from 593 to 600. The other four lints are unchanged: enum values 58, property names 820, value lists 24, x-adcp-validation 337. - Proof: schema equivalence against 14651cc: 1113 roots, 0 differ, class 1; 158 informational x-adcp-validation entries at 18 sites, as before.
…tries Brings in 3 commits from main: adcontextprotocol#9170 (not-guards that resolve 11 overlapping oneOf unions, with tests/oneof-overlap-resolution.test.cjs), adcontextprotocol#9141 (3.3.0-rc.3 version packages) and adcontextprotocol#9176 (rc.3 docs snapshot). Resolution ledger: - package.json (conflicted): test:schemas keeps both sides' entries, tests/registry-documents-self-schema.test.cjs from this branch and tests/oneof-overlap-resolution.test.cjs from main, at main's position. Every test file it names exists. The version (3.3.0-rc.3) is main's. - package-lock.json: main's (version field only). - Interaction with adcontextprotocol#9170: this branch changes none of the files adcontextprotocol#9170 touched, nor the files its guards refer to. tests/oneof-overlap-resolution.test.cjs passes on the merged tree (38 of 38). Proof: schema equivalence against 14651cc with --manifest auto --corpus --witness: 1113 roots, 8 differ, 68 entries at 27 sites, the same as against 2db59ba; the three manifests match exactly, 27/27 witnesses pass, no corpus verdict changes, no informational entries. verify-build: PASS.
…ommits CI compares a PR's merge commit with its first parent, so it sees the whole PR. A series that gives each commit its own manifest failed there although every commit matched its manifest: a later commit can change a site an earlier line describes, and a merge can change a value inside one. On adcontextprotocol#9180, the adcontextprotocol#9170 guard that a merge ported into core/calibration-exemplars.json left four content-standards lines unmatched, and brand line 31 showed the wrong side. With --manifest auto, when the lines do not match the range as a whole and the range has more than one commit, the check now composes them in commit order. It compares each commit of base..head with its first parent: a commit that adds or changes a manifest file must show exactly that file's lines, any other commit must show no difference, and a merge's net effect is part of the chain. When the head is a merge into the base, as on CI, the merge itself is left out. If every commit passes, the range's differences are the composition of declared changes. The composition is checked on commits, not on rendered values. A render names a shared node by the first location it met it at, so the same schema renders differently once an earlier commit extracts a definition, and a merge's change can sit inside a value another line declares. A line's side is the side its own commit reaches. A later commit that makes the site reachable from the other side is checked against its own lines, so the report notes the widening instead of failing it. Each line's witness comes from its own commit, with validators that compile only the roots a line reaches. The workflow fetches the PR's history, and its timeout goes from 10 to 20 minutes: adcontextprotocol#9180 as one range takes about 5 minutes on a 16-vCPU box. Four CLI tests on scratch repositories, each failing before this change: two commits at one site, an undeclared change in the second commit, a merge whose resolution adds a rule, and a site a later commit makes reachable from requests.
Refs #9051, #3939. For 3.3 rc.3.
static/schemas/source/**is Ladon-gated, so a human merges this.Summary
In 11
oneOfunions, one payload could satisfy two branches at once, and the union then rejected it: "must match exactly one schema", passingSchemas[0,1]. This PR fixes the ones where the spec says which shape wins. The losing branch now refuses the winning branch's shape withnot: { "$ref": <winning branch> }. A payload valid under both resolves to the winner, and nothing that validated before stops validating. For each union, the new branch is the old branch minus the winner, so the union now accepts exactly what either branch accepts. Before, it accepted what exactly one accepted.1.
property/property-feature-result.jsonpropertyrejected every property ID. Branch 0 is any string, and branch 1 iscore/property-id.json, which is also a string (^[a-z0-9_]+$). So"homepage"and"cnn_ctv_app"matched both and failed. Only dotted domains like"example.com"validated. The domain branch now refuses property IDs.2. Six content-standards responses rejected a success body that also lists
errors(#3939). These are:calibrate-content-responsecreate-content-standards-responseget-content-standards-responseget-media-buy-artifacts-responselist-content-standards-responsevalidate-content-delivery-responseEach error branch now refuses a valid success body, so such a response is the success shape.
3.
adagents.jsonrejected a file carrying a validauthoritative_locationand inlineauthorized_agents. The inline variant now refuses a valid URL reference, so the file is the reference. This followsdocs/governance/property/adagents.mdxvalidation step 2, which tells validators to check forauthoritative_locationand follow it. The nested-reference rule, which says the body "does not contain anauthoritative_locationfield", is about the target file. Validators still reject a target that is itself a reference.4.
calibration_exemplarspass and fail entries increate-content-standards-requestandupdate-content-standards-request(4 sites; not in #9051) rejected an artifact that also carriestype: "url"andvalue. The URL-reference branch now refuses a valid artifact.Each losing branch's description says which shape wins.
Why
not: { $ref }and notnot: { required: [key] }The key-based guard is the idiom #9051 suggests. It would also reject payloads that are valid today. One example is an error response that carries the success key with an invalid value, e.g.
{"errors": […], "verdict": "bogus"}. Another is aget-media-buy-artifactserror that echoesmedia_buy_idwithoutartifacts. Refusing the winning branch itself changes only the payloads that matched both branches. The bundle already usesnotwith$ref:build-creative-responsebranches 0–3 refusecore/task-submitted.jsonthat way.Not in this PR (held for 4.0 / #8191)
#9051 has four more unions where the prose says the two forms are mutually exclusive:
media-buy/build-creative-responsebranches 0–3core/evaluator-specregistries/v1-canonical-mappingv1_patternpricing-options/price-breakdownadjustments[], which isn't in schemas: 4 more oneOf unions whose branches nothing separates — build-creative-response and three either/or value forms #9051A payload carrying both forms is already rejected there. A symmetric guard would accept nothing new, and it would newly reject a payload that carries the other form's key with an invalid value. That's a tightening, so these wait for #8191's literal discriminators in 4.0.
How the unions were found
I scanned all 223
oneOfunions (2,009 branch pairs) onmainand onv3.3.0-rc.2; the results are identical. For each pair, the scanner built a valid instance of each branch, merged the two, and asked ajv whether the merge validates against both branches. That proves an overlap. For the 220 pairs it couldn't build, a keyword check looked for anytype,const,notoradditionalProperties: falsethat separates the branches, and the few unseparated ones were checked by hand.After this PR, the only overlaps left are the four held unions and one false positive. In
creative/preview-creative-responseresults[], the parent requiressuccessand the branches pin it totrue/false, so the branches are disjoint once the parent's constraints apply.Other false positives, recorded so they aren't re-filed:
allOf/1"responsive" and "none" branches exclude each other through ananyOfof required keys plusnot.brand.json, House Redirect is closed and itshousetype differs from House Portfolio's.Testing
New
tests/oneof-overlap-resolution.test.cjs, intest:schemas, has 38 tests against the built tree. For each union:verdict: "not-a-verdict", aget-media-buy-artifactserror echoingmedia_buy_id, and an inlineadagents.jsonwith anhttp://authoritative_location.Run against the schemas before this change, exactly the 12 overlap tests fail and all 26 others pass. That shows the change only adds acceptances.
On
mainfe24de8b62plus this commit:npm run test:schemas: 1313, 10 and 6, all pass.npm run test:mcp-schema-projection(projection and analysis pins): 41/41, with no pin moved.test:examplesandtest:contracts(490) pass.lint:additive-minor: 0 new non-additive changes.test:oneof-discriminators: no new undiscriminated unions. The platform-agnostic lint finds no violations.npm run verify:local: typecheck passes, and the affected root tests pass exceptaddie/cross-publisher-frequency-docs. That one fails only because this local worktree's sparse checkout doesn't includedist/docs/3.2.12("Missing Addie search snapshot for 3.2: 3.2.12"). It's unrelated to this change, and CI has the full tree.🤖 Generated with Claude Code