Skip to content

feat(media-buy): declare delivery modes and grade guaranteed-only sellers on a matching baseline - #7973

Draft
bokelley wants to merge 8 commits into
mainfrom
feat/delivery-mode-aware-baseline-7852
Draft

bokelley wants to merge 8 commits into
mainfrom
feat/delivery-mode-aware-baseline-7852

Conversation

@bokelley

@bokelley bokelley commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Draft for WG review. Refs #7852. Not a patch-eligible change (see Backport note).

Status: HOLDS to 3.4. This draft stays open as the 3.4 candidate; it is not for 3.3. No guaranteed-only adopter has reported a failing run. 3.3 gets the docs note only (already in the compliance catalog). The WG should still weigh the open questions below before 3.4.

Risk if shipped (blocking): the gates fail closed for any seller whose capabilities response has no media_buy object, or whose grader loads a schema root without the new field's default. See "Fail-closed hazard" below and open question 3.

Problem

A seller that sells only guaranteed inventory cannot get a complete grade on the media_buy_seller baseline. The baseline's follow-on checks need a media_buy_id issued in the create response, and a guaranteed buy returns a submitted task whose media_buy_id arrives only on completion. Evidence from the training seller made faithfully guaranteed-only (get_products lists only guaranteed products, every guaranteed create returns submitted, non-guaranteed buys are rejected, seeded non-guaranteed fixtures stay unsellable): 16 of 56 base storyboards fail, 23 failed steps. The adopter run in #7852 passed 51/51 core scenarios because that seller sells whatever the runner seeds: with the seam's sell seed policy (seeded fixtures sold as seeded) the same training seller clears three of the ten failing scenarios sampled (delivery_reporting, dependency_impairment_audience, external_audience_source_binding) and still fails five that need an immediate media_buy_id. So 51/51 is consistent with a seller that sells the seeded fixtures (and likely completes buys synchronously), not with a faithful guaranteed-only seller. This is inferred, not confirmed with the adopter.

Bucket Scenarios (failing steps)
(i) a hard-coded non-guaranteed fixture is rejected by the seller base create_buy (then check_buy_status, delivery_monitoring skip, 8 steps), dependency_impairment_audience, external_audience_source_binding, total_budget_redistribution
(ii) async arm: create returns submitted, no media_buy_id, dependents cascade delivery_reporting, dependency_impairment, dependency_impairment_cardinality, creative_fate_after_cancellation, inline_creatives_without_sync, invalid_transitions
(iii) discovery asserts non-guaranteed products the seller does not list acceptance_policy_discovery, advanced_delivery_reporting, collection_selection, product_filter_behavior, targeting_aware_discovery, owner_sold_channel_carriage

None of the failing steps carries a delivery-mode requires_capability gate; the workflows are ungated hard-coded fixtures and $context.media_buy_id dependencies.

