Skip to content

feat(media-buy): add shared media-buy frequency cap - #7449

Merged
bokelley merged 2 commits into
mainfrom
frequency-cap-media-buy-scope
Sep 14, 2026
Merged

bokelley merged 2 commits into
mainfrom
frequency-cap-media-buy-scope

Conversation

@bokelley

@bokelley bokelley commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implements #4240. Originally stacked on #7438; now rebased onto main after #7438 merged and retargeted to main. Adds a MediaBuy-level frequency_cap whose single counter is shared across every package in the buy. Scope is determined by field location: a cap nested in a package targeting_overlay is a package counter (unchanged), a root frequency_cap is the shared counter. Both compose with AND semantics.

This is the second half of the earlier, larger revision of #7438, re-scoped so each PR is reviewable on its own. Compared with that revision, opaque counter groups are gone: product compatibility is expressed through media_buy_support.frequency_cap: true plus the product's resolved supported_per_units, and an incompatible mix is rejected atomically at create, update, or package addition.

What changes

Surface Change
Root frequency_cap On create_media_buy, update_media_buy, control_media_buy, buy_products; in commercial_terms, legacy Proposal, and MediaBuy read-back. Max-impression only in 3.2; suppression stays package-only.
media_buy.aggregate_frequency_capping New seller capability declaring the complete executable domain. Legacy frequency_capping keeps its package meaning so older buyers never mistake a root-only seller.
Product.media_buy_support frequency_cap: true participation, optionally narrowed by frequency_cap_constraints. Identity-absent products cannot declare it.
Discovery required_media_buy_support and media_buy_frequency_cap on get_products and shared criteria; wholesale cache tuple includes both; fields projection never suppresses media_buy_support when requested.
Proposal refinement remove_media_buy_frequency_cap: true clears an inherited root cap; mutually exclusive with supplying a replacement.
Actions update_media_buy_frequency_cap as a structured-only available action; ACTION_NOT_ALLOWED.attempted_action accepts it via a shared action-id schema. Cap changes never reset counters.
Compliance New media_buy_frequency_cap_readback scenario: participation-gated discovery, rejection of a non-participating product and of a per-unit mismatch, exact acceptance, read-back.
Docs Spec table grows to four rows with the shared-counter row; capabilities and task references updated.

Review follow-ups already applied

  • Restored the unrelated normative text that the earlier revision had dropped from the create_media_buy targeting_overlay row, the update_media_buy new_packages description (schema and doc), and the proposal-refinement description; the frequency-cap rules are appended rather than substituted.

  • Added the root frequency_cap row to the update_media_buy request table and the get_media_buys response table, and fixed the stale cache tuple in the if_wholesale_feed_version row.

  • The structured-only action binding uses the same enumMetadata key as media-buy-valid-action.json, and that enum's normative comment tells SDKs to merge both blocks.

  • The prompt-cleanup savings tolerance in tests/mcp-schema-analysis.test.cjs moves from 18% to 17%: the two new discovery inputs are not compacted by the cleanup adapter, so the measured ratio is 0.822. The list_products legacy-graph guard now matches the quoted tool name so the new canonical action value does not trip it.

  • Rebased on the final feat(media-buy): add structured product frequency-cap constraints #7438 (mutual exclusion of the two package forms, negative compliance step, workflow wording).

  • Security review: root-cap request schemas now say sellers MUST reject with UNSUPPORTED_FEATURE before any mutation and MUST NOT clamp; the spec adds the buyer-side rule that a response without the root-cap echo means the cap was not applied; the compliance discovery step asserts exactly the two participating products are returned; the changeset notes the attempted_action schema change for 3.1 SDKs.

  • Workflow review: resolved the contradiction between "root-cap mutability is runtime-only" and the schema's frequency_cap_constraints.mutable_fields (capability at discovery, available_actions decides now); stated that the exact media_buy_frequency_cap alone suffices at discovery; named control_media_buy for live root-cap changes and REQUOTE_REQUIRED for changes outside accepted terms; defined that clearing the cap and adding packages in one request is evaluated against the resulting state; the spec table now has eight rows including live-change and add-product rows.

  • Ladon review: core/product-allowed-action.json now points action at the structured action-id schema, so products can advertise update_media_buy_frequency_cap in allowed_actions as the spec recommends; covered by new test vectors.

  • Merged current main (through feat(reporting): harden consumer-status loop for rc.3 #7465) into the branch; the only conflict was docs/media-buy/task-reference/sync_reporting_status.mdx, resolved in favor of main's pinned schema links.

  • Final verification review: restored the daily-budget-cap rejection sentence in buy_products.mdx that the frequency-cap paragraph had displaced, and reworded the root-cap rejection so it no longer speaks of "scopes". product-fields.json also gains overlay_support alongside media_buy_support, a pre-existing omission in the fields projection enum.

Testing

  • tests/targeting-aware-discovery.test.cjs 24/24 (adds the location-scope test and aggregate support vectors).
  • node tests/schema-validation.test.cjs 35/35; JSON schema block validation; enum drift, identity coherence, deprecation metadata, affected-packages lint.
  • npm run test:mcp-schema-projection 29/29 with re-measured counts.
  • npm run build:compliance clean; storyboard lint suite passes.
  • Server schema parity test 4/4.
  • Non-server precommit checks (unit, dynamic imports, format identity boundaries, callapi state change, typecheck) pass.
  • TypeScript SDK generation from the PR bundle: see CI.
  • The get_products doc carries four snippet failures that exist identically on main.

Risks and follow-ups

  • Cross-MediaBuy or cross-order counters are explicitly out of scope and would be a separately identified grouping resource.
  • If a seller genuinely has products that share a per unit but cannot share a counter, an opaque compatibility group can be added later as an additive field; nothing here precludes it.

🤖 Generated with Claude Code

@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 and adds numerous files under static/schemas/source/**, which are under the repo's hard, deterministic approval gate (gated_paths: true). The required review status is review_decision: (unknown/none), which is not APPROVED, so decision-table row 2 fires and the outcome must be escalate.

The reviewer found no Critical/High/Medium findings — the change reads as a clean, additive Normative-class change (shared MediaBuy-level frequency_cap, aggregate_frequency_capping capability, Product.media_buy_support, discovery fields, the structured-only update_media_buy_frequency_cap action, proposal-refinement removal) with a correct minor changeset, verified schema↔docs coherence, no new undiscriminated oneOf, and comprehensive tests. Absent the gate this would approve, but the hard approval gate on static/schemas/source/** cannot be satisfied without a human/CODEOWNERS APPROVED review.

Escalation reasons:

  • Touches gated protocol-source files under static/schemas/source/** (e.g. static/schemas/source/core/media-buy.json, frequency-cap.json, and ~30 others) with review_decision not APPROVED — human/CODEOWNERS review required.

Why human review

  • Gated paths under static/schemas/source/** (30+ files, e.g. core/media-buy.json, core/frequency-cap.json) are modified/added while review_decision is not APPROVED — human/CODEOWNERS approval required to satisfy the hard approval gate.
  • This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/core/canonical-media-buy-action.json (modified) matches static/schemas/source/**; static/schemas/source/core/canonical-product.json (modified) matches static/schemas/source/**; static/schemas/source/core/frequency-cap.json (modified) matches static/schemas/source/**; static/schemas/source/core/media-buy-available-action-id.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-available-action.json (modified) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-capability.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-requirement.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-support.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-support-requirements.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-support.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy.json (modified) matches static/schemas/source/**; static/schemas/source/core/package.json (modified) matches static/schemas/source/**; static/schemas/source/core/product-identity.json (modified) matches static/schemas/source/**; static/schemas/source/core/product.json (modified) matches static/schemas/source/**; static/schemas/source/core/proposal.json (modified) matches static/schemas/source/**; static/schemas/source/enums/canonical-media-buy-action.json (modified) matches static/schemas/source/**; static/schemas/source/enums/error-code.json (modified) matches static/schemas/source/**; static/schemas/source/enums/media-buy-frequency-cap-control-mode.json (added) matches static/schemas/source/**; static/schemas/source/error-details/action-not-allowed.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/buy-products-request.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/commercial-terms.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/control-media-buy-request.json (modified) matches static/schemas/source/**; static/schemas/source/media-bu

…(truncated)…

@aao-secretariat aao-secretariat Bot added the ladon/needs-human-review Ladon has escalated this PR for human review. label Sep 13, 2026
@bokelley
bokelley force-pushed the frequency-cap-media-buy-scope branch from 343c6cd to dae5c9c Compare September 13, 2026 13:31

@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 modified without an APPROVED review.

This PR touches 30+ files under static/schemas/source/** (a hard, deterministic approval gate), while review_decision is unknown/none — not APPROVED. Per decision rule row 2, the gate is not satisfied and the PR cannot be auto-approved regardless of how clean the diff is.

The reviewer pass is clean: no Critical/High/Medium findings. Verified changeset scope/type (minor, protocol-scoped, additive), backward-compatible $ref widenings, no new undiscriminated oneOf, no dist/** mutation, and schema↔docs coherence across the affected tasks. This is a net-positive iteration over the prior escalate (also gated-paths driven, no findings).

Because the change adds new fields/enums to the published protocol surface, it is a Normative additive change on a gated path — human/CODEOWNERS approval is required to lift the gate.

Escalation reasons

  • Gated paths under static/schemas/source/** (e.g. core/media-buy.json, core/frequency-cap.json, enums/media-buy-frequency-cap-control-mode.json, enums/error-code.json) are modified/added while review_decision is not APPROVED — human/CODEOWNERS approval required to satisfy the hard approval gate.

No blocking code findings; the block is procedural (approval gate), not a defect.

Why human review

  • Gated paths under static/schemas/source/** (30+ files, e.g. core/media-buy.json, core/frequency-cap.json, enums/media-buy-frequency-cap-control-mode.json) are modified/added while review_decision is not APPROVED — human/CODEOWNERS approval required to satisfy the hard approval gate (decision rule row 2).
  • This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/core/canonical-media-buy-action.json (modified) matches static/schemas/source/**; static/schemas/source/core/canonical-product.json (modified) matches static/schemas/source/**; static/schemas/source/core/frequency-cap.json (modified) matches static/schemas/source/**; static/schemas/source/core/media-buy-available-action-id.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-available-action.json (modified) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-capability.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-requirement.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-support.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-support-requirements.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-support.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy.json (modified) matches static/schemas/source/**; static/schemas/source/core/package.json (modified) matches static/schemas/source/**; static/schemas/source/core/product-identity.json (modified) matches static/schemas/source/**; static/schemas/source/core/product.json (modified) matches static/schemas/source/**; static/schemas/source/core/proposal.json (modified) matches static/schemas/source/**; static/schemas/source/enums/canonical-media-buy-action.json (modified) matches static/schemas/source/**; static/schemas/source/enums/error-code.json (modified) matches static/schemas/source/**; static/schemas/source/enums/media-buy-frequency-cap-control-mode.json (added) matches static/schemas/source/**; static/schemas/source/enums/media-buy-valid-action.json (modified) matches static/schemas/source/**; static/schemas/source/error-details/action-not-allowed.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/buy-products-request.json (modified) matches static/schemas/source/**; static/

…(truncated)…

@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/adds 30+ files under static/schemas/source/**, which the repo places under a hard, non-overridable approval gate (gated_paths: true). review_decision is unknown/none — not APPROVED — so decision rule row 2 forces escalation regardless of how clean the diff is. Human/CODEOWNERS approval must be recorded before this can merge.

The reviewer reported a clean pass: the shared MediaBuy-level frequency_cap adds only optional fields across create/update/control/buy_products/get_products/get_media_buys/capabilities with matching schema↔docs coherence, a correct minor changeset, no dist edits, no undiscriminated oneOf, sound allOf compositions, and compliance/discovery test coverage. No Critical, High, or Medium findings.

Escalation reasons

  • Gated paths under static/schemas/source/** (30+ files, e.g. core/media-buy.json, core/frequency-cap.json, enums/media-buy-frequency-cap-control-mode.json) are modified/added while review_decision is not APPROVED. Human/CODEOWNERS approval is required to satisfy the hard approval gate (row 2). Once an APPROVED review is recorded, a clean re-run with no findings can approve.

Why human review

  • Gated paths under static/schemas/source/** (30+ files, e.g. core/media-buy.json, core/frequency-cap.json, enums/media-buy-frequency-cap-control-mode.json) are modified/added while review_decision is not APPROVED — human/CODEOWNERS approval required to satisfy the hard approval gate (decision rule row 2).
  • This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/core/canonical-media-buy-action.json (modified) matches static/schemas/source/**; static/schemas/source/core/canonical-product.json (modified) matches static/schemas/source/**; static/schemas/source/core/frequency-cap.json (modified) matches static/schemas/source/**; static/schemas/source/core/media-buy-available-action-id.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-available-action.json (modified) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-capability.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-requirement.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-support.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-support-requirements.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-support.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy.json (modified) matches static/schemas/source/**; static/schemas/source/core/package.json (modified) matches static/schemas/source/**; static/schemas/source/core/product-identity.json (modified) matches static/schemas/source/**; static/schemas/source/core/product.json (modified) matches static/schemas/source/**; static/schemas/source/core/proposal.json (modified) matches static/schemas/source/**; static/schemas/source/enums/canonical-media-buy-action.json (modified) matches static/schemas/source/**; static/schemas/source/enums/error-code.json (modified) matches static/schemas/source/**; static/schemas/source/enums/media-buy-frequency-cap-control-mode.json (added) matches static/schemas/source/**; static/schemas/source/enums/media-buy-valid-action.json (modified) matches static/schemas/source/**; static/schemas/source/error-details/action-not-allowed.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/buy-products-request.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/commercial-terms.json (modified) matches `static/schemas/so

…(truncated)…

@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 adds a MediaBuy-level shared frequency_cap capability across the protocol source. The reviewer found a clean pass: schema graph, docs across the seven touched pages, the new compliance scenario, and tests all cohere; the changeset is correctly scoped/typed and honestly discloses the attempted_action $ref widening. No new undiscriminated oneOf, no dist edits, no spec drift, no blocking findings.

However, the diff modifies/adds 30+ files under static/schemas/source/**, which are under a hard, non-overridable approval gate (gated_paths: true), and review_decision is not APPROVED (currently unknown/none). Per decision rule row 2, the outcome must be escalate regardless of how clean the diff is — Ladon cannot auto-approve protocol-surface changes until a human/CODEOWNERS approval is recorded. This is also a new-feature (Normative/likely breaking-class) protocol change, which per the constitution's hard gate is never auto-approved without human ratification.

Escalation reasons

  • Gated paths under static/schemas/source/** (e.g. core/media-buy.json, core/frequency-cap.json, the new media-buy-frequency-cap-* schemas and enums/media-buy-frequency-cap-control-mode.json) are modified/added while review_decision is not APPROVED — human/CODEOWNERS approval required to satisfy the hard approval gate (decision rule row 2).
  • New protocol capability (frequency_cap) is a normative/breaking-class change; ratification is a human act (constitution hard gate).

Why human review

  • Gated paths under static/schemas/source/** (30+ files, e.g. core/media-buy.json, core/frequency-cap.json, core/media-buy-frequency-cap.json, enums/media-buy-frequency-cap-control-mode.json) are modified/added while review_decision is not APPROVED — human/CODEOWNERS approval required to satisfy the hard approval gate (decision rule row 2).
  • New MediaBuy-level frequency_cap capability is a normative/breaking-class protocol change; ratification is a human act per the constitution's hard gate — never auto-approved unless review_decision is APPROVED.
  • This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/core/canonical-media-buy-action.json (modified) matches static/schemas/source/**; static/schemas/source/core/canonical-product.json (modified) matches static/schemas/source/**; static/schemas/source/core/frequency-cap.json (modified) matches static/schemas/source/**; static/schemas/source/core/media-buy-available-action-id.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-available-action.json (modified) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-capability.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-requirement.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-support.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-support-requirements.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-support.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy.json (modified) matches static/schemas/source/**; static/schemas/source/core/package.json (modified) matches static/schemas/source/**; static/schemas/source/core/product-identity.json (modified) matches static/schemas/source/**; static/schemas/source/core/product.json (modified) matches static/schemas/source/**; static/schemas/source/core/proposal.json (modified) matches static/schemas/source/**; static/schemas/source/enums/canonical-media-buy-action.json (modified) matches static/schemas/source/**; static/schemas/source/enum

…(truncated)…

Comment thread docs/media-buy/specification.mdx 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: Request changes

Request changes — 1 blocking finding.

Blocking findings

  • docs/media-buy/specification.mdx — Schema↔docs drift (High): docs instruct sellers to list update_media_buy_frequency_cap in a product's allowed_actions, but core/product-allowed-action.json still references the flat media-buy-valid-action enum, which excludes that action. The parallel buy-side surfaces were repointed to the new media-buy-available-action-id schema, leaving the product-side allowed-action enum inconsistent with the documented wire shape. Per the repo's mandatory schema↔docs coherence rule, docs asserting a wire shape the schema does not encode is spec drift (high).

Per decision table row 1, any high finding forces request-changes. Resolve by repointing core/product-allowed-action.json to the new media-buy-available-action-id schema (or otherwise aligning the enum) so it admits update_media_buy_frequency_cap consistent with the specification docs.

Note: This PR also sits under the hard gated-paths approval gate (static/schemas/source/**, review_decision not APPROVED) — human/CODEOWNERS approval will still be required once the blocker is resolved. The changeset (minor, additive 3.2), oneOf audit, dist immutability, and largest-delta files otherwise check out.

Blocking findings

  • docs/media-buy/specification.mdx — Schema↔docs drift: docs list update_media_buy_frequency_cap in product allowed_actions, but core/product-allowed-action.json still refs the flat media-buy-valid-action enum that excludes it (buy-side surfaces were repointed to media-buy-available-action-id but the product-side was not).

Comment thread docs/media-buy/specification.mdx Resolved
@aao-secretariat
aao-secretariat Bot dismissed their stale review September 13, 2026 17:49

Superseded by a later Ladon review that rechecked and resolved its blocking findings.

@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: Request changes

Request changes — 1 blocking finding (schema↔docs drift).

Blocking findings

  • docs/media-buy/specification.mdx:241 — Schema↔docs drift (High): docs instruct products to list update_media_buy_frequency_cap in allowed_actions, but core/product-allowed-action.json still binds action to the flat media-buy-valid-action enum, which excludes that value. Meanwhile buy-side surfaces were repointed to media-buy-available-action-id.json, so the product-side allowed-action reference is now inconsistent with what the docs assert. Repoint the product allowed-action to the enum/id that includes update_media_buy_frequency_cap, or correct the docs.

This is a subsequent pass; the prior run's single blocker persists. Changeset (minor/additive), oneOf discriminator audit, dist artifact immutability, and the remaining cross-file schema/docs coherence otherwise check out. Per decision table row 1, a High finding blocks. (Gated paths + unknown review_decision would also independently require non-approval.)

Blocking findings

  • docs/media-buy/specification.mdx:241 — Schema↔docs drift: docs list update_media_buy_frequency_cap in allowed_actions but product-allowed-action.json binds to media-buy-valid-action enum that excludes it (High)

@bokelley
bokelley force-pushed the frequency-cap-media-buy-scope branch from 36a0da3 to a97a281 Compare September 13, 2026 18:35
@aao-secretariat
aao-secretariat Bot dismissed their stale review September 13, 2026 18:41

Superseded by a later Ladon review that rechecked and resolved its blocking findings.

@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 protocol-schema paths require human/CODEOWNERS approval.

This PR modifies numerous files under static/schemas/source/**, which are under a hard, deterministic approval gate (gated_paths: true). review_decision is unknown/none — not APPROVED — so the gate is not satisfied and the outcome cannot be approve or plain comment (decision table row 2).

Reviewer findings: clean pass. The prior High blocker (product-allowed-action.json action binding) is resolved — it now binds to media-buy-available-action-id.json (anyOf legacy enum + const update_media_buy_frequency_cap), matching specification.mdx and covered by new test vectors. No current Critical/High/Medium findings; schema↔docs coherence, changeset scope, oneOf discriminators, and dist immutability all verified. This is a net improvement over the prior request-changes.

However, this is a new frequency-cap protocol surface (new fields, new enum values, new error codes) — a normative/potentially breaking-class protocol change on the AdCP wire surface. Per repo governance, breaking-class and gated schema changes are never auto-approved; ratification is a human act. A human/CODEOWNERS reviewer must approve the schema changes.

No blocking findings — this escalation is procedural (gated paths + governance), not a defect gate.

Escalation reasons:

  • Gated paths touched under static/schemas/source/** with review_decision not APPROVED — human/CODEOWNERS review required.
  • New frequency-cap protocol surface (new fields/enum values/error codes) is a normative/breaking-class change requiring human ratification.

Why human review

  • Gated paths: PR modifies many files under static/schemas/source/** (protocol source of truth) and review_decision is not APPROVED — human/CODEOWNERS review required to satisfy the hard approval gate.
  • New frequency-cap protocol surface adds fields, enum values, and error codes — a normative/breaking-class wire change that per repo governance is never auto-approved and requires explicit human ratification.
  • This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/core/canonical-media-buy-action.json (modified) matches static/schemas/source/**; static/schemas/source/core/canonical-product.json (modified) matches static/schemas/source/**; static/schemas/source/core/frequency-cap.json (modified) matches static/schemas/source/**; static/schemas/source/core/media-buy-available-action-id.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-available-action.json (modified) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-capability.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-requirement.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-support.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-support-requirements.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy-support.json (added) matches static/schemas/source/**; static/schemas/source/core/media-buy.json (modified) matches static/schemas/source/**; static/schemas/source/core/package.json (modified) matches static/schemas/source/**; static/schemas/source/core/product-allowed-action.json (modified) matches static/schemas/source/**; static/schemas/source/core/product-identity.json (modified) matches static/schemas/source/**; static/schemas/source/core/product.json (modified) matches static/schemas/source/**; static/schemas/source/core/proposal.json (modified) matches static/schemas/source/**; static/schemas/source/enums/canonical-media-buy-action.json (modified) matches static/schemas/source/**; static/schemas/source/e

…(truncated)…

Base automatically changed from mesa-verde to main September 13, 2026 20:24
@bokelley
bokelley force-pushed the frequency-cap-media-buy-scope branch 2 times, most recently from 0933f0c to c81b605 Compare September 13, 2026 20:33
Implements #4240 on top of the package-level constraints from #7430. A root
`frequency_cap` on a MediaBuy owns one counter shared across every package;
scope is determined by field location, and package caps are unchanged.

- Root `frequency_cap` on create, update, control, and buy requests, in
  accepted commercial terms, legacy proposals, and MediaBuy read-back. Root
  caps are max-impression-only in 3.2; suppression stays package-only.
- Seller capability `media_buy.aggregate_frequency_capping` declares the
  complete executable domain. The legacy `frequency_capping` object keeps its
  package meaning so older buyers never mistake a root-only seller.
- Product participation via `Product.media_buy_support.frequency_cap: true`,
  optionally narrowed by `frequency_cap_constraints`. Every selected product
  must participate and support the root cap's `per` value; incompatible mixes
  are rejected atomically. Compatibility is expressed through per-unit support
  rather than opaque counter groups.
- Discovery: `required_media_buy_support` and `media_buy_frequency_cap`;
  proposal refinement can clear the root cap with
  `remove_media_buy_frequency_cap`.
- `update_media_buy_frequency_cap` is a structured-only available action;
  `ACTION_NOT_ALLOWED.attempted_action` accepts it. Cap changes never reset
  counters.
- Adds the `media_buy_frequency_cap_readback` compliance scenario covering
  participation-gated discovery, non-participating and per-unit mismatch
  rejection, exact acceptance, and read-back.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@bokelley
bokelley force-pushed the frequency-cap-media-buy-scope branch from c81b605 to 61234b5 Compare September 13, 2026 20:49
Resolves the conflict in docs/media-buy/task-reference/sync_reporting_status.mdx
in favor of main (#7465 pins the schema links to 3.2.0-rc.2).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@bokelley
bokelley merged commit f1848ee into main Sep 14, 2026
61 checks passed
@bokelley
bokelley deleted the frequency-cap-media-buy-scope branch September 14, 2026 00:23
bokelley added a commit that referenced this pull request Sep 14, 2026
… caps (#7494)

* feat(training-agent): implement package and shared MediaBuy frequency caps

Closes #7488. The three frequency-cap compliance scenarios from #7438 and
#7449 were gated on capabilities the reference seller never advertised, so
they had never executed. The training agent now implements the spec section
"Frequency-cap scope and product support":

- Advertise media_buy.frequency_capping and the complete executable
  media_buy.aggregate_frequency_capping domain (sales tenant and legacy
  capabilities handler).
- Resolve product support with seller-wide inheritance for
  overlay_support.frequency_cap / frequency_cap_support and
  media_buy_support.frequency_cap (+ frequency_cap_constraints); default
  catalog products declare both legacy package support and shared-counter
  participation.
- Discovery honours required_overlay_support.frequency_cap_support,
  required_media_buy_support, and exact media_buy_frequency_cap; returned
  products carry media_buy_support regardless of fields; proposals echo the
  bound root cap.
- Create, buy, update, and control validate package caps against resolved
  product constraints and root caps against seller-wide plus every product,
  rejecting with UNSUPPORTED_FEATURE before any mutation and never clamping.
  Root caps replace or clear (null) without resetting counters; new_packages
  are checked against the resulting state; ineligible packages and
  non-mutable root caps return ACTION_NOT_ALLOWED before capability checks.
- available_actions carries update_frequency_caps with applicable_package_ids
  for heterogeneous buys and update_media_buy_frequency_cap when every active
  product can change the root cap.
- Proposal refinement clears an inherited root cap through
  remove_media_buy_frequency_cap, replaces it through
  criteria.media_buy_frequency_cap, and is unable when the revised mix cannot
  share it.
- Delivery totals report reach and frequency at or below the tightest
  enforced cap.
- Requests addressing a synced account by account_id reach the same media
  buy and fixture catalog as natural-form requests.

Compliance: add media_buy_frequency_cap_updates; give the multi-package
frequency-cap scenarios explicit bids after the first package (the runner
only injects a bid for the first) and use affected_package_ids[*] for
membership checks. Spec: state that a root-cap change without
update_media_buy_frequency_cap returns ACTION_NOT_ALLOWED ahead of the
capability check, and that mutable_fields governs changes to an existing cap.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* docs(media-buy): state frequency-cap check order explicitly for both cap levels

The package-cap paragraph never stated that available_actions authorization
runs before the capability check, so the root-cap sentence added earlier
referenced a rule the spec did not make. State the order once for package
caps (authorization, then capability, then accepted commercial terms) and
have the root-cap paragraph apply the same order.

Make the training agent honour that order for package caps on
control_media_buy as well: the cap gate now runs ahead of the accepted-
envelope REQUOTE_REQUIRED checks, so a cap that is both outside capability
and outside accepted terms reports UNSUPPORTED_FEATURE. Add unit coverage
for authorization-before-capability (out-of-range count on a create-only
package, mixed request) and capability-before-terms, and a
frequency_cap_capability_updates step that sends an out-of-range count to
the create-only package and expects ACTION_NOT_ALLOWED.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
garvitkaushik-123 added a commit that referenced this pull request Sep 14, 2026
Exercise the three frequency-cap controls on refine_proposals introduced
by #7449: replace via criteria.media_buy_frequency_cap, clear via
remove_media_buy_frequency_cap, and unable outcomes for incompatible
product mixes and out-of-range caps. Tracks adcp-client#2916 for the
SDK allowlist fix.

Closes #7493
@aao-release-bot aao-release-bot Bot mentioned this pull request Sep 14, 2026
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