Repository navigation
feat(media-buy): add shared media-buy frequency cap - #7449
Conversation
There was a problem hiding this comment.
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) withreview_decisionnotAPPROVED— 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) matchesstatic/schemas/source/**; static/schemas/source/core/frequency-cap.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-available-action-id.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-available-action.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-capability.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-requirement.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-support.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-support-requirements.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-support.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/package.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/product-identity.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/product.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/proposal.json (modified) matchesstatic/schemas/source/**; static/schemas/source/enums/canonical-media-buy-action.json (modified) matchesstatic/schemas/source/**; static/schemas/source/enums/error-code.json (modified) matchesstatic/schemas/source/**; static/schemas/source/enums/media-buy-frequency-cap-control-mode.json (added) matchesstatic/schemas/source/**; static/schemas/source/error-details/action-not-allowed.json (modified) matchesstatic/schemas/source/**; static/schemas/source/media-buy/buy-products-request.json (modified) matchesstatic/schemas/source/**; static/schemas/source/media-buy/commercial-terms.json (modified) matchesstatic/schemas/source/**; static/schemas/source/media-buy/control-media-buy-request.json (modified) matchesstatic/schemas/source/**; static/schemas/source/media-bu
…(truncated)…
86d4717 to
0c8c4f8
Compare
343c6cd to
dae5c9c
Compare
There was a problem hiding this comment.
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 whilereview_decisionis 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) matchesstatic/schemas/source/**; static/schemas/source/core/frequency-cap.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-available-action-id.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-available-action.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-capability.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-requirement.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-support.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-support-requirements.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-support.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/package.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/product-identity.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/product.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/proposal.json (modified) matchesstatic/schemas/source/**; static/schemas/source/enums/canonical-media-buy-action.json (modified) matchesstatic/schemas/source/**; static/schemas/source/enums/error-code.json (modified) matchesstatic/schemas/source/**; static/schemas/source/enums/media-buy-frequency-cap-control-mode.json (added) matchesstatic/schemas/source/**; static/schemas/source/enums/media-buy-valid-action.json (modified) matchesstatic/schemas/source/**; static/schemas/source/error-details/action-not-allowed.json (modified) matchesstatic/schemas/source/**; static/schemas/source/media-buy/buy-products-request.json (modified) matchesstatic/schemas/source/**; static/
…(truncated)…
0c8c4f8 to
2053cac
Compare
dae5c9c to
a70bbb6
Compare
There was a problem hiding this comment.
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 whilereview_decisionis notAPPROVED. Human/CODEOWNERS approval is required to satisfy the hard approval gate (row 2). Once anAPPROVEDreview 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) matchesstatic/schemas/source/**; static/schemas/source/core/frequency-cap.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-available-action-id.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-available-action.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-capability.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-requirement.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-support.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-support-requirements.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-support.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/package.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/product-identity.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/product.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/proposal.json (modified) matchesstatic/schemas/source/**; static/schemas/source/enums/canonical-media-buy-action.json (modified) matchesstatic/schemas/source/**; static/schemas/source/enums/error-code.json (modified) matchesstatic/schemas/source/**; static/schemas/source/enums/media-buy-frequency-cap-control-mode.json (added) matchesstatic/schemas/source/**; static/schemas/source/enums/media-buy-valid-action.json (modified) matchesstatic/schemas/source/**; static/schemas/source/error-details/action-not-allowed.json (modified) matchesstatic/schemas/source/**; static/schemas/source/media-buy/buy-products-request.json (modified) matchesstatic/schemas/source/**; static/schemas/source/media-buy/commercial-terms.json (modified) matches `static/schemas/so
…(truncated)…
2053cac to
e5d04fc
Compare
a70bbb6 to
ee0950e
Compare
There was a problem hiding this comment.
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 newmedia-buy-frequency-cap-*schemas andenums/media-buy-frequency-cap-control-mode.json) are modified/added whilereview_decisionis 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) matchesstatic/schemas/source/**; static/schemas/source/core/frequency-cap.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-available-action-id.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-available-action.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-capability.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-requirement.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-support.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-support-requirements.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-support.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/package.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/product-identity.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/product.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/proposal.json (modified) matchesstatic/schemas/source/**; static/schemas/source/enums/canonical-media-buy-action.json (modified) matchesstatic/schemas/source/**; static/schemas/source/enum
…(truncated)…
e5d04fc to
051c2fa
Compare
ee0950e to
75f68ea
Compare
There was a problem hiding this comment.
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_capin a product'sallowed_actions, butcore/product-allowed-action.jsonstill references the flatmedia-buy-valid-actionenum, which excludes that action. The parallel buy-side surfaces were repointed to the newmedia-buy-available-action-idschema, 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).
051c2fa to
6b4056d
Compare
75f68ea to
36a0da3
Compare
Superseded by a later Ladon review that rechecked and resolved its blocking findings.
There was a problem hiding this comment.
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_capinallowed_actions, butcore/product-allowed-action.jsonstill bindsactionto the flatmedia-buy-valid-actionenum, which excludes that value. Meanwhile buy-side surfaces were repointed tomedia-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 includesupdate_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)
36a0da3 to
a97a281
Compare
Superseded by a later Ladon review that rechecked and resolved its blocking findings.
There was a problem hiding this comment.
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/**withreview_decisionnot 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) matchesstatic/schemas/source/**; static/schemas/source/core/frequency-cap.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-available-action-id.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-available-action.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-capability.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-requirement.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap-support.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-frequency-cap.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-support-requirements.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy-support.json (added) matchesstatic/schemas/source/**; static/schemas/source/core/media-buy.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/package.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/product-allowed-action.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/product-identity.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/product.json (modified) matchesstatic/schemas/source/**; static/schemas/source/core/proposal.json (modified) matchesstatic/schemas/source/**; static/schemas/source/enums/canonical-media-buy-action.json (modified) matchesstatic/schemas/source/**; static/schemas/source/e
…(truncated)…
0933f0c to
c81b605
Compare
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]>
c81b605 to
61234b5
Compare
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]>
… 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]>
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
Summary
Implements #4240. Originally stacked on #7438; now rebased onto main after #7438 merged and retargeted to
main. Adds a MediaBuy-levelfrequency_capwhose single counter is shared across every package in the buy. Scope is determined by field location: a cap nested in a packagetargeting_overlayis a package counter (unchanged), a rootfrequency_capis 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: trueplus the product's resolvedsupported_per_units, and an incompatible mix is rejected atomically at create, update, or package addition.What changes
frequency_capcreate_media_buy,update_media_buy,control_media_buy,buy_products; incommercial_terms, legacyProposal, andMediaBuyread-back. Max-impression only in 3.2; suppression stays package-only.media_buy.aggregate_frequency_cappingfrequency_cappingkeeps its package meaning so older buyers never mistake a root-only seller.Product.media_buy_supportfrequency_cap: trueparticipation, optionally narrowed byfrequency_cap_constraints. Identity-absent products cannot declare it.required_media_buy_supportandmedia_buy_frequency_caponget_productsand shared criteria; wholesale cache tuple includes both;fieldsprojection never suppressesmedia_buy_supportwhen requested.remove_media_buy_frequency_cap: trueclears an inherited root cap; mutually exclusive with supplying a replacement.update_media_buy_frequency_capas a structured-only available action;ACTION_NOT_ALLOWED.attempted_actionaccepts it via a shared action-id schema. Cap changes never reset counters.media_buy_frequency_cap_readbackscenario: participation-gated discovery, rejection of a non-participating product and of a per-unit mismatch, exact acceptance, read-back.Review follow-ups already applied
Restored the unrelated normative text that the earlier revision had dropped from the
create_media_buytargeting_overlayrow, theupdate_media_buynew_packagesdescription (schema and doc), and theproposal-refinementdescription; the frequency-cap rules are appended rather than substituted.Added the root
frequency_caprow to theupdate_media_buyrequest table and theget_media_buysresponse table, and fixed the stale cache tuple in theif_wholesale_feed_versionrow.The structured-only action binding uses the same
enumMetadatakey asmedia-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.cjsmoves from 18% to 17%: the two new discovery inputs are not compacted by the cleanup adapter, so the measured ratio is 0.822. Thelist_productslegacy-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_FEATUREbefore 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 theattempted_actionschema 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_actionsdecides now); stated that the exactmedia_buy_frequency_capalone suffices at discovery; namedcontrol_media_buyfor live root-cap changes andREQUOTE_REQUIREDfor 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.jsonnow pointsactionat the structured action-id schema, so products can advertiseupdate_media_buy_frequency_capinallowed_actionsas 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.mdxthat the frequency-cap paragraph had displaced, and reworded the root-cap rejection so it no longer speaks of "scopes".product-fields.jsonalso gainsoverlay_supportalongsidemedia_buy_support, a pre-existing omission in thefieldsprojection enum.Testing
tests/targeting-aware-discovery.test.cjs24/24 (adds the location-scope test and aggregate support vectors).node tests/schema-validation.test.cjs35/35; JSON schema block validation; enum drift, identity coherence, deprecation metadata, affected-packages lint.npm run test:mcp-schema-projection29/29 with re-measured counts.npm run build:complianceclean; storyboard lint suite passes.get_productsdoc carries four snippet failures that exist identically onmain.Risks and follow-ups
perunit 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