Skip to content

feat(schema): add MCP 2026 JSON Schema projections - #6070

Merged
bokelley merged 4 commits into
mainfrom
review-mcp-spec-support
Jul 30, 2026
Merged

bokelley merged 4 commits into
mainfrom
review-mcp-spec-support

Conversation

@bokelley

@bokelley bokelley commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • generate compact, self-contained JSON Schema 2020-12 input/output artifacts for every canonical AdCP tool under the MCP 2026-07-28 projection path
  • preserve v3 draft-07 validation semantics while enforcing local-reference integrity and AdCP-defined defensive depth, object-count, and compact-byte bounds
  • enter Changesets beta pre-mode for 3.2.0-beta.0 and document the 3.2 projection / 4.0 canonical migration boundary
  • keep MCP projection artifacts out of the legacy draft-07 SDK validation overlay

Why

MCP 2026-07-28 defaults embedded tool schemas to JSON Schema 2020-12, requires implementations to support that dialect, and recommends its use; explicit alternative dialects remain allowed. AdCP v3 remains canonically draft-07. This projection provides MCP-compatible discovery artifacts without changing the v3 payload contract or prematurely introducing 4.0 contract tightening.

The artifacts are downloadable and opt-in for server tools/list registration; publishing them does not alter runtime tool registration automatically.

Validation

  • schema build: 65 tools, 130 projected schemas, 10.32 MiB compact total, 866 KiB largest
  • MCP projection tests: 9/9, including 672 real storyboard fixtures across 58 schemas (659 accepted, 13 rejected) plus 102 generated invalid mutations
  • schema validation: 20/20 across 658 schemas
  • composed-schema validation: 139/139
  • schema build regressions: 27/27
  • pre-commit repo tests: 1,025/1,025
  • pre-commit server tests: 4,630 passed, 30 skipped
  • current and released 3.0 storyboard matrices: all tenant floors passed
  • Changesets resolves the prerelease to 3.2.0-beta.0

Expert review

Reviewed by MCP protocol, deep implementation, and Node.js test/release experts. Their findings on artifact size, runtime claims, draft-07 $ref sibling semantics, full-document bounds, source-dialect drift, JSON Pointer rewriting, and SDK cache isolation were addressed; no merge blockers remain.

Local environment note

The existing typecheck currently reports server/src/utils/otel-logs.ts(92,5) against the installed dependency graph; this branch does not modify that file or package-lock.json. PR CI remains authoritative.

@bokelley
bokelley force-pushed the review-mcp-spec-support branch from d0a5a31 to d33c637 Compare July 28, 2026 13:49
@bokelley
bokelley force-pushed the review-mcp-spec-support branch from d33c637 to 898cc89 Compare July 30, 2026 01:16
@bokelley
bokelley marked this pull request as ready for review July 30, 2026 02:46
Comment thread tests/mcp-schema-projection.test.cjs Resolved

@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 paths touched without required approval.

This PR adds a semantics-preserving JSON Schema 2020-12 MCP tool-schema projection (new scripts/mcp-schema-projection.cjs, wired into build:schemas), plus docs, a minor changeset, and a full-suite test. The transformer work is careful and unit-tested, and the reviewer surfaced no critical/high findings.

However, gated_paths is true and review_decision is REVIEW_REQUIRED (not APPROVED), so the hard approval gate (decision rule row 2) forces escalation regardless of how clean the diff is.

