Skip to content

fix(schemas): property IDs and other payloads that two oneOf branches both matched now validate - #9170

Merged
bokelley merged 1 commit into
mainfrom
fix/9051-oneof-disjointness
Nov 22, 2026
Merged

bokelley merged 1 commit into
mainfrom
fix/9051-oneof-disjointness

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Refs #9051, #3939. For 3.3 rc.3. static/schemas/source/** is Ladon-gated, so a human merges this.

Summary

In 11 oneOf unions, 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 with not: { "$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.json property rejected every property ID. Branch 0 is any string, and branch 1 is core/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-response
  • create-content-standards-response
  • get-content-standards-response
  • get-media-buy-artifacts-response
  • list-content-standards-response
  • validate-content-delivery-response

Each error branch now refuses a valid success body, so such a response is the success shape.

3. adagents.json rejected a file carrying a valid authoritative_location and inline authorized_agents. The inline variant now refuses a valid URL reference, so the file is the reference. This follows docs/governance/property/adagents.mdx validation step 2, which tells validators to check for authoritative_location and follow it. The nested-reference rule, which says the body "does not contain an authoritative_location field", is about the target file. Validators still reject a target that is itself a reference.

4. calibration_exemplars pass and fail entries in create-content-standards-request and update-content-standards-request (4 sites; not in #9051) rejected an artifact that also carries type: "url" and value. The URL-reference branch now refuses a valid artifact.

Each losing branch's description says which shape wins.

Why not: { $ref } and not not: { 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 a get-media-buy-artifacts error that echoes media_buy_id without artifacts. Refusing the winning branch itself changes only the payloads that matched both branches. The bundle already uses not with $ref: build-creative-response branches 0–3 refuse core/task-submitted.json that 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:

A 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 oneOf unions (2,009 branch pairs) on main and on v3.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 any type, const, not or additionalProperties: false that 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-response results[], the parent requires success and the branches pin it to true / false, so the branches are disjoint once the parent's constraints apply.

Other false positives, recorded so they aren't re-filed:

  • The canonical formats' allOf/1 "responsive" and "none" branches exclude each other through an anyOf of required keys plus not.
  • In brand.json, House Redirect is closed and its house type differs from House Portfolio's.

Testing

New tests/oneof-overlap-resolution.test.cjs, in test:schemas, has 38 tests against the built tree. For each union:

  • Overlap resolves: the payload that matched both branches now validates. It's invalid against the losing branch alone and valid against the winner.
  • Nothing tightened: single-shape payloads stay valid.
  • Corner cases a key-based guard would have broken stay valid: an error response carrying verdict: "not-a-verdict", a get-media-buy-artifacts error echoing media_buy_id, and an inline adagents.json with an http:// 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 main fe24de8b62 plus 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:examples and test: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 except addie/cross-publisher-frequency-docs. That one fails only because this local worktree's sparse checkout doesn't include dist/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.
  • The pre-commit hook passed.

🤖 Generated with Claude Code

… 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]>

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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) matches static/schemas/source/**; static/schemas/source/content-standards/create-content-standards-request.json (modified) matches static/schemas/source/**; static/schemas/source/content-standards/create-content-standards-response.json (modified) matches static/schemas/source/**; static/schemas/source/content-standards/get-content-standards-response.json (modified) matches static/schemas/source/**; static/schemas/source/content-standards/get-media-buy-artifacts-response.json (modified) matches static/schemas/source/**; static/schemas/source/content-standards/list-content-standards-response.json (modified) matches static/schemas/source/**; static/schemas/source/content-standards/update-content-standards-request.json (modified) matches static/schemas/source/**; static/schemas/source/content-standards/validate-content-delivery-response.json (modified) matches static/schemas/source/**; static/schemas/source/property/property-feature-result.json (modified) matches static/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.

@aao-secretariat aao-secretariat Bot added the ladon/needs-human-review Ladon has escalated this PR for human review. label Nov 22, 2026
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 22, 2026
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
@bokelley
bokelley merged commit 6043df6 into main Nov 22, 2026
73 of 74 checks passed
@bokelley
bokelley deleted the fix/9051-oneof-disjointness branch November 22, 2026 18:17
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 22, 2026
… 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.
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 22, 2026
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.
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 22, 2026
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.
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 22, 2026
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.
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 22, 2026
…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.
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 23, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ladon/needs-human-review Ladon has escalated this PR for human review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant