Repository navigation
fix(schemas): make either/or union branches refuse the other branch's key - #9124
KonstantinMirin wants to merge 10 commits into
Conversation
…quirements
offering-asset-constraint.json referenced asset-requirements.json, a
12-branch anyOf in which every branch accepts {}, so asset_requirements
accepted any object whatever its asset_type said. The union's own
description says the applicable schema is determined by the sibling
asset_type field.
Add one if/then rule per asset type that has a requirements schema,
following the pairing core/format.json already uses. The union stays
referenced, so the five asset types without a requirements schema keep
it and no URL changes.
Refs adcontextprotocol#8476
… key
Three oneOf unions pick a branch by which key is present, and each
document's prose says the forms exclude each other, but no branch said
so. A valid form plus a malformed copy of the other key matched one
branch and was accepted.
Add a not/required guard to each branch, the idiom the bundle already
uses (validate-input-result.json, get-creative-features-response.json):
- adagents.json: authoritative_location or authorized_agents. The spec
already says the authoritative file carries no authoritative_location.
- core/evaluator-spec.json: exemplars or agent_url.
- registries/v1-canonical-mapping.json v1_pattern: format_id_glob or
structural ("Carries either format_id_glob OR structural, not both").
The build-creative-response union is left for the envelope stack that
renames that file.
Refs adcontextprotocol#9051
The field carries an MCP resource URI such as ui://si/session-abc123. format: uri accepts any scheme, as core/app-item.json deep_link_url already relies on for custom app schemes, and refuses values with no scheme. The description now says the value is not limited to http(s). deep_link in si-ui-element.json stays a plain string: the SI chat protocol's own app handoff example uses "flights/boston", a path with no scheme, which format: uri would refuse. Refs adcontextprotocol#8924
core/asset-group-vocabulary.json, core/format-shape-vocabulary.json, creative/asset-types/index.json, and extensions/index.json declare $schema but state no keyword, so each is the empty schema and admits every JSON value. Follow registries/v1-canonical-mapping.json, a registry that states type and properties for its own data: each document now states type: object and the shape of its entries, and validates against itself. The build copies the schema keywords from the extensions placeholder into the generated registry. No URL changes. The roots require no property yet, because a new required name is not additive in a minor release. Closes adcontextprotocol#9104
The equivalence check merges a schema split across allOf members, so it reports the first asset_type rule in offering-asset-constraint.json as if and then keywords at allOf/0 rather than as an added allOf member. Rewrite those manifest lines to match. Refs adcontextprotocol#8476
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
There was a problem hiding this comment.
Ladon verdict: Escalate to human review
Escalate — gated paths touched without required approval.
This PR modifies 10 files under static/schemas/source/**, which fall 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 (decision table row 2). Human/CODEOWNERS review is required before this can merge.
No blocking findings exist. The reviewer found the change to be a clean schema-hardening PR: four patch-level tightenings (per-asset-type requirements pairing, not:{required} either/or guards with no undiscriminated oneOf, format:uri on mcp_resource_uri, and self-schemas for four registry documents). Four correct patch changesets present, no schema↔docs drift, and a formal equivalence proof (PASS, 50481 probes). No Critical/High/Medium findings.
Escalation reasons:
- Gated files under
static/schemas/source/**modified (adagents.json, core/asset-group-vocabulary.json, core/evaluator-spec.json, core/format-shape-vocabulary.json, core/requirements/asset-requirements.json, core/requirements/offering-asset-constraint.json, creative/asset-types/index.json, extensions/index.json, registries/v1-canonical-mapping.json, sponsored-intelligence/si-send-message-response.json) require human/CODEOWNERS approval;review_decisionisREVIEW_REQUIRED.
Once a human/CODEOWNERS approval lands (review_decision: APPROVED), this clean diff with no findings would fall through to an approve.
Why human review
- Modifies gated paths under static/schemas/source/** (10 files) while review_decision is REVIEW_REQUIRED — human/CODEOWNERS approval required before merge.
- 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/core/asset-group-vocabulary.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/evaluator-spec.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/format-shape-vocabulary.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/requirements/asset-requirements.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/requirements/offering-asset-constraint.json (modified) matchesstatic/schemas/source/**; static/schemas/source/creative/asset-types/index.json (modified) matchesstatic/schemas/source/**; static/schemas/source/extensions/index.json (modified) matchesstatic/schemas/source/**; static/schemas/source/registries/v1-canonical-mapping.json (modified) matchesstatic/schemas/source/**; static/schemas/source/sponsored-intelligence/si-send-message-response.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.
Resolution ledger: - Conflicts: none. Only package.json changed on both sides; it auto-merged as a key-wise union: this branch adds the registry self-schema test to test:schemas; main changes version, test, test:release-workflow, precommit, verify:local and @adcp/sdk. No key changed on both sides. - Mechanical: package-lock.json is main's (this branch does not change it); node_modules reinstalled with npm ci. - Invariants: main adds no registry document, no extension, and no either/or union; its reporting changes add if/then rules only. The four registry documents, including the generated extensions/index.json, validate against themselves. - Proof: schema equivalence against 576ebca finds the same 76 entries at 33 sites, 12 roots, as against the old base, and no corpus verdict changes. One manifest line no longer matches the current equivalence check, which now folds integer bounds; the next commit updates it. That mismatch exists before this merge too.
…heck reports it The equivalence check now folds an integer's exclusiveMinimum: 0 into minimum: 1, so the image rule's then line in asset-requirements-by-asset-type.yaml no longer matched the reported difference. Both forms accept the same integers. With this line the manifest matches all 76 entries at 33 sites, and 33 of 33 witnesses pass.
There was a problem hiding this comment.
Ladon verdict: Escalate to human review
Escalate — gated paths require human/CODEOWNERS approval.
This PR modifies 10 files under static/schemas/source/**, which are under a hard, non-overridable approval gate (gated_paths: true). The current review_decision is REVIEW_REQUIRED, not APPROVED, so the gate is not satisfied (decision row 2).
The reviewer found no blocking or Medium findings. The schema-hardening changes (union-branch not guards, registry self-schemas, per-asset-type asset_requirements enforcement, format: uri on mcp_resource_uri) each carry a correct patch changeset and were reviewed clean. The one new authored change — normalizing max_weight_grams from exclusiveMinimum: 0 to minimum: 1 (semantically identical for an integer) — is sound. The 6500+ delta files are a rebase pulling main's 3.1.34 snapshot; the artifacts are identical in base, so no immutability issue is attributable to this PR.
Despite the clean diff, Ladon cannot auto-approve until a human/CODEOWNERS approval is recorded on these gated schema-source files. Consistent with the prior escalate decision.
Escalation reasons
- Modifies gated paths under
static/schemas/source/**(10 files) whilereview_decisionisREVIEW_REQUIRED— human/CODEOWNERS approval required before merge.
Why human review
- Modifies gated paths under static/schemas/source/** (10 files: adagents.json, core/asset-group-vocabulary.json, core/evaluator-spec.json, core/format-shape-vocabulary.json, core/requirements/asset-requirements.json, core/requirements/offering-asset-constraint.json, creative/asset-types/index.json, extensions/index.json, registries/v1-canonical-mapping.json, sponsored-intelligence/si-send-message-response.json) while review_decision is REVIEW_REQUIRED — human/CODEOWNERS approval required before merge.
- 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/core/asset-group-vocabulary.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/evaluator-spec.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/format-shape-vocabulary.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/requirements/asset-requirements.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/requirements/offering-asset-constraint.json (modified) matchesstatic/schemas/source/**; static/schemas/source/creative/asset-types/index.json (modified) matchesstatic/schemas/source/**; static/schemas/source/extensions/index.json (modified) matchesstatic/schemas/source/**; static/schemas/source/registries/v1-canonical-mapping.json (modified) matchesstatic/schemas/source/**; static/schemas/source/sponsored-intelligence/si-send-message-response.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.
|
Thanks for this, Konstantin, and for the #9051 census behind it. There's an overlap with #9170, which fixes part of #9051 for 3.3 rc.3, so I'm flagging it. For the 3.3 RCs we're only taking union guards that accept payloads that were rejected before. So the symmetric either/or guards here ( On
Would you be open to splitting #9124 so its non-union parts can be judged on their own? Those are |
|
@bokelley Yes, I'll split it. The parts that aren't union guards move to a new PR: On |
The asset_requirements pairing (adcontextprotocol#8476), format: uri on mcp_resource_uri (adcontextprotocol#8924), and the registry document schemas (adcontextprotocol#9104) move to schemas/asset-requirements-uri-registries, so each can be ruled on apart from the either/or union guards. This branch keeps only the union guards, which wait for 4.0 and adcontextprotocol#8191. This reverts 65c0ce5, b179816, 4d062c4, a6a5d12, and 80ffa23.
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 Upon better analysis, I think the two guards left in this PR are corrections under DR-0036, so they can ship in 3.3. Each union's own text sets the bound:
No conforming sender puts both keys in one payload, so the guards reject nothing a conforming peer sends. Without the guards, these unions don't determine which form a payload uses. A payload with both keys passes whenever the second form is malformed, and that form is never validated. A reader then has to pick a form. For Does that change the decision for these two? |
There was a problem hiding this comment.
Ladon verdict: Escalate to human review
Escalate — gated schema paths require human/CODEOWNERS approval.
This PR adds minimal mutual-exclusion not: {required:[...]} guards to two two-branch either/or oneOfs in core/evaluator-spec.json and registries/v1-canonical-mapping.json. The reviewer found the change correct, fail-closed (only new rejection is valid-first-key + malformed-second-key that previously slipped through fail-open), with no schema↔docs drift, an honest patch changeset, and a .schema-deltas record carrying Ajv witness verification. No critical/high/medium findings.
The diff is clean, but it modifies files under static/schemas/source/**, which are under a hard, non-overridable approval gate (gated_paths: true), and the current review_decision is REVIEW_REQUIRED, not APPROVED. Per decision row 2, Ladon cannot auto-approve a gated-path change until a human/CODEOWNERS approval is recorded. This also matches the prior decision, which escalated for the same gate reason.
Escalation reasons
- Modifies gated paths
static/schemas/source/core/evaluator-spec.jsonandstatic/schemas/source/registries/v1-canonical-mapping.jsonwhilereview_decisionisREVIEW_REQUIRED— human/CODEOWNERS approval required before merge.
No blocking code findings; the escalation is purely the gated-path/review-status gate. Once a human/CODEOWNERS approval is recorded, this clean diff can fall through to approval.
Why human review
- Modifies gated paths under static/schemas/source/** (core/evaluator-spec.json, registries/v1-canonical-mapping.json) while review_decision is REVIEW_REQUIRED — human/CODEOWNERS approval required before merge.
- This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/core/evaluator-spec.json (modified) matches
static/schemas/source/**; static/schemas/source/registries/v1-canonical-mapping.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.
This PR makes two either/or unions accept only what their own descriptions already say. Each change is a tightening that no schema example, docs payload, storyboard sample, or example file in the repo depends on, and the delta manifest under
.schema-deltas/lists every difference with a witness payload. Both bounds come from the published text, so these are corrections under DR-0036, proposed for 3.3; see the DR-0036 comment.Revised 2026-11-22: following @bokelley's review, the
asset_requirements,mcp_resource_uri, and registry document changes moved to #9174 for separate rulings, and theadagents.jsonguards are gone, because #9170 resolves a file with both keys as the URL reference. Mergedmain, so the proof runs against2db59bae43. Proposed for 3.3 as DR-0036 corrections, not held for 4.0.Revised 2026-11-21: a section on merge order with #8536; merged
main, so the proof runs against the new merge base, and one manifest line statesmax_weight_gramsasminimum: 1, the form the check reports for the integer bound; the CI section explains the Python SDK job, which fails onmainsince #9049.Refs #9051
Refs #8191
What changes
Either/or unions refuse the other branch's key (#9051). Each branch now carries
not: {required: [<other key>]}, the idiomcreative/validate-input-result.jsonalready uses:core/evaluator-spec.json:exemplarsoragent_url.registries/v1-canonical-mapping.jsonv1_pattern: "Carries either format_id_glob OR structural, not both."A payload carrying both keys was already invalid when both forms were valid. It is now also invalid when the second form is malformed. No payload in the repo carries both keys of either union.
media-buy/build-creative-response.jsonis left to the envelope stack (#9044), which renames that file.For
adagents.json, see #9170.Proof
The schema equivalence check (proposed in #9119) compares every published root at the merge base and at the head:
No unbound probe value hits a changed site.
Manifest summary (4 lines, all
tighten):either-or-union-guards.yamlnotguardscore/evaluator-spec.json#/oneOf/0,1(also reached bybuild-creative-request.json),v1-canonical-mapping.jsonv1_pattern/oneOf/0,1Witnesses, one per line. Each is valid at the base and invalid at the head, and invalid at the head only because of its own line:
core/evaluator-spec.json#/oneOf/0/{"exemplars": {}, "agent_url": {}}core/evaluator-spec.json#/oneOf/1/{"agent_url": "https://example.com/x", "exemplars": null}v1_pattern/oneOf/0/mappings/0/v1_pattern{"format_id_glob": "a", "structural": null}v1_pattern/oneOf/1/mappings/0/v1_pattern{"structural": {}, "format_id_glob": {}}Reproduce from a checkout of the tool branch:
node scripts/schema-equivalence/cli.cjs \ --base "$(git merge-base origin/main schemas/constrain-unions-registries)" \ --head schemas/constrain-unions-registries \ --manifest auto --corpus --witnessCI
Generate Python SDKfails onmainsince #9049, and so on every branch that has mergedmain. #9049 adds a secondpostal_areaproperty, so the generator numbers the postal union's classesPostalArea40 | PostalArea41instead ofPostalArea1 | PostalArea2, with the same structure. The SDK'sfix_postal_union_arm_ordermatches the old names and raises "unexpected outer union shape". #9141, which doesn't contain this PR, fails the same way.