Escalation reasons

  • .changeset/pre.json (added) and static/schemas/source/core/forecast-dimension-geo.json (modified) are under the hard approval gate (## Gated Paths). Human/CODEOWNERS review is required — review_decision is REVIEW_REQUIRED, not APPROVED.

Medium findings (non-blocking)

  • tests/mcp-schema-projection.test.cjs:290 — Parity test barely validates the anti-tightening guarantee (nearly a no-op for schemas without top-level examples). Worth strengthening but not blocking.

The forecast-dimension-geo.json required-sibling removal was reviewed as semantics-preserving (necessitated by the fail-closed $ref-validation-sibling guard). Once a human/CODEOWNERS approval lands, this can proceed through the normal decision table.

Medium findings

  • tests/mcp-schema-projection.test.cjs:290 — Parity test barely validates the anti-tightening guarantee

Why human review

  • Touches gated paths .changeset/pre.json (added) and static/schemas/source/core/forecast-dimension-geo.json (modified) while review_decision is REVIEW_REQUIRED — human/CODEOWNERS approval required before merge.
  • This PR touches a path under a hard, non-overridable approval gate (.changeset/pre.json (added) matches .changeset/pre.json; static/schemas/source/core/forecast-dimension-geo.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 Jul 30, 2026

@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 path requires human/CODEOWNERS approval.

This PR modifies static/schemas/source/core/forecast-dimension-geo.json, which sits under the hard, path-based approval gate (static/schemas/source/**). gated_paths is true and review_decision is not APPROVED (unknown/none), so decision-table row 2 fires: Ladon cannot auto-approve until a human/CODEOWNERS approval is recorded, regardless of how clean the diff is.

The reviewer found no blocking, High, or Medium code-correctness defects in the current delta: schema surface is fail-closed and const-discriminated, schema↔docs coherence holds, all new schemas are registered in index.json, all $ref targets resolve, and changesets are present and correctly scoped. The prior run's single medium finding (tests/mcp-schema-projection.test.cjs:290) targets a file absent from the current delta and is out of scope. On the merits the diff is clean — but the gate is deterministic and not overridable by a clean review.

Escalation reasons

  • Modifies static/schemas/source/core/forecast-dimension-geo.json (matches gated glob static/schemas/source/**) while review_decision is not APPROVED — human/CODEOWNERS approval required before merge.

Why human review

  • Modifies static/schemas/source/core/forecast-dimension-geo.json (matches gated path static/schemas/source/**) while review_decision is not APPROVED — human/CODEOWNERS approval required before merge.
  • This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/core/forecast-dimension-geo.json (modified) matches static/schemas/source/**) and the current GitHub review decision is 'unknown', 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 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 — hard approval gate on gated paths not yet satisfied.

This PR modifies files under a hard, non-overridable approval gate:

  • static/schemas/source/core/forecast-dimension-geo.json (matches gated path static/schemas/source/**)
  • .github/workflows/build-check.yml (matches gated path .github/workflows/**)

gated_paths is true and review_decision is unknown/none (not APPROVED), so decision-table row 2 fires: the outcome must be escalate until a human/CODEOWNERS approval is recorded, regardless of how clean the diff is.

Reviewer findings: none. The delta since the prior pass is a CI step correctly wired to the existing test:mcp-schema-projection npm script and test-only hardening (draft-07 vs 2020-12 validation parity from storyboard fixtures, mutation cases, count ratchets). No critical/high/medium findings. On the merits the diff is clean — but the gate is deterministic and lifts only on a real APPROVED review.

Escalation reasons (see below). Once a human/CODEOWNERS approval is recorded, this PR can fall through to a normal approve.

Why human review

  • Touches static/schemas/source/core/forecast-dimension-geo.json (matches gated path static/schemas/source/**) and .github/workflows/build-check.yml (matches gated path .github/workflows/**) while review_decision is not APPROVED — human/CODEOWNERS approval required before merge.
  • Prior decision was escalate for the same gated-path reason; the gate remains unsatisfied (review_decision still not APPROVED).
  • This PR touches a path under a hard, non-overridable approval gate (.github/workflows/build-check.yml (modified) matches .github/workflows/**; static/schemas/source/core/forecast-dimension-geo.json (modified) matches static/schemas/source/**) and the current GitHub review decision is 'unknown', 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.

@bokelley
bokelley merged commit fa8c262 into main Jul 30, 2026
32 checks passed
@bokelley
bokelley deleted the review-mcp-spec-support branch July 30, 2026 21:05
bokelley added a commit that referenced this pull request Oct 14, 2026
main already measured 20_945_219 bytes against the 20 MiB sanity cap set
in #6070. Experimental hold_policy is bundled into every product- and
proposal-bearing tool and brings the projection to 21_021_886 bytes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
bokelley added a commit that referenced this pull request Oct 14, 2026
…8140)

* feat(media-buy): delegated composition bootstrap — exclusive product universe and terms-only finalize

Builds on the closed #7109 prototype (2543f52 / 92f5a95) for items 1 and 2 of #7107.

- criteria.product_ids_exclusive: product_ids becomes the complete composable
  universe for a request and its refinement lineage; signals are fenced to the
  listed products' signal_targeting_options; refinements may only narrow.
  Capability-gated by media_buy.supports_exclusive_product_ids.
- media_buy.proposal_refinement.hold_semantics (inventory_hold | terms_only):
  terms_only finalize commits terms without an inventory hold; expires_at is the
  acceptance window; hold_unavailable is excluded; version-gated for callers
  pinned below 3.3.
- docs/protocol/get_adcp_capabilities.mdx documents both capabilities, and a
  delegated-composition bootstrap profile page assembles them. The
  acceptance-only accept_proposal variant (item 3) is deliberately not included.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* feat(media-buy): experimental hold_policy on products and proposals

Add core/hold-policy.json (feature id media_buy.hold_policy, #7661):
available, min_duration, max_duration, extendable, max_total_duration,
with strictly positive day/hour/minute/second ISO 8601 durations that are
forbidden when available is false. Declare it on product,
canonical-product, proposal, and canonical-proposal. A successful finalize
honors min_duration from when the hold is placed or returns
hold_unavailable; any non-holdable allocated product resolves the whole
proposal to terms-only finalize. hold_semantics becomes the default for
products that do not declare hold_policy.

Stacks on #7954 (terms_only hold semantics).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* test(compliance): hold_policy reference vectors and grader

Add static/compliance/source/test-vectors/hold-policy with 35 finalize
and 6 draft vectors for experimental hold_policy (#7661), each with
expected.violations, across six cases: hold bounds, hold_unavailable in
all-or-none batches, terms-only resolution for non-holdable drafts,
hold_semantics defaults, the 3.3 version gate, and draft-product
consistency.

The vectors use canonical proposals only. A day is 24 hours on the UTC
instant (including a DST vector). Hold placement time is not on the
wire, so the grader uses observation.hold_placed_at only when present
and otherwise grades both bounds against the request/response window,
reporting unsettled bounds as indeterminate. max_total_duration appears
only with extendable true. Product-draft consistency is checked for
presence and the available-false rule only.

tests/hold-policy-vectors.test.cjs holds the reference grader, replays
every vector, and is wired into test:schemas. Storyboards stay deferred:
the training agent serves at most 3.2 and the SDK's 3.2 canonical
proposal schema rejects hold_policy.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* feat(media-buy): hold_placed_at, binding drafts, per-entry terms_only for hold_policy

Apply the expert-review fixes to experimental hold_policy (#7661):

- Add hold_placed_at to canonical-proposal: required on a committed
  proposal whose hold_policy.available is true, forbidden on drafts and
  when available is false. It lies between request receipt and the
  response or submitted completion, and the bounds are
  hold_placed_at + min_duration <= expires_at <= hold_placed_at +
  max_duration. An exact retry never restarts the clock.
- Product hold_policy is a planning hint; only the draft binds. The
  draft derives available, durations and extendable from the allocated
  products and governs finalize even if a product's policy changes.
- A seller that lists media_buy.hold_policy emits hold_policy on every
  draft and committed proposal for 3.3+ callers, and omits hold_policy
  and hold_placed_at for callers below 3.3.
- Scope #7954's terms_only rules per finalize entry. In a mixed batch,
  a terms-only entry returns batch_aborted when a holdable sibling
  returns hold_unavailable.
- Remove hold_policy from legacy core/proposal.json; proposal-level
  policy is compact-lifecycle only.
- Schema: extendable defaults to false; max_total_duration requires
  extendable true. A day is 24 hours on the UTC instant and durations
  compare after normalizing.
- Document submitted-finalize timing, installment deadlines, exclusive
  holds, that available false needs no delegated_composition, and the
  extension chain (#8097).

Vectors: hold placement moves from the grader-side observation block
onto the committed proposal's hold_placed_at, which must lie inside the
observed request window. Window grading with indeterminate bounds
remains only for callers below 3.3, so the four placement-free vectors
become 3.2-caller vectors. New codes: hold_policy_missing (renamed from
draft_hold_policy_missing), hold_placed_at_outside_window,
hold_policy_sent_below_3_3, draft_exceeds_product_policy, and
hold_policy_durations_unordered. Schema vectors cover a missing
hold_placed_at and max_total_duration without extendable. 40 finalize
and 12 draft vectors.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* test(schema): raise whole MCP projection cap to 22 MiB for hold_policy

main already measured 20_945_219 bytes against the 20 MiB sanity cap set
in #6070. Experimental hold_policy is bundled into every product- and
proposal-bearing tool and brings the projection to 21_021_886 bytes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* test(schema): raise comply_test_controller parity limit for hold_policy

Experimental hold_policy reaches the comply_test_controller request
through the seeded Product and the committed proposal: 1_259_242 bytes
measured on main with response collections and follower counts, bounded
at 1_265_000.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
bokelley added a commit that referenced this pull request Oct 14, 2026
…#8097)

* feat(media-buy): delegated composition bootstrap — exclusive product universe and terms-only finalize

Builds on the closed #7109 prototype (2543f52 / 92f5a95) for items 1 and 2 of #7107.

- criteria.product_ids_exclusive: product_ids becomes the complete composable
  universe for a request and its refinement lineage; signals are fenced to the
  listed products' signal_targeting_options; refinements may only narrow.
  Capability-gated by media_buy.supports_exclusive_product_ids.
- media_buy.proposal_refinement.hold_semantics (inventory_hold | terms_only):
  terms_only finalize commits terms without an inventory hold; expires_at is the
  acceptance window; hold_unavailable is excluded; version-gated for callers
  pinned below 3.3.
- docs/protocol/get_adcp_capabilities.mdx documents both capabilities, and a
  delegated-composition bootstrap profile page assembles them. The
  acceptance-only accept_proposal variant (item 3) is deliberately not included.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* feat(media-buy): experimental hold_policy on products and proposals

Add core/hold-policy.json (feature id media_buy.hold_policy, #7661):
available, min_duration, max_duration, extendable, max_total_duration,
with strictly positive day/hour/minute/second ISO 8601 durations that are
forbidden when available is false. Declare it on product,
canonical-product, proposal, and canonical-proposal. A successful finalize
honors min_duration from when the hold is placed or returns
hold_unavailable; any non-holdable allocated product resolves the whole
proposal to terms-only finalize. hold_semantics becomes the default for
products that do not declare hold_policy.

Stacks on #7954 (terms_only hold semantics).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* test(compliance): hold_policy reference vectors and grader

Add static/compliance/source/test-vectors/hold-policy with 35 finalize
and 6 draft vectors for experimental hold_policy (#7661), each with
expected.violations, across six cases: hold bounds, hold_unavailable in
all-or-none batches, terms-only resolution for non-holdable drafts,
hold_semantics defaults, the 3.3 version gate, and draft-product
consistency.

The vectors use canonical proposals only. A day is 24 hours on the UTC
instant (including a DST vector). Hold placement time is not on the
wire, so the grader uses observation.hold_placed_at only when present
and otherwise grades both bounds against the request/response window,
reporting unsettled bounds as indeterminate. max_total_duration appears
only with extendable true. Product-draft consistency is checked for
presence and the available-false rule only.

tests/hold-policy-vectors.test.cjs holds the reference grader, replays
every vector, and is wired into test:schemas. Storyboards stay deferred:
the training agent serves at most 3.2 and the SDK's 3.2 canonical
proposal schema rejects hold_policy.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* feat(media-buy): hold_placed_at, binding drafts, per-entry terms_only for hold_policy

Apply the expert-review fixes to experimental hold_policy (#7661):

- Add hold_placed_at to canonical-proposal: required on a committed
  proposal whose hold_policy.available is true, forbidden on drafts and
  when available is false. It lies between request receipt and the
  response or submitted completion, and the bounds are
  hold_placed_at + min_duration <= expires_at <= hold_placed_at +
  max_duration. An exact retry never restarts the clock.
- Product hold_policy is a planning hint; only the draft binds. The
  draft derives available, durations and extendable from the allocated
  products and governs finalize even if a product's policy changes.
- A seller that lists media_buy.hold_policy emits hold_policy on every
  draft and committed proposal for 3.3+ callers, and omits hold_policy
  and hold_placed_at for callers below 3.3.
- Scope #7954's terms_only rules per finalize entry. In a mixed batch,
  a terms-only entry returns batch_aborted when a holdable sibling
  returns hold_unavailable.
- Remove hold_policy from legacy core/proposal.json; proposal-level
  policy is compact-lifecycle only.
- Schema: extendable defaults to false; max_total_duration requires
  extendable true. A day is 24 hours on the UTC instant and durations
  compare after normalizing.
- Document submitted-finalize timing, installment deadlines, exclusive
  holds, that available false needs no delegated_composition, and the
  extension chain (#8097).

Vectors: hold placement moves from the grader-side observation block
onto the committed proposal's hold_placed_at, which must lie inside the
observed request window. Window grading with indeterminate bounds
remains only for callers below 3.3, so the four placement-free vectors
become 3.2-caller vectors. New codes: hold_policy_missing (renamed from
draft_hold_policy_missing), hold_placed_at_outside_window,
hold_policy_sent_below_3_3, draft_exceeds_product_policy, and
hold_policy_durations_unordered. Schema vectors cover a missing
hold_placed_at and max_total_duration without extendable. 40 finalize
and 12 draft vectors.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* feat(media-buy): experimental extend_hold action for refine_proposals

Refs #8086. Adds action extend_hold (feature id media_buy.hold_extension):
committed, unexpired source -> new committed successor with later
expires_at, hold transfers, source no longer acceptable. Atomic
extend-only batches, reuses the finalized outcome, failures are
hold_unavailable / batch_aborted. Capability
media_buy.proposal_refinement.hold_extension.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* docs(media-buy): address review of extend_hold (supersession, race, error codes)

Refs #8086.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* docs(media-buy): name Availnet as the hold_extension adopter

Refs #8086.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* docs(media-buy): reconcile extend_hold with hold_policy and terms_only

Refs #8086, #7661, #7954. Restacks extend_hold on hold_policy (#8140,
through 81b38ba), itself on terms_only hold semantics (#7954).

- Limits come from hold_policy. extendable defaults to false: when it is
  false or absent the seller declines (hold_unavailable) and buyers
  SHOULD NOT send extend_hold. The successor's expires_at MUST NOT
  exceed the original hold_placed_at plus max_total_duration; a request
  the seller cannot extend at all returns hold_unavailable. Absent
  hold_policy (a seller that does not list media_buy.hold_policy),
  limits stay seller policy. hold_extension: true remains the
  agent-level gate.
- Successors carry hold_policy and hold_placed_at forward unchanged, so
  max_total_duration counts from the root finalize's placement across
  the whole chain of extension successors.
- extend_hold applies only to committed proposals that hold inventory,
  judged per entry. An entry whose effective policy is terms-only
  (hold_policy.available false, or no hold_policy at a terms_only
  agent) fails the request at task level with INVALID_STATE, never
  hold_unavailable, replacing the non-normative terms_only paragraph
  that contradicted #7954 and #8140.
- Nothing relies on hold_policy in legacy core/proposal.json, which
  #8140 removed.
- Vectors: eleven extend_hold vectors in the hold-policy set (case
  extension) with a gradeExtend reference grader: successors within,
  at, and past the total ceiling (including a chain), hold_placed_at
  and hold_policy carried forward, a later expires_at, extendable
  defaulting to false, and INVALID_STATE for a source without a hold.
  Four new violation codes.
- Tests: the training-agent refine_proposals parity test now expects
  the extend_hold action value; the compact discovery tools/list budget
  rises to 155 KiB (+836 bytes) and the media-buy MCP model-context
  budget to 447 KiB (+501 bytes) for the combined stack.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* test(schema): raise whole MCP projection cap to 22 MiB for hold_policy

main already measured 20_945_219 bytes against the 20 MiB sanity cap set
in #6070. Experimental hold_policy is bundled into every product- and
proposal-bearing tool and brings the projection to 21_021_886 bytes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* test(schema): raise comply_test_controller parity limit for hold_policy

Experimental hold_policy reaches the comply_test_controller request
through the seeded Product and the committed proposal: 1_259_242 bytes
measured on main with response collections and follower counts, bounded
at 1_265_000.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(media-buy): scope max_duration to finalize and grade no-hold extend errors

Review fixes for extend_hold:
- canonical-proposal hold_placed_at: the max_duration bound applies to the
  committed proposal created by finalize. An extend_hold successor carries
  hold_placed_at forward and is bounded by max_total_duration instead, so
  the conformant extend-within-total vector no longer contradicts the
  schema text.
- Reference grader: an extend_hold against a commitment that holds no
  inventory must fail at task level with INVALID_STATE. Any other task
  error code is now the no_hold_wrong_task_error violation, with a new
  extend-terms-only-wrong-task-error vector.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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