Skip to content

fix(media-buy): close canonical Product gaps for targeting resolution, collections, and reporting offerings - #7813

Merged
bokelley merged 2 commits into
mainfrom
fix/canonical-product-gaps
Sep 30, 2026
Merged

bokelley merged 2 commits into
mainfrom
fix/canonical-product-gaps

Conversation

@bokelley

@bokelley bokelley commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem

core/canonical-product.json is the closed (additionalProperties: false) Product returned by list_products and the proposal lifecycle. #7805 made the training agent drop legacy-only keys so its list_products output validates. A review of that PR found four canonical gaps that were not deliberate:

  1. targeting_resolution was lost between two merges. feat(media-buy): add compact AdCP 3.2 lifecycle #6115 created the canonical Product; feat(media-buy): add targeting-aware product discovery #6203 then added targeting_resolution to the legacy core/product.json only. The compact lifecycle still tells sellers to disclose overlay changes through Product.targeting_resolution.modifications: the product-discovery-criteria.json targeting_overlay description, request-proposals-response.json ("remain on Product.targeting_resolution"), list_products.mdx, and request_proposals.mdx. Because canonical couldn't carry the field, a seller that changed the overlay had no schema-valid way to say so.
  2. reporting_capabilities.reporting_delivery_offering_ids (feat(reporting): add managed reporting status schemas #6953) existed on legacy core/reporting-capabilities.json only. core/reporting-delivery-config.json resolves applicability through "every selected product's reporting_capabilities.reporting_delivery_offering_ids", and absence MUST NOT be inferred from the seller-wide list. A compact-only buyer could therefore never prove that an offering applies.
  3. collections / collection_targeting_allowed. Canonical already assumed both: canonical-reporting-capabilities has supports_collection_breakdown, and collection-selection.json says partial selection requires collection_targeting_allowed: true. Without them, a compact buyer couldn't see a product's collections or build a selected-mode collection_selection on buy_products.
  4. is_custom is deliberately absent from canonical: feat(media-buy): add targeting-aware product discovery #6203 moved request-specific offers to opaque expiring IDs, and canonical has expires_at. Several compact-lifecycle docs, and the training agent's list_products with a targeting_overlay, still used it.

Changes

Schemas

  • core/canonical-product.json:
    • adds targeting_resolution ($ref: /schemas/core/product-targeting-resolution.json), with a compact-lifecycle description;
    • requires expires_at whenever targeting_resolution is present. Legacy expresses this as an allOf if/then that also requires is_custom: true. The schemas are draft-07, which has no dependentRequired, so this uses draft-07 dependencies (already used by list-products-request.json and frequency-cap.json, which the SDK generators already consume);
    • adds collections (collection-selector.json + required collection_ids, minItems: 1, identical items to legacy) and collection_targeting_allowed (boolean, default false);
    • ports the legacy rule that overlay_support.collection_list requires collection_targeting_allowed: true;
    • gives expires_at a description saying it is what marks a canonical offer as request-specific.
  • core/canonical-reporting-capabilities.json: adds the optional reporting_delivery_offering_ids array, identical to legacy (same pattern and x-entity; an empty array means no managed offering; absence means unknown and MUST NOT be inferred from the seller-wide list).
  • core/reporting-delivery-offering-id.json (new): holds the offering-ID item shape, and both reporting-capabilities schemas $ref it. The constraints and x-entity are unchanged. The first push failed the Python SDK job's collision guard because ReportingDeliveryOfferingId was defined in both core.reporting_capabilities and core.canonical_reporting_capabilities. This follows feat(media-buy): add a cost target to criteria.outcome_target #7778's fix: give the shape its own schema file.
  • media-buy/product-fields.json (the list_products fields enum):
    • adds targeting_resolution, collections, and collection_targeting_allowed;
    • states two projection overrides: targeting_resolution/expires_at whenever the seller returns modifications, and collection_targeting_allowed whenever returned overlay_support declares collection_list. The second is needed so a narrow projection stays schema-valid.
  • media-buy/get-products-request.json: removes those three names from the legacy-only fields branch. get_products still accepts them through the shared product-fields.json#/items $ref, so the accepted set is unchanged.

Docs (is_custom clarification)

  • list_products.mdx, request_proposals.mdx, and product-discovery/index.mdx: on the compact lifecycle, expires_at marks request-specific configured products, and compact products have no is_custom.
  • reference/migration/targeting-aware-discovery.mdx:
    • scopes is_custom: true to get_products;
    • adds: "Canonical products returned by list_products and the proposal lifecycle carry no is_custom; expires_at identifies request-specific configured offers."
  • The legacy get_products / media-products docs keep is_custom.

Deferred to 3.3 (new "Compact product lifecycle" section in docs/reference/known-limitations.mdx):

  • per-product audience_activation on canonical, together with a matching audience_activation_methods offer filter. Neither exists on the compact lifecycle; the seller-wide get_adcp_capabilities.media_buy.audience_targeting.supported_activation_methods remains;
  • canonical installments. installment.json still carries the deprecated collection_id shorthand and should be reshaped to collection_ref-only first.

Training agent (server/src/training-agent/task-handlers.ts)

  • COMPACT_PRODUCT_FIELDS now includes collections and collection_targeting_allowed and drops is_custom.
  • targeting_resolution (always with expires_at) and reporting_capabilities.reporting_delivery_offering_ids now validate and flow through. The reporting projection already reads the canonical schema's property list.
  • A targeting_overlay no longer forces is_custom into the projection.
  • A returned overlay_support.collection_list pulls collection_targeting_allowed into a narrower fields projection.
  • get_products output is unchanged.

Tests

  • training-agent-list-products-canonical.test.ts, extended. It now checks that:
    • collections, collection_targeting_allowed, and reporting_delivery_offering_ids match get_products for every default-catalog product that has them;
    • a narrow fields projection still carries them;
    • is_custom never appears on list_products, with or without a targeting_overlay or fields;
    • a configured product that modifies the overlay returns targeting_resolution with expires_at;
    • all of the above validate against the canonical schema.
  • training-agent.test.ts: the targeted list_products test now asserts no is_custom and canonical validity. The collection projection test is restored to expect collections on list_products, and it still asserts that installments stays out.
  • targeting-aware-discovery.test.cjs: canonical targeting_resolution requires expires_at and rejects is_custom; parity with legacy for the $ref and reporting_delivery_offering_ids.
  • collection-selection-echo.test.cjs: canonical collections require explicit collection_ids; the collection_list → collection_targeting_allowed: true rule; parity with legacy.

Verification

  • All pass: test:schemas, test:examples, test:composed, test:json-schema, test:oneof-discriminators, test:mcp-schema-projection, lint:schema-links, docs:json-field-audit (0 new findings), test:targeting-aware-discovery, test:collection-selection-echo, and test:canonical-reference-resolver.
  • The canonical-product parity suites also pass: audio-radio-formats, execution-requirements, identity-absence-coherence, and seller-governance-policy-surfaces.
  • node --test tests/test-coverage-registration.test.cjs and npm run typecheck pass.
  • MCP model-context budget: media-buy is 452,978 → 453,046 bytes (442.36 → 442.43 KiB) against the 443 KiB bound, so there is no raise. Only list_products grew, by 68 bytes.
  • Training-agent vitest: 39 files, 1,370 tests pass.
  • npm run build:compliance, then the storyboards on sales, before (origin/main) and after:
Storyboard Before After
compact_product_lifecycle 10/10 10/10
availability_windows 8/8 8/8
product_coverage_filters 9/9 9/9
compact_direct_buy_lifecycle 8/8 8/8
outcome_target_list_products_inert 2/2 2/2
targeting_aware_discovery 34/34 34/34
collection_selection 12/12 12/12
owner_sold_channel_carriage 8/8 8/8

All runs were clean, with 0 failed, skipped, or not applicable. The collection storyboards (collection_selection, owner_sold_channel_carriage) and targeting_aware_discovery exercise get_products, whose output is unchanged. The canonical list_products changes are covered by the compact storyboards and the extended vitest suite.

Notes for the maintainer

  • The new collection_list → collection_targeting_allowed: true rule rejects a canonical product that declares overlay_support.collection_list without the flag. Before this PR, canonical couldn't carry the flag at all, so such a product was already incoherent under collection-selection.json.
  • Not in scope, flagged as a follow-up: the training agent's request_proposals still returns supporting products as { product_id, name } only, so it doesn't surface targeting_resolution there even though the schema now allows it.

🤖 Generated with Claude Code

…, collections, and reporting offerings

The compact Product (core/canonical-product.json, additionalProperties:
false) returned by list_products and the proposal lifecycle could not carry
fields the compact lifecycle already relies on:

- targeting_resolution: #6115 created the canonical Product, then #6203
  added targeting_resolution to the legacy Product only. The discovery
  criteria, request_proposals response, and list_products/request_proposals
  docs direct sellers to disclose overlay changes through
  Product.targeting_resolution.modifications, which was schema-invalid on
  canonical. Added with the legacy $ref; a draft-07 dependencies rule
  requires expires_at (the legacy if/then also requires is_custom, which
  canonical does not have).
- reporting_capabilities.reporting_delivery_offering_ids: reporting delivery
  applicability resolves through every selected product's offering IDs and
  absence MUST NOT be inferred from the seller-wide list, so a compact buyer
  could never prove an offering applies. Added with the legacy semantics.
- collections and collection_targeting_allowed: canonical already assumed
  them (supports_collection_breakdown, collection-selection partial
  selection). Added mirroring legacy, including the rule that
  overlay_support.collection_list requires collection_targeting_allowed: true.

product-fields.json gains the three new product fields and states that
targeting_resolution/expires_at (with modifications) and
collection_targeting_allowed (with overlay_support.collection_list)
override projection. The names move out of get_products' legacy-only enum,
which still accepts them through the shared $ref.

is_custom stays deliberately absent from canonical: docs for list_products,
request_proposals, product discovery, and the targeting-aware discovery
migration now say expires_at marks request-specific configured offers on
the compact lifecycle; get_products docs are unchanged.

Per-product audience_activation (with an audience_activation_methods
filter) and canonical installments are deferred to 3.3 in Known
Limitations.

Training agent: the list_products projection now emits collections,
collection_targeting_allowed, targeting_resolution, and
reporting_delivery_offering_ids, and no longer emits is_custom (including
with a targeting_overlay). get_products output is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[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 published protocol source under static/schemas/source/**, which sits behind a hard, path-based approval gate (gated_paths: true). The current review_decision is REVIEW_REQUIRED, not APPROVED, so the gate is not satisfied and the PR cannot auto-approve (decision rule row 2).

The reviewer's findings are clean: this is an additive, coherence-restoring change closing four canonical Product gaps (targeting_resolution, collections/collection_targeting_allowed, reporting_delivery_offering_ids) with correct minor+patch changesets, verified schema↔docs coherence, unchanged get_products acceptance, and legacy parity in tests. No Critical/High/Medium findings. Absent the gate this would fall through to approve — but the gate stands until a human/CODEOWNERS approval is recorded.

Escalation reasons

  • Touches gated schema source requiring human/CODEOWNERS review: static/schemas/source/core/canonical-product.json, static/schemas/source/core/canonical-reporting-capabilities.json, static/schemas/source/media-buy/get-products-request.json, static/schemas/source/media-buy/product-fields.json. review_decision is REVIEW_REQUIRED — a real approval is required before merge.

Why human review

  • Gated paths touched (static/schemas/source/**) and review_decision is REVIEW_REQUIRED, not APPROVED — human/CODEOWNERS approval required before merge for: canonical-product.json, canonical-reporting-capabilities.json, get-products-request.json, product-fields.json
  • This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/core/canonical-product.json (modified) matches static/schemas/source/**; static/schemas/source/core/canonical-reporting-capabilities.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/get-products-request.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/product-fields.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 Sep 30, 2026
The Python SDK export consolidation rejected a new name collision:
ReportingDeliveryOfferingId was defined in both core.reporting_capabilities
and core.canonical_reporting_capabilities, because both carried the same
inline item schema. Move the item to core/reporting-delivery-offering-id.json
(same minLength, maxLength, pattern, and x-entity) and reference it from both,
so the generator emits the type once.

Co-Authored-By: Claude Opus 5.5 (1M context) <[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 paths touched and review not yet approved.

This PR modifies files under static/schemas/source/**, which is a hard, non-overridable approval gate (gated_paths: true), and the current review_decision is REVIEW_REQUIRED, not APPROVED. Per decision table row 2, the outcome must be escalate (no blocking findings exist to make it request-changes).

Escalation reasons

  • static/schemas/source/core/canonical-product.json, canonical-reporting-capabilities.json, reporting-capabilities.json, reporting-delivery-offering-id.json, get-products-request.json, product-fields.json — protocol schema source under a hard approval gate; human/CODEOWNERS approval required before merge.

Findings
Reviewer reported a clean delta pass: the reporting_delivery_offering_ids item shape was extracted into a shared core/reporting-delivery-offering-id.json referenced by $ref, preserving string constraints verbatim (minLength 1, maxLength 128, pattern, x-entity). Validation-equivalent, no wire change, no oneOf regression, no docs drift, changeset present. No critical/high/medium findings.

The diff is mechanically clean, but the gate is deterministic and only lifts once review_decision becomes APPROVED. Prior decision was also escalate for the same gated-path reason; the escalation stands until a human/CODEOWNERS review is recorded.

Why human review

  • Gated paths touched (static/schemas/source/**) and review_decision is REVIEW_REQUIRED, not APPROVED — human/CODEOWNERS approval required before merge for: canonical-product.json, canonical-reporting-capabilities.json, reporting-capabilities.json, reporting-delivery-offering-id.json, get-products-request.json, product-fields.json
  • This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/core/canonical-product.json (modified) matches static/schemas/source/**; static/schemas/source/core/canonical-reporting-capabilities.json (modified) matches static/schemas/source/**; static/schemas/source/core/reporting-capabilities.json (modified) matches static/schemas/source/**; static/schemas/source/core/reporting-delivery-offering-id.json (added) matches static/schemas/source/**; static/schemas/source/media-buy/get-products-request.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/product-fields.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.

@bokelley
bokelley merged commit 114f168 into main Sep 30, 2026
61 checks passed
@bokelley
bokelley deleted the fix/canonical-product-gaps branch September 30, 2026 18:21
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