What this adds

  1. media_buy.supported_delivery_types (optional; items $ref enums/delivery-type.json, minItems: 1, uniqueItems, schema default ["guaranteed","non_guaranteed"]). Absent means both, so existing sellers are unchanged. A seller that declares a subset MUST NOT list products of the other mode and MUST reject a create for one with UNSUPPORTED_FEATURE.
  2. Gates, not adaptation. media_buy_seller and 37 inherited scenarios (every one that creates buys without a guaranteed fixture, plus acceptance_policy_discovery and product_filter_behavior, which failed on discovery) carry a TEMPORARY(adcp#7852)-tagged requires_capability: { path: media_buy.supported_delivery_types, contains: non_guaranteed }, or an added entry in requires_all_capabilities where the scenario already had a gate. Scenario bodies and fixtures are untouched. The base is gated at storyboard level because phase-level gates take one predicate and the base phases already carry the account.timezone gate. The base is minor-bumped to 1.1.0; each gated scenario has its version incremented.
  3. media_buy_seller_guaranteed (new sibling file in protocols/media-buy/, 11 steps), gated not_contains: non_guaranteed, so only a seller that declares a set without non_guaranteed runs it. It reuses the proven sales_guaranteed steps: guaranteed discovery, force_create_media_buy_arm, a submitted create, force_task_completion, get_task_status polling (no webhook), get_media_buys readback of the issued ID, delivery reporting. It also asserts the listing half of the declaration: an unfiltered get_products leads with a guaranteed product, and a delivery_type: non_guaranteed filter returns an empty list. Rejecting a create on an undeclared mode is attestation-only: asserting it needs a non-guaranteed product, and a seller that sells none cannot be required to seed one. comply_test_controller is not in required_tools (that would grade the whole storyboard missing_tool); the forced steps keep a step-level requires_tool as a backstop. The storyboard declares requires: [controller] (the new controller-requires lint on main demands it for controller_seeding storyboards), so a seller with no test controller gets a single storyboard-level missing_test_controller skip; the run does not fail but is not a complete grade (covered by a test).
  4. Drift fix. Base storyboard comments cited DELIVERY_MODE_NOT_SUPPORTED, which is not in error-code.json. They now cite UNSUPPORTED_FEATURE (an undeclared capability, correctable via get_adcp_capabilities), the code the seam and the new capability text use. No new error code is added.
  5. Tests. A lint over the compliance source (every base-required scenario that creates buys without a guaranteed fixture is gated, or sits on a reviewed allowlist with a reason), SDK gate-evaluation tests for four declarations, and an end-to-end vitest that grades the training seller as guaranteed-only, mixed, and non-guaranteed-only.
  6. Docs, DR, changeset. get_adcp_capabilities, compliance catalog (the guaranteed-only <Note> now states the rule), DR-XXXX (proposed), changeset (minor).

The training agent gains a test-only, default-off seam (TRAINING_SALES_DELIVERY_MODES, TRAINING_SALES_SEED_POLICY) so the real SDK runner can grade a faithful single-mode seller. With the env unset the tenant is unchanged.

Results

Training sales tenant, real SDK runner, current compiled source (ADCP_COMPLIANCE_DIR=dist/compliance/latest), 57 storyboards: media_buy_seller, its 54 requires_scenarios, media_buy_seller_guaranteed, and sales_guaranteed.

Seller Failed steps Notes
Guaranteed-only (declares ["guaranteed"]) 0 of 162 Base and every gated scenario grade not_applicable (42 skipped steps, all capability_unsupported). media_buy_seller_guaranteed passes with 0 skipped (the figures here are from the first version; the end-to-end test re-ran the baseline with the two added discovery steps and it passes). sales_guaranteed 15/15 pass. Before this change the same seller: 23 failed, 189 passed, 126 skipped on the 56 pre-existing storyboards.
Mixed, declares nothing 0 of 339 Step results are identical to the run on unmodified source for 54 of 56 storyboards (284 passed / 39 skipped before, 299 / 39 after: the difference is two async scenarios that had timed out on discovery in the earlier run and now pass, no new skips). media_buy_seller_guaranteed is not selected (one capability_unsupported skip). sales_guaranteed clean.
Non-guaranteed-only (declares ["non_guaranteed"]) 14, none introduced here Identical to the same seller on unmodified source (14 vs 16 failed; the two that differ are timeouts in the earlier run). Base index passes; media_buy_seller_guaranteed not selected. The 14 are artifacts of the seam hiding the seeded guaranteed fixtures and the training catalog subset lacking fixed-price and format fields (for example audience_activation_discovery seeds guaranteed fixtures), not of the gates. Mirror gating for non-guaranteed-only sellers is not part of this slice.

The price of gating is coverage: for the guaranteed-only seller the 106 passing steps in inherited scenarios (down from 189) are no longer exercised. The sibling baseline restores a guaranteed flow; the rest returns only with Option B.

Fail-closed hazard and gate semantics

  • Absent media_buy block. The runner applies the schema default for an absent capability only when the parent media_buy object exists in the response and the schema root carries the field. A seller advertising supported_protocols: [media_buy] with no media_buy block grades not_applicable on the base, on the 37 gated scenarios, and on media_buy_seller_guaranteed: no baseline grades it. Reproduced and pinned by a test (no media_buy block: fail-closed); with media_buy: {} and the 3.3 schema root it resolves to both modes. No gate formulation avoids this without an SDK change (present ignores defaults, and one predicate cannot express "undeclared or contains non_guaranteed"). Mitigations: sellers MUST emit a media_buy block (stated in the field description, docs and DR); a new test asserts that every value gate whose path has a source-schema default finds the same default in the built schema, so a bundle cannot ship against a schema root that lacks it. The SDK fix (apply defaults when the parent is absent) is tracked separately.
  • Compound gates fail closed. 21 scenarios moved from a single requires_capability (fail-open when raw capabilities are missing) to requires_all_capabilities (fail-closed in that case) because a gate takes one predicate. This only differs when the capabilities response is unavailable. Not cheap to avoid.
  • Reduced coverage, not equivalence. not_applicable is no coverage and is not a pass. A guaranteed-only seller is graded on the 11-step guaranteed baseline, the ungated inherited scenarios and sales_guaranteed; 37 inherited scenarios are N/A.
  • Abuse path. A mixed seller can declare ["guaranteed"] to skip the 37 gated scenarios. The guaranteed baseline's listing checks only catch a seller that still lists non-guaranteed products; the create-side MUST is attestation-only. The field description calls this a misdeclaration.
  • Delivery-mode mapping. Seller-wide, per delivery-type.json: guaranteed is a reserved delivery commitment (programmatic guaranteed, IO-approved reserved buys); auction, PMP and preferred deals are non_guaranteed unless the seller commits delivery.

If the hold is overridden

Follow-ups a release manager would require before shipping this in 3.3. None is implemented here.

  1. Mark media_buy.supported_delivery_types x-status: experimental and add a registry row media_buy.delivery_mode_declaration.
  2. Remove the "sellers MUST emit a media_buy block" precondition (field description in get-adcp-capabilities-response.json, and the Precondition in get_adcp_capabilities.mdx) in favour of the SDK default fix (apply defaults when the parent object is absent).
  3. Stop gating scenarios that specialisms require, or give the guaranteed baseline equivalents. Checked against the current requires_scenarios lists: six gated scenarios are also required by sales_guaranteed, sales_broadcast_tv and the deprecated sales_proposal_mode (delivery_reporting, measurement_terms_accepted, pending_creatives_to_start, inventory_list_targeting, inventory_list_no_match, invalid_transitions). For a seller that declares ["guaranteed"] and claims one of those specialisms they grade not_applicable, so that specialism loses required coverage; for an undeclared seller nothing changes. Three of them (delivery_reporting, pending_creatives_to_start, invalid_transitions) are also required by sales_catalog_driven, sales_dooh, sales_exchange, sales_retail_media and sales_streaming_tv, and five by sales_non_guaranteed, where a guaranteed-only declaration would be a misdeclaration. Options: exclude those six from the gate list, or add guaranteed-fixture variants to the guaranteed baseline's coverage.

Alternatives NOT picked

  • (a) A literal additive baseline with no change to media_buy_seller. The runner selects one baseline per protocol, so a guaranteed-only seller would still be graded on the base. Hence the declaration plus gates.
  • (b) Adapt every inherited scenario to be delivery-mode-aware (about 25 scenarios, 38 $context.media_buy_id references plus 4 in index.yaml). The complete fix and a guaranteed-only seller then keeps coverage of those scenarios, but it rewrites existing step logic. Deferred to 3.4/4.0.
  • (c) A new incomplete skip reason for a missing approval controller. That is a runner-output-contract and SDK change. Deferred to 3.4; the existing missing_test_controller reason is used.
  • (d) A per-step polling budget instead of controller-forced completion. Human IO latency does not fit the runner's poll window; that is an SDK concern tracked separately.
  • (e) Wait for an adopter failure. The product-expert recommendation is to ship only if a guaranteed-only adopter confirms the need. No adopter has reported a failing guaranteed-only run: the only evidence is the training-seller experiment above, and the one adopter that ran passed 51/51 for the reason described under Problem. If the WG prefers to wait, this PR is a ready-made option rather than a request to merge.

Open questions for the WG

  1. Error code for an undeclared mode. UNSUPPORTED_FEATURE (picked, no new code, matches the precedent in feat(media-buy): gate seller-optimized package controls behind their own capabilities #7752) or a dedicated code, since PRODUCT_UNAVAILABLE ("sold out") is the wrong meaning and nothing delivery-mode specific exists. Recommendation: keep UNSUPPORTED_FEATURE.
  2. Gate breadth. Every base-required scenario that creates buys without a guaranteed fixture is gated, including some not observed to fail for the training seller (they skip today on other capability gates). Narrow to observed failures only, or keep the lint rule? Recommendation: keep the rule, because an unobserved scenario fails the first time a guaranteed-only seller declares its feature.
  3. Schema-default dependence (blocking if shipped). The gates need the runner to resolve the schema default, which fails closed without a media_buy block or without the new schema root. Options: (a) ship only with the SDK fix that applies defaults when the parent is absent; (b) require sellers to emit a media_buy block and ship bundle and schema together (what this PR documents and tests); (c) require the field to be declared explicitly, which breaks every existing seller. Recommendation: (a), otherwise (b); this is the main reason to hold.
  4. Seller-wide vs per-product declaration. The field is seller-wide, so a seller with both kinds of inventory declares both and gets no relief. A per-product declaration would be more precise and a larger design. Recommendation: keep seller-wide for 3.3.
  5. Account setup in the guaranteed baseline. The sibling provisions the account with a controller fixture, as sales_guaranteed does, instead of a sync_accounts phase. Add one? Recommendation: no, account lifecycle is graded by the account scenarios.

Out of scope

Adapting scenario bodies and fixtures; a new incomplete skip reason; polling budgets; a dedicated error code; any change to the sales-guaranteed or sales-non-guaranteed specialism claims.

Backport note

A new schema field plus a new normative requirement (reject undeclared modes) is not patch-eligible under the playbook's "Patch eligibility", so this does not go to 3.1.x or 3.2.x. The only patch-eligible piece is a docs-only grading note, which the compliance catalog already had. The new baseline file is additive conformance-harness content, but it is selected by the new field, so it travels with the schema.

Verification

Run from the repo root with ADCP_COMPLIANCE_DIR=$PWD/dist/compliance/latest and a snapshot of dist/schemas/latest as ADCP_SCHEMA_ROOT, the same as scripts/run-storyboards-matrix.sh.

  • npm run build:schemas, npm run build:compliance (storyboard lints run inside it), npm run test:compliance-snippets (build:compliance -- --check).
  • All test:storyboard-* lints, test:compliance-packaged-refs, test:compliance-source-authority, test:run-storyboards-schema-root, test:storyboard-doc-parity, test:doc-compliance-drift, test:error-codes, test:schemas, test:json-schema, test:example-validation, test:docs-nav, test:contracts, test:mcp-schema-projection, test:test-coverage, typecheck: pass.
  • New: npm run test:delivery-mode-baseline (schema shape, gate shape, the create-without-guaranteed-fixture lint with its allowlist, TEMPORARY tags, the schema-default lint, a missing-controller test, and gate evaluation by the SDK runner for undeclared, both, non-guaranteed-only, guaranteed-only and no-media_buy-block sellers) and npm run test:delivery-mode-e2e (vitest, 3 tests, the three-seller table above for a storyboard subset; 100 to 330 s depending on machine load). Both are in npm test.
  • Existing tests that pinned exact single gates were updated to strip the delivery gate (sdk-runner-capability-gates, seller-optimized-package-controls, timezone-resolution-storyboards), and runner-driven ones now declare both modes in raw_capabilities.
  • Changeset: check-changeset-protocol-scope.cjs origin/main passes; changeset status --since=origin/main reports one minor.
  • Reproduced hazard: an undeclared seller with no media_buy block, or graded without the schema root, grades not_applicable (fail closed: "agent declared no value"); with media_buy: {} and the root it is selected. See "Fail-closed hazard" and open question 3.
  • Merged origin/main three times; the latest merge brought a controller-requires lint that made requires: [controller] mandatory for the guaranteed baseline.
  • Not run here: the full npm test, the server unit suite, and the CI storyboard matrix floors (the workflow is the authority). The three-seller runs used 4 shards per mode because one process runs out of memory around 50 storyboards.

DR-XXXX is a placeholder: the number is assigned at merge.

🤖 Generated with Claude Code

Draft disposition — 2026-10-09

This draft is retained for the stated workstream. Continue on this existing branch; no parallel PR is needed. This disposition does not waive CI, review, migration, or release gates.

bokelley and others added 5 commits October 6, 2026 12:07
…s (adcp#7852 experiment)

Test-only, env-driven (TRAINING_SALES_DELIVERY_MODES / TRAINING_SALES_SEED_POLICY).
Default is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…lers on a matching baseline

Adds media_buy.supported_delivery_types (default both), gates the non-guaranteed baseline and inherited scenarios on it, adds the media_buy_seller_guaranteed sibling baseline, aligns the seam and drifted comments on UNSUPPORTED_FEATURE, and adds lint, gate and end-to-end tests. Refs #7852.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…in the guaranteed baseline

Tags every gate TEMPORARY(adcp#7852), adds a no-media_buy-block gate test and a schema-default lint, moves comply_test_controller to step-level requires_tool, adds discovery checks for the declared mode, and documents the reduced-coverage profile and fail-closed precondition. Refs #7852.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
bokelley and others added 2 commits October 9, 2026 01:17
…-requires lint and gate new scenarios

Adds requires: [controller] to the guaranteed baseline, gates the two new property delivery scenarios, and distinguishes supported_delivery_types from buying_modes in the docs.

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

Copy link
Copy Markdown
Contributor Author

Status: HELD for 3.4. Per WG Session B (2026-10-19) and the release coordination decision, this PR does not ship in 3.3. It stays open as a draft and is the 3.4 candidate: the optional media_buy.supported_delivery_types declaration, the gates on inherited scenarios, and the media_buy_seller_guaranteed baseline. No adopter has reported a delivery-mode failure, and the schema-default fail-closed hazard described in the PR body needs the SDK-side fix first. #7852 carries the decision brief. Not merging; no further changes planned for 3.3.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-wg-review Blocked on a working-group decision — surface in WG meeting agendas

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant