From 043eb2c3a61e490ef0046b13b1c1334b35c529c0 Mon Sep 17 00:00:00 2001 From: Brian O'Kelley Date: Tue, 3 Nov 2026 14:09:29 +0000 Subject: [PATCH 1/2] fix(compliance): honor optional discovery on the 3.1 line --- .../fix-optional-discovery-conformance.md | 17 +++ package-lock.json | 8 +- package.json | 2 +- scripts/lint-storyboard-validations-paths.cjs | 3 +- .../scenarios/product_filter_behavior.yaml | 35 +++-- .../provenance_audit_observation.yaml | 18 +++ .../scenarios/provenance_enforcement.yaml | 12 ++ .../scenarios/provenance_truth_of_claim.yaml | 12 ++ .../sales-non-guaranteed/index.yaml | 128 ++++++++--------- .../universal/runner-output-contract.yaml | 10 +- .../source/universal/storyboard-schema.yaml | 7 +- tests/cli-scenario-fixtures.test.cjs | 6 + tests/lint-storyboard-check-enum.test.cjs | 2 +- tests/optional-discovery-maintenance.test.cjs | 133 ++++++++++++++++++ tests/sdk-runner/package.json | 2 +- 15 files changed, 300 insertions(+), 95 deletions(-) create mode 100644 .changeset/fix-optional-discovery-conformance.md create mode 100644 tests/optional-discovery-maintenance.test.cjs diff --git a/.changeset/fix-optional-discovery-conformance.md b/.changeset/fix-optional-discovery-conformance.md new file mode 100644 index 00000000000..ba456823f56 --- /dev/null +++ b/.changeset/fix-optional-discovery-conformance.md @@ -0,0 +1,17 @@ +--- +"adcontextprotocol": patch +--- + +Correct maintained discovery conformance without changing the 3.1 wire schemas. +Replace product-count assumptions with explicit negative-control exclusion, +requiring executable runner support before fixtures are seeded. Auction discovery +no longer requires optional price guidance: this fixture-backed flow chooses buyer +bids of 6 and 16 against the seeded floors of 5 and 15, then reallocates budgets +without changing accepted bids. Discovery binds the exact seeded products and +pricing options independently of catalog order. + +Keep provenance checks behind their explicit 3.3 capability declaration, so +3.1-pinned sellers report that coverage unavailable instead of failing optional +policy publication. Retain complete 3.1 account references on audit queries and +consistent sandbox identity on auction fixtures. No new capability field is +added to the 3.1 schemas. diff --git a/package-lock.json b/package-lock.json index b9096cd71bb..890dbe10726 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25209,7 +25209,7 @@ "dev": true, "dependencies": { "@a2a-js/sdk": "1.0.1", - "@adcp/sdk": "17.0.0-beta.8", + "@adcp/sdk": "17.0.0-beta.15", "@modelcontextprotocol/sdk": "^1.31.0" } }, @@ -25244,9 +25244,9 @@ } }, "tests/sdk-runner/node_modules/@adcp/sdk": { - "version": "17.0.0-beta.8", - "resolved": "https://registry.npmjs.org/@adcp/sdk/-/sdk-17.0.0-beta.8.tgz", - "integrity": "sha512-UQ0S6jE8kfjK3WU4mjNsmsCkq9sP7RVrpL6BdfAwwbPYcsHhH7CrAEAwf4xWSGb91MFV5C38hhwy1q3TeUq1qw==", + "version": "17.0.0-beta.15", + "resolved": "https://registry.npmjs.org/@adcp/sdk/-/sdk-17.0.0-beta.15.tgz", + "integrity": "sha512-zR40xVU7yO5VgNNoTThIiXNB8L55QccV9ZtmwRSYOm/TX90cuSyLvDM7zQgaaK6tjRSLh6N5DVwXayC00kmshQ==", "dev": true, "license": "Apache-2.0", "workspaces": [ diff --git a/package.json b/package.json index 00365675c0d..6c1f2645116 100644 --- a/package.json +++ b/package.json @@ -135,7 +135,7 @@ "dev:docs": "node scripts/dev-docs.mjs", "docs:example-coverage": "node scripts/docs-example-coverage.cjs", "docs:json-field-audit": "node scripts/docs-json-field-audit.cjs", - "test:auction-only-compliance": "node --test --test-concurrency=1 --test-timeout=30000 tests/auction-only-seller-compliance.test.cjs tests/currency-filter-compliance.test.cjs tests/optional-seller-capabilities.test.cjs tests/optional-vendor-capabilities.test.cjs tests/optional-canonical-capabilities.test.cjs tests/canonical-compatibility-slices.test.cjs tests/product-filter-auction-compliance.test.cjs tests/governance-recovery-pricing-scope.test.cjs" + "test:auction-only-compliance": "node --test --test-concurrency=1 --test-timeout=30000 tests/auction-only-seller-compliance.test.cjs tests/currency-filter-compliance.test.cjs tests/optional-seller-capabilities.test.cjs tests/optional-vendor-capabilities.test.cjs tests/optional-canonical-capabilities.test.cjs tests/canonical-compatibility-slices.test.cjs tests/product-filter-auction-compliance.test.cjs tests/governance-recovery-pricing-scope.test.cjs tests/optional-discovery-maintenance.test.cjs" }, "dependencies": { "@adcp/sdk": "9.6.2", diff --git a/scripts/lint-storyboard-validations-paths.cjs b/scripts/lint-storyboard-validations-paths.cjs index 1bf0a1d69f8..57e041a181b 100644 --- a/scripts/lint-storyboard-validations-paths.cjs +++ b/scripts/lint-storyboard-validations-paths.cjs @@ -50,6 +50,7 @@ const PATH_BEARING_CHECKS = new Set([ 'field_absent', 'field_pattern', 'field_contains', + 'field_excludes', 'envelope_field_present', 'envelope_field_absent', 'envelope_field_pattern', @@ -434,7 +435,7 @@ function lintDoc(doc, filePath, allowlist = []) { for (const { v, index: i } of pathValidations) { const rawPath = v.path; const segments = parsePath(rawPath); - if (segments.includes('*') && v.check !== 'field_contains') { + if (segments.includes('*') && !['field_contains', 'field_excludes'].includes(v.check)) { violations.push({ rule: 'wildcard_unsupported_check', filePath, diff --git a/static/compliance/source/protocols/media-buy/scenarios/product_filter_behavior.yaml b/static/compliance/source/protocols/media-buy/scenarios/product_filter_behavior.yaml index d3b43a32624..9393e271745 100644 --- a/static/compliance/source/protocols/media-buy/scenarios/product_filter_behavior.yaml +++ b/static/compliance/source/protocols/media-buy/scenarios/product_filter_behavior.yaml @@ -7,6 +7,7 @@ summary: Verifies schema-valid get_products filters affect brief curation, whole track: media_buy requires: - controller + - field_excludes_runner required_tools: - get_products - comply_test_controller @@ -88,6 +89,8 @@ phases: stateful: true sample_request: buying_mode: brief + brand: + domain: acmeoutdoor.example brief: Curate premium inventory for outdoor enthusiasts. filters: channels: @@ -115,16 +118,17 @@ phases: validations: - check: response_schema description: Response matches get-products-response.json - - check: field_value - path: products[0].channels[0] + - check: field_contains + path: products[0].channels[*] value: olv description: Returned product has the requested channel - check: field_value path: products[0].delivery_type value: non_guaranteed description: Returned product has the requested delivery type - - check: field_absent - path: products[1] + - check: field_excludes + path: products[*].product_id + value: filter_behavior_negative_channel description: The display-channel negative control is excluded - check: field_value path: context.expected_negative_delivery_types @@ -140,6 +144,8 @@ phases: stateful: true sample_request: buying_mode: brief + brand: + domain: acmeoutdoor.example brief: Curate premium inventory for outdoor enthusiasts. filters: channels: @@ -184,6 +190,8 @@ phases: stateful: true sample_request: buying_mode: wholesale + brand: + domain: acmeoutdoor.example filters: channels: - olv @@ -200,7 +208,7 @@ phases: expected_negative_delivery_types: - guaranteed expected: | - Return only the seeded non-guaranteed OLV product. Returning the + Return matching non-guaranteed OLV products. Returning the display-channel negative control reveals an ignored channel filter. context_outputs: - key: filter_behavior_wholesale_negative_delivery_types @@ -208,20 +216,21 @@ phases: validations: - check: response_schema description: Response matches get-products-response.json - - check: field_value - path: products[0].product_id + - check: field_contains + path: products[*].product_id value: filter_behavior_matching_olv description: The matching seeded product is returned - - check: field_value - path: products[0].channels[0] + - check: field_contains + path: products[0].channels[*] value: olv description: Returned wholesale product has the requested channel - check: field_value path: products[0].delivery_type value: non_guaranteed description: Returned wholesale product has the requested delivery type - - check: field_absent - path: products[1] + - check: field_excludes + path: products[*].product_id + value: filter_behavior_negative_channel description: The display-channel negative control is excluded - check: field_value path: context.expected_negative_delivery_types @@ -237,6 +246,8 @@ phases: stateful: true sample_request: buying_mode: wholesale + brand: + domain: acmeoutdoor.example filters: channels: - olv @@ -281,6 +292,8 @@ phases: stateful: true sample_request: buying_mode: refine + brand: + domain: acmeoutdoor.example refine: - scope: product product_id: $context.filter_behavior_product_id diff --git a/static/compliance/source/protocols/media-buy/scenarios/provenance_audit_observation.yaml b/static/compliance/source/protocols/media-buy/scenarios/provenance_audit_observation.yaml index 08beb119ff8..555912609fd 100644 --- a/static/compliance/source/protocols/media-buy/scenarios/provenance_audit_observation.yaml +++ b/static/compliance/source/protocols/media-buy/scenarios/provenance_audit_observation.yaml @@ -4,12 +4,24 @@ title: "Seller accepts a provenance carve-out claim surfaced as an audit observa category: media_buy_seller summary: "Buyer submits AI-assisted creatives with human_oversight directed/edited and disclosure.required false. Seller invokes an on-list verifier, records OVERSIGHT_DISCLOSURE_CARVEOUT_CLAIMED audit observations, and accepts the creatives rather than treating the observations as rejections." track: creative +requires: + - controller + +requires_capability: + path: creative.supports_provenance + equals: true + required_tools: - get_products - sync_creatives - comply_test_controller narrative: | + This opt-in capability was introduced in AdCP 3.3. A creative library alone + does not establish provenance enforcement support. Earlier wire releases + cannot publish this declaration, so this maintained corpus reports the gated + provenance coverage as unavailable rather than failing optional behavior. + This scenario exercises the non-rejection half of provenance verification. The buyer claims editorial-responsibility carve-outs by submitting AI- assisted creatives with human_oversight: directed/edited and @@ -322,6 +334,9 @@ phases: to expose this internal audit log. sample_request: account: + brand: + domain: "acmeoutdoor.example" + operator: "pinnacle-agency.example" sandbox: true scenario: "query_provenance_audit_observations" params: @@ -362,6 +377,9 @@ phases: human_oversight value. sample_request: account: + brand: + domain: "acmeoutdoor.example" + operator: "pinnacle-agency.example" sandbox: true scenario: "query_provenance_audit_observations" params: diff --git a/static/compliance/source/protocols/media-buy/scenarios/provenance_enforcement.yaml b/static/compliance/source/protocols/media-buy/scenarios/provenance_enforcement.yaml index 787a21963c1..a7dbab97224 100644 --- a/static/compliance/source/protocols/media-buy/scenarios/provenance_enforcement.yaml +++ b/static/compliance/source/protocols/media-buy/scenarios/provenance_enforcement.yaml @@ -4,11 +4,23 @@ title: "Seller enforces provenance_requirements on sync_creatives" category: media_buy_seller summary: "Seller publishes provenance_requirements + accepted_verifiers on a product. Four structural rejections (no provenance, missing digital_source_type, off-list verifier, missing disclosure), then a corrected resubmission with on-list verifier is accepted." track: creative +requires: + - controller + +requires_capability: + path: creative.supports_provenance + equals: true + required_tools: - get_products - sync_creatives narrative: | + This opt-in capability was introduced in AdCP 3.3. A creative library alone + does not establish provenance enforcement support. Earlier wire releases + cannot publish this declaration, so this maintained corpus reports the gated + provenance coverage as unavailable rather than failing optional behavior. + creative_policy carries three load-bearing fields for provenance enforcement: provenance_required (some provenance must be attached), provenance_requirements (which fields must be present), and accepted_verifiers (which governance agents diff --git a/static/compliance/source/protocols/media-buy/scenarios/provenance_truth_of_claim.yaml b/static/compliance/source/protocols/media-buy/scenarios/provenance_truth_of_claim.yaml index 10520df48af..a61037b2a0a 100644 --- a/static/compliance/source/protocols/media-buy/scenarios/provenance_truth_of_claim.yaml +++ b/static/compliance/source/protocols/media-buy/scenarios/provenance_truth_of_claim.yaml @@ -4,11 +4,23 @@ title: "Seller refutes a buyer's provenance claim via on-list verifier" category: media_buy_seller summary: "Buyer attaches a digital_source_type claim. Seller invokes get_creative_features against an on-list verifier (creative_policy.accepted_verifiers); when the verifier contradicts the claim, seller rejects with PROVENANCE_CLAIM_CONTRADICTED carrying audit-safe error.details." track: creative +requires: + - controller + +requires_capability: + path: creative.supports_provenance + equals: true + required_tools: - get_products - sync_creatives narrative: | + This opt-in capability was introduced in AdCP 3.3. A creative library alone + does not establish provenance enforcement support. Earlier wire releases + cannot publish this declaration, so this maintained corpus reports the gated + provenance coverage as unavailable rather than failing optional behavior. + This is the truth-of-claim half of the provenance enforcement contract. The structural-rejection half (media_buy_seller/provenance_enforcement) exercises the PROVENANCE_*_MISSING / PROVENANCE_VERIFIER_NOT_ACCEPTED diff --git a/static/compliance/source/specialisms/sales-non-guaranteed/index.yaml b/static/compliance/source/specialisms/sales-non-guaranteed/index.yaml index b93637d595f..c3425bec879 100644 --- a/static/compliance/source/specialisms/sales-non-guaranteed/index.yaml +++ b/static/compliance/source/specialisms/sales-non-guaranteed/index.yaml @@ -36,7 +36,7 @@ narrative: | require IOs or human approval — the buyer sets a bid price and budget, and your platform runs the auction. Delivery is best-effort based on bid competitiveness. - The buyer discovers products with bid guidance and any declared floors, creates a buy + The buyer discovers auction products and any declared floors, creates a buy with bid prices per package, monitors win rates and pacing, and adjusts bids or budgets in-flight to optimize performance. @@ -76,7 +76,7 @@ fixtures: operator: "sales-non-guaranteed.pinnacle-agency.example" billing: "operator" status: "active" - sandbox: false + sandbox: true products: - product_id: "sports_display_auction" delivery_type: "non_guaranteed" @@ -94,17 +94,22 @@ fixtures: pricing_model: "cpm" currency: "USD" floor_price: 5.0 - price_guidance: - p50: 6.0 - p75: 7.0 - product_id: "outdoor_video_auction" pricing_option_id: "cpm_auction" pricing_model: "cpm" currency: "USD" floor_price: 15.0 - price_guidance: - p50: 16.0 - p75: 18.0 + +context: + account: + brand: + domain: "acmeoutdoor.example" + operator: "sales-non-guaranteed.pinnacle-agency.example" + sandbox: true + first_product_id: "sports_display_auction" + first_pricing_option_id: "cpm_auction" + second_product_id: "outdoor_video_auction" + second_pricing_option_id: "cpm_auction" phases: - id: capability_discovery @@ -163,8 +168,8 @@ phases: title: "Send a brief for non-guaranteed inventory" narrative: | The buyer describes what they want. Your platform returns non-guaranteed - products with auction mechanics: floor prices, recommended bid ranges, - estimated win rates at different bid levels, and available audience segments. + products with auction mechanics and available audience segments. Floor + prices, recommended bid ranges, and win-rate forecasts are optional. task: get_products schema_ref: "media-buy/get-products-request.json" response_schema_ref: "media-buy/get-products-response.json" @@ -176,13 +181,15 @@ phases: - product_id: unique identifier - name and description - delivery_type: non_guaranteed - - pricing_models: auction-based pricing with bid guidance and any declared floor_price + - pricing_models: auction-based pricing; price guidance is optional - forecast: estimated impressions at different bid levels (best-effort) - creative_format_ids: required creative formats - targeting: available audiences and contexts sample_request: buying_mode: "brief" + brand: + domain: "acmeoutdoor.example" brief: "Display and video inventory across sports and outdoor lifestyle sites. Q2 flight, $25K budget. Adults 25-54, US. Auction-based, looking for competitive CPMs." filters: delivery_type: "non_guaranteed" @@ -191,53 +198,36 @@ phases: brand: domain: "acmeoutdoor.example" operator: "sales-non-guaranteed.pinnacle-agency.example" + sandbox: true context: correlation_id: "sales_non_guaranteed--get_products_brief" - context_outputs: - - path: "products[0].product_id" - key: "first_product_id" - - path: "products[0].pricing_options[0].pricing_option_id" - key: "first_pricing_option_id" - - path: "products[0].pricing_options[0].price_guidance.p50" - key: "first_bid_price" - - path: "products[0].pricing_options[0].price_guidance.p75" - key: "first_updated_bid_price" - - path: "products[1].product_id" - key: "second_product_id" - - path: "products[1].pricing_options[0].pricing_option_id" - key: "second_pricing_option_id" - - path: "products[1].pricing_options[0].price_guidance.p50" - key: "second_bid_price" - - path: "products[1].pricing_options[0].price_guidance.p75" - key: "second_updated_bid_price" validations: - check: response_schema description: "Response matches get-products-response.json schema" - check: field_present path: "products" description: "Response contains a products array" - - check: field_present - path: "products[0].product_id" - description: "Each product has a product_id" - - check: field_present - path: "products[0].delivery_type" - description: "Each product declares delivery_type: non_guaranteed" - - check: field_present - path: "products[1].product_id" - description: "At least two auction products are available for the multi-package buy" - - check: field_present - path: "products[0].pricing_options[0].price_guidance.p50" - description: "First auction pricing option declares median bid guidance used as the initial bid" - - check: field_present - path: "products[0].pricing_options[0].price_guidance.p75" - description: "First auction pricing option declares higher bid guidance used for the update" - - check: field_present - path: "products[1].pricing_options[0].price_guidance.p50" - description: "Second auction pricing option declares median bid guidance used as the initial bid" - - check: field_present - path: "products[1].pricing_options[0].price_guidance.p75" - description: "Second auction pricing option declares higher bid guidance used for the update" + - check: field_contains + path: "products[*]" + value: + product_id: "sports_display_auction" + format_ids: + - id: "display_300x250" + delivery_type: "non_guaranteed" + pricing_options: + - pricing_option_id: "cpm_auction" + description: "Discovery contains the seeded display auction and its pricing option" + - check: field_contains + path: "products[*]" + value: + product_id: "outdoor_video_auction" + format_ids: + - id: "video_30s" + delivery_type: "non_guaranteed" + pricing_options: + - pricing_option_id: "cpm_auction" + description: "Discovery contains the seeded video auction and its pricing option" - check: field_present path: "context" @@ -246,15 +236,6 @@ phases: path: "context.correlation_id" value: "sales_non_guaranteed--get_products_brief" description: "Context correlation_id returned unchanged" - - check: field_present - path: "products[0].format_ids" - description: "Products include format_ids for creative requirements" - - check: field_present - path: "products[0].format_ids[0].agent_url" - description: "Format IDs include agent_url — must match this agent's URL" - - check: field_present - path: "products[0].format_ids[0].id" - description: "Format IDs include id — must be accepted back in sync_creatives" - id: create_buy title: "Create non-guaranteed buy" narrative: | @@ -297,18 +278,19 @@ phases: brand: domain: "acmeoutdoor.example" operator: "sales-non-guaranteed.pinnacle-agency.example" + sandbox: true start_time: "asap" end_time: "2099-06-30T23:59:59Z" packages: - product_id: "$context.first_product_id" budget: 10000 - bid_price: "$context.first_bid_price" + bid_price: 6.0 pricing_option_id: "$context.first_pricing_option_id" creative_assignments: - creative_id: "display_trail_pro_300x250" - product_id: "$context.second_product_id" budget: 15000 - bid_price: "$context.second_bid_price" + bid_price: 16.0 pricing_option_id: "$context.second_pricing_option_id" creative_assignments: - creative_id: "video_30s_trail_pro" @@ -379,6 +361,7 @@ phases: brand: domain: "acmeoutdoor.example" operator: "sales-non-guaranteed.pinnacle-agency.example" + sandbox: true media_buy_ids: - "$context.media_buy_id" @@ -399,19 +382,18 @@ phases: value: "sales_non_guaranteed--get_media_buys_pacing" description: "Context correlation_id returned unchanged" - id: adjust_bids - title: "Adjust bids and budget" + title: "Reallocate package budgets" narrative: | - Based on pacing data, the buyer adjusts bids or budgets in-flight. If a package - is underspending (low win rate), the buyer increases the bid. If a package is - overspending, the buyer decreases the bid or caps the daily budget. + The buyer reallocates package budgets while preserving the previously accepted + bids. This fixture-backed flow uses buyer bids of 6 and 16 above the seeded + floors of 5 and 15; optional seller price guidance is not required. steps: - id: update_media_buy - title: "Update bid prices and budget" + title: "Update budgets while preserving accepted bids" narrative: | - The buyer modifies the active media buy — adjusting bid prices, reallocating - budget between packages, or changing daily spend caps. Your platform applies - the updates immediately to the live auction participation. + The buyer reallocates budget between packages without changing their + previously accepted bids. Your platform persists the complete package state. task: update_media_buy schema_ref: "media-buy/update-media-buy-request.json" response_schema_ref: "media-buy/update-media-buy-response.json" @@ -421,7 +403,7 @@ phases: expected: | Apply the updates and return the modified media buy state: - media_buy_id: matches the existing buy - - affected_packages: full post-update package objects reflecting new bids and budgets + - affected_packages: full post-update package objects reflecting unchanged bids and updated budgets - media_buy_status: active if lifecycle state is emitted - Changes take effect immediately for subsequent auctions @@ -430,13 +412,12 @@ phases: brand: domain: "acmeoutdoor.example" operator: "sales-non-guaranteed.pinnacle-agency.example" + sandbox: true media_buy_id: "$context.media_buy_id" packages: - package_id: "$context.first_package_id" - bid_price: "$context.first_updated_bid_price" budget: 12000 - package_id: "$context.second_package_id" - bid_price: "$context.second_updated_bid_price" budget: 13000 idempotency_key: "$generate:uuid_v4#sales_non_guaranteed_adjust_bids_update_media_buy" @@ -455,7 +436,7 @@ phases: package_id: "$context.first_package_id" product_id: "$context.first_product_id" pricing_option_id: "$context.first_pricing_option_id" - bid_price: "$context.first_updated_bid_price" + bid_price: 6.0 budget: 12000 description: "First updated package includes complete post-update bid and budget state" - check: field_contains @@ -464,7 +445,7 @@ phases: package_id: "$context.second_package_id" product_id: "$context.second_product_id" pricing_option_id: "$context.second_pricing_option_id" - bid_price: "$context.second_updated_bid_price" + bid_price: 16.0 budget: 13000 description: "Second updated package includes complete post-update bid and budget state" - check: field_present @@ -514,6 +495,7 @@ phases: brand: domain: "acmeoutdoor.example" operator: "sales-non-guaranteed.pinnacle-agency.example" + sandbox: true media_buy_ids: - "$context.media_buy_id" include_package_daily_breakdown: true diff --git a/static/compliance/source/universal/runner-output-contract.yaml b/static/compliance/source/universal/runner-output-contract.yaml index 0328646d169..f290b648351 100644 --- a/static/compliance/source/universal/runner-output-contract.yaml +++ b/static/compliance/source/universal/runner-output-contract.yaml @@ -26,7 +26,7 @@ # --- Schema definition --- id: runner_output_contract -version: "2.14.0" +version: "2.15.0" title: "Runner output contract" summary: "Required failure-detail shape that AdCP storyboard runners MUST emit so implementors can self-diagnose validation failures." @@ -50,6 +50,7 @@ authored_check_kinds: - field_value - field_value_or_absent - field_contains + - field_excludes - status_code - http_status - http_status_in @@ -199,7 +200,7 @@ validation_result: # envelope_field_present | # envelope_field_absent | # envelope_field_pattern | field_value | - # field_value_or_absent | field_contains | + # field_value_or_absent | field_contains | field_excludes | # status_code | http_status | http_status_in | # error_code | on_401_require_header | # resource_equals_agent_url | any_of | refs_resolve | @@ -264,6 +265,9 @@ validation_result: # value matches; object/array # expectations are matched as # deep subsets + # field_excludes → { excludes: value } or allowed_values; + # no resolved terminal may match using + # field_contains deep-subset semantics # field_present → the path that should resolve # field_absent → null (the field must not be present) # field_pattern → object { pattern } where pattern is @@ -333,6 +337,8 @@ validation_result: # field_contains → array of values resolved at # path; empty when the path # produced no terminal values + # field_excludes → array of resolved values, + # using field_contains matching # field_present → null (the field was missing) # or the observed non-object # value diff --git a/static/compliance/source/universal/storyboard-schema.yaml b/static/compliance/source/universal/storyboard-schema.yaml index b2f634c49b6..13e407628df 100644 --- a/static/compliance/source/universal/storyboard-schema.yaml +++ b/static/compliance/source/universal/storyboard-schema.yaml @@ -148,7 +148,7 @@ # coverage totals of agents that never claimed the capability. # # requires: string[] (optional — storyboard-level runtime requirement gate. -# Known values: controller | seeded_state | real_wire | collect_product_pages_runner | webhook_receiver | multi_agent (forward-compat: +# Known values: controller | seeded_state | real_wire | collect_product_pages_runner | field_excludes_runner | webhook_receiver | multi_agent (forward-compat: # unrecognized values are NOT schema violations — runners emit # requirement_unmet at runtime; see Forward compatibility below). # Default when absent: [real_wire] — untagged storyboards run unchanged. @@ -165,6 +165,11 @@ # requirement so older runners report requirement_unmet before # fixture mutation instead of silently checking only one page. # +# field_excludes_runner — intrinsic support for complete-response negative +# membership checks. Storyboards using field_excludes MUST +# declare this requirement so older runners skip before +# fixture mutation rather than ignoring an unknown check. +# # controller — gate on agent advertising comply_test_controller. # Available when the agent's get_adcp_capabilities response # includes comply_test_controller in its tool list. When diff --git a/tests/cli-scenario-fixtures.test.cjs b/tests/cli-scenario-fixtures.test.cjs index 1c2d2e68e5b..816b161bec9 100644 --- a/tests/cli-scenario-fixtures.test.cjs +++ b/tests/cli-scenario-fixtures.test.cjs @@ -135,6 +135,12 @@ async function probeAccountPrerequisite(name, accounts, { omitFixture = false, r validations: [{ check: 'field_value', path: 'account_ready', value: true }], }] }], }; + // This clone isolates account provisioning, including failed prerequisites. + // Real 3.1 provenance coverage remains gated before mutation; the separate + // optional-discovery-maintenance tests exercise that production behavior. + if (storyboard.requires_capability?.path === 'creative.supports_provenance') { + delete storyboard.requires_capability; + } const calls = []; const tools = ['get_adcp_capabilities', 'comply_test_controller', 'sync_creatives']; const key = ref => JSON.stringify([ref.brand.domain, ref.operator, ref.sandbox === true]); diff --git a/tests/lint-storyboard-check-enum.test.cjs b/tests/lint-storyboard-check-enum.test.cjs index c806128dcdb..0fb9ea7c1cd 100644 --- a/tests/lint-storyboard-check-enum.test.cjs +++ b/tests/lint-storyboard-check-enum.test.cjs @@ -39,7 +39,7 @@ test('authored_check_kinds enum loads from runner-output-contract.yaml', () => { const kinds = loadKnownCheckKinds(); // Spot-check a few load-bearing entries — keep this tight so the test // doesn't have to track every authored kind. Full enum is the contract. - for (const expected of ['response_schema', 'field_present', 'field_pattern', 'field_contains', 'envelope_field_pattern', 'upstream_traffic']) { + for (const expected of ['response_schema', 'field_present', 'field_pattern', 'field_contains', 'field_excludes', 'envelope_field_pattern', 'upstream_traffic']) { assert.ok(kinds.has(expected), `expected "${expected}" in authored_check_kinds`); } // Synthesized codes MUST NOT be in the authored enum. diff --git a/tests/optional-discovery-maintenance.test.cjs b/tests/optional-discovery-maintenance.test.cjs new file mode 100644 index 00000000000..95308a7f789 --- /dev/null +++ b/tests/optional-discovery-maintenance.test.cjs @@ -0,0 +1,133 @@ +'use strict'; + +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const test = require('node:test'); + +// The maintained application uses SDK 9.6.2. Do not mistake the separate +// fixture-test-sdk's newer runner for proof that this production pin works. +const sdkModule = process.env.ADCP_MAINTENANCE_SDK_TEST_MODULE || '@adcp/sdk/testing'; +const { runStoryboard, parseStoryboard } = require(sdkModule); +const sdkPackage = path.resolve(path.dirname(require.resolve(sdkModule)), '../../../package.json'); +const sourceRoot = path.join(__dirname, '../static/compliance/source'); +const load = relative => parseStoryboard(fs.readFileSync(path.join(sourceRoot, relative), 'utf8')); +const scenario = name => load(`protocols/media-buy/scenarios/${name}.yaml`); + +function options(client) { + const tools = ['get_products', 'create_media_buy', 'update_media_buy', 'sync_creatives', 'comply_test_controller']; + return { + protocol: 'mcp', + _serverAdcpVersion: '3.1.31', + schemaRoot: path.join(__dirname, '../dist/schemas/3.1.31'), + agentTools: tools, + _profile: { tools, raw_capabilities: { creative: { has_creative_library: true } } }, + _controllerCapabilities: { detected: true, scenarios: ['seed_product', 'seed_pricing_option', 'seed_account'] }, + _client: client, + }; +} + +test('the maintained production runner reports unsupported exclusion coverage before mutations', async () => { + assert.equal(JSON.parse(fs.readFileSync(sdkPackage, 'utf8')).version, '9.6.2'); + let calls = 0; + const result = await runStoryboard('https://seller.example/mcp', scenario('product_filter_behavior'), options({ + resetContext() {}, + async executeTask() { calls++; throw new Error('unsupported coverage must not seed'); }, + async getProducts() { calls++; throw new Error('unsupported coverage must not discover'); }, + })); + assert.equal(result.passed_count, 0); + assert.equal(result.failed_count, 0); + assert.equal(result.skipped_count, 1); + assert.match(JSON.stringify(result), /field_excludes_runner/); + assert.equal(calls, 0); +}); + +test('a creative library alone does not run provenance mutations on the maintained wire', async () => { + for (const name of ['provenance_enforcement', 'provenance_truth_of_claim', 'provenance_audit_observation']) { + let calls = 0; + const result = await runStoryboard('https://seller.example/mcp', scenario(name), options({ + resetContext() {}, + async executeTask() { calls++; throw new Error('unsupported provenance must not seed'); }, + async getProducts() { calls++; throw new Error('unsupported provenance must not discover'); }, + async syncCreatives() { calls++; throw new Error('unsupported provenance must not submit'); }, + })); + assert.equal(result.passed_count, 0, name); + assert.equal(result.failed_count, 0, name); + assert.equal(result.skipped_count, 1, name); + assert.match(JSON.stringify(result), /supports_provenance/); + assert.equal(calls, 0, name); + } +}); + +test('SDK 9.6.2 grades fixture-backed auction discovery, buyer bids, and budget-only updates without guidance', async () => { + const storyboard = load('specialisms/sales-non-guaranteed/index.yaml'); + const phases = storyboard.phases.filter(phase => ['get_products_brief', 'create_media_buy', 'update_media_buy'] + .some(id => phase.steps.some(step => step.id === id))); + storyboard.phases = phases.map(phase => ({ ...phase, steps: phase.steps.filter(step => + ['get_products_brief', 'create_media_buy', 'update_media_buy'].includes(step.id)) })); + // Preload the controller-backed catalog and isolate these three real runner + // steps. This is construction/grading coverage, not a substitute for the + // independent response-schema and upstream-traffic integration suites. + delete storyboard.prerequisites; + delete storyboard.fixtures; + delete storyboard.invariants; + for (const phase of storyboard.phases) for (const step of phase.steps) { + step.validations = step.validations.filter(validation => + !['response_schema', 'upstream_traffic'].includes(validation.check)); + } + const display = { + product_id: 'sports_display_auction', delivery_type: 'non_guaranteed', + format_ids: [{ id: 'display_300x250', agent_url: 'https://seller.example/mcp' }], + pricing_options: [{ pricing_option_id: 'cpm_auction', pricing_model: 'cpm', currency: 'USD', floor_price: 5 }], + }; + const video = { + product_id: 'outdoor_video_auction', delivery_type: 'non_guaranteed', + format_ids: [{ id: 'video_30s', agent_url: 'https://seller.example/mcp' }], + pricing_options: [{ pricing_option_id: 'cpm_auction', pricing_model: 'cpm', currency: 'USD', floor_price: 15 }], + }; + let created; + let updated; + const runOptions = options({ + resetContext() {}, + async getProducts(request) { + assert.equal(request.account.sandbox, true); + return { success: true, data: { + // Unrelated inventory can precede both fixtures and have a higher floor. + products: [{ product_id: 'unrelated-first', pricing_options: [{ pricing_model: 'cpm', floor_price: 1000 }] }, video, display], + context: request.context, + } }; + }, + async createMediaBuy(request) { + assert.equal(request.account.sandbox, true); + created = structuredClone(request); + assert.deepEqual(request.packages.map(pkg => [pkg.product_id, pkg.pricing_option_id, pkg.bid_price]), [ + ['sports_display_auction', 'cpm_auction', 6], + ['outdoor_video_auction', 'cpm_auction', 16], + ]); + return { success: true, data: { + media_buy_id: 'fixture-buy', revision: 1, status: 'active', confirmed_at: '2026-01-01T00:00:00Z', + packages: request.packages.map((pkg, index) => ({ ...pkg, package_id: `pkg_${index}` })), + context: request.context, + } }; + }, + async updateMediaBuy(request) { + assert.equal(request.account.sandbox, true); + updated = structuredClone(request); + assert.ok(request.packages.every(pkg => pkg.bid_price === undefined)); + return { success: true, data: { + media_buy_id: 'fixture-buy', revision: 2, media_buy_status: 'active', + affected_packages: created.packages.map((pkg, index) => ({ + ...pkg, package_id: `pkg_${index}`, budget: request.packages[index].budget, + })), + context: request.context, + } }; + }, + }); + runOptions.brand = { domain: 'acmeoutdoor.example' }; + const result = await runStoryboard('https://seller.example/mcp', storyboard, runOptions); + assert.equal(result.overall_passed, true, JSON.stringify(result)); + assert.equal(result.passed_count, 3, JSON.stringify(result)); + assert.equal(result.failed_count, 0); + assert.equal(result.skipped_count, 0); + assert.deepEqual(updated.packages.map(pkg => pkg.budget), [12000, 13000]); +}); diff --git a/tests/sdk-runner/package.json b/tests/sdk-runner/package.json index 26eca5aa5be..43f81056e5e 100644 --- a/tests/sdk-runner/package.json +++ b/tests/sdk-runner/package.json @@ -7,7 +7,7 @@ "./testing": "./testing.cjs" }, "dependencies": { - "@adcp/sdk": "17.0.0-beta.8", + "@adcp/sdk": "17.0.0-beta.15", "@a2a-js/sdk": "1.0.1", "@modelcontextprotocol/sdk": "^1.31.0" } From 1c74ea1fbc5c7db503e1b65e099319ebe203e634 Mon Sep 17 00:00:00 2001 From: Brian O'Kelley Date: Tue, 3 Nov 2026 15:02:45 +0000 Subject: [PATCH 2/2] fix(compliance): bind maintained fixtures and preserve auction bids --- .../fix-optional-discovery-conformance.md | 10 +- server/src/training-agent/task-handlers.ts | 1 + ...ning-agent-maintenance-negotiation.test.ts | 99 +++++++++++++++++++ .../vendor_metric_catalog_precondition.yaml | 14 +++ .../sales-non-guaranteed/index.yaml | 21 ++-- .../canonical-format-validate-input.yaml | 8 ++ tests/cli-scenario-fixtures.test.cjs | 27 +++++ tests/optional-discovery-maintenance.test.cjs | 56 ++++++++--- 8 files changed, 212 insertions(+), 24 deletions(-) diff --git a/.changeset/fix-optional-discovery-conformance.md b/.changeset/fix-optional-discovery-conformance.md index ba456823f56..d492fda8301 100644 --- a/.changeset/fix-optional-discovery-conformance.md +++ b/.changeset/fix-optional-discovery-conformance.md @@ -8,10 +8,18 @@ requiring executable runner support before fixtures are seeded. Auction discover no longer requires optional price guidance: this fixture-backed flow chooses buyer bids of 6 and 16 against the seeded floors of 5 and 15, then reallocates budgets without changing accepted bids. Discovery binds the exact seeded products and -pricing options independently of catalog order. +pricing options independently of catalog order through a wholesale read; a +curated brief may legitimately rank other products ahead of the fixtures. +If that discovery fails, skip the dependent creation and update steps. +The reference seller now echoes preserved bids in budget-update responses, +matching the existing main-line behavior. Keep provenance checks behind their explicit 3.3 capability declaration, so 3.1-pinned sellers report that coverage unavailable instead of failing optional policy publication. Retain complete 3.1 account references on audit queries and consistent sandbox identity on auction fixtures. No new capability field is added to the 3.1 schemas. + +Bind canonical product-validation fixtures and vendor-metric catalog fixtures to +the same explicit sandbox account used by their product probes and buy requests, +so automatic seeding does not infer an account from unrelated sample requests. diff --git a/server/src/training-agent/task-handlers.ts b/server/src/training-agent/task-handlers.ts index 561728ff42c..ec6b04c51dd 100644 --- a/server/src/training-agent/task-handlers.ts +++ b/server/src/training-agent/task-handlers.ts @@ -5982,6 +5982,7 @@ export async function handleUpdateMediaBuy(args: ToolArgs, ctx: TrainingContext) product_id: pkg.productId, budget: pkg.budget, pricing_option_id: pkg.pricingOptionId, + ...(pkg.bidPrice !== undefined && { bid_price: pkg.bidPrice }), paused: pkg.paused, start_time: pkg.startTime, end_time: pkg.endTime, diff --git a/server/tests/unit/training-agent-maintenance-negotiation.test.ts b/server/tests/unit/training-agent-maintenance-negotiation.test.ts index 216db678b62..2665aefcf6b 100644 --- a/server/tests/unit/training-agent-maintenance-negotiation.test.ts +++ b/server/tests/unit/training-agent-maintenance-negotiation.test.ts @@ -1,14 +1,17 @@ import express from 'express'; import type { Server } from 'node:http'; import { fileURLToPath } from 'node:url'; +import { readFileSync } from 'node:fs'; import { afterAll, beforeAll, expect, it } from 'vitest'; import fixtureTestSdk from '@adcp-protocol/fixture-test-sdk/testing'; +import { runStoryboard as runLegacyStoryboard } from '@adcp/sdk/testing'; const token = 'maintenance-negotiation-test-token'; let server: Server; let url: string; let cleanup: () => void; const productRequests: Record[] = []; +const wireRequests: Array<{ name: string; arguments: Record }> = []; beforeAll(async () => { process.env.NODE_ENV = 'test'; @@ -22,11 +25,29 @@ beforeAll(async () => { (request as typeof request & { rawBody?: string }).rawBody = bytes.toString('utf8'); } })); app.use((request, _response, next) => { + if (request.body?.method === 'tools/call') { + wireRequests.push(structuredClone(request.body.params)); + } if (request.body?.method === 'tools/call' && request.body.params?.name === 'get_products') { productRequests.push(structuredClone(request.body.params.arguments)); } next(); }); + app.use((request, response, next) => { + const { name, arguments: args } = request.body?.params ?? {}; + if (name === 'get_products' && args?.buying_mode === 'wholesale' && args.brief !== undefined) { + // Exercise a strict seller's normative 3.1 mode boundary. The schema's + // description forbids brief on wholesale reads even on older bundles + // whose structural validator alone does not enforce that condition. + response.json({ jsonrpc: '2.0', id: request.body.id, result: { + isError: true, content: [{ type: 'text', text: JSON.stringify({ adcp_error: { + code: 'INVALID_REQUEST', field: 'brief', message: 'brief is forbidden for wholesale discovery', + } }) }], + } }); + return; + } + next(); + }); app.use('/api/training-agent', createTrainingAgentRouter()); server = app.listen(0, '127.0.0.1'); await new Promise(resolve => server.once('listening', resolve)); @@ -68,3 +89,81 @@ it('a published modern SDK keeps a 3.1.30 seller request on stable 3.1 and valid const response = products?.response as { products: Array<{ product_card: { title: string } }> }; expect(response.products[0].product_card.title).toEqual(expect.any(String)); }); + +it('discovers seeded auctions and preserves accepted bids through a budget-only update over MCP', async () => { + const storyboard = fixtureTestSdk.parseStoryboard(readFileSync(fileURLToPath(new URL( + '../../../static/compliance/source/specialisms/sales-non-guaranteed/index.yaml', import.meta.url, + )), 'utf8')); + const start = wireRequests.length; + const result = await fixtureTestSdk.runStoryboard(url, storyboard, { + protocol: 'mcp', allow_http: true, auth: { type: 'bearer', token }, + adcpVersion: '3.1.31', schemaRoot: fileURLToPath(new URL('../../../dist/schemas/3.1.31', import.meta.url)), + }); + const failures = result.phases.flatMap(phase => phase.steps) + .filter(step => !step.passed || step.skipped) + .map(step => ({ id: step.step_id, error: step.error, + validations: step.validations?.filter(validation => !validation.passed) + .map(validation => ({ check: validation.check, path: validation.path, description: validation.description })) })); + expect(result.overall_passed, JSON.stringify(failures)).toBe(true); + expect(result.failed_count).toBe(0); + expect(result.skipped_count).toBe(0); + + const calls = wireRequests.slice(start); + const account = storyboard.context.account; + const seeds = calls.filter(call => call.name === 'comply_test_controller' + && ['seed_product', 'seed_pricing_option'].includes(String(call.arguments.scenario))); + expect(seeds).toHaveLength(4); + for (const call of seeds) expect(call.arguments.account).toEqual(account); + const discovery = calls.find(call => call.name === 'get_products'); + const create = calls.find(call => call.name === 'create_media_buy'); + const update = calls.find(call => call.name === 'update_media_buy'); + expect(discovery?.arguments.buying_mode).toBe('wholesale'); + expect(discovery?.arguments).not.toHaveProperty('brief'); + for (const call of [discovery, create, update]) { + expect(call?.arguments.account).toEqual(account); + expect(call?.arguments.adcp_version).toBe('3.1'); + } + expect(create?.arguments.packages).toEqual([ + expect.objectContaining({ product_id: 'sports_display_auction', bid_price: 6, budget: 10000 }), + expect.objectContaining({ product_id: 'outdoor_video_auction', bid_price: 16, budget: 15000 }), + ]); + expect(update?.arguments.packages).toEqual([ + expect.objectContaining({ budget: 12000 }), expect.objectContaining({ budget: 13000 }), + ]); + for (const pkg of update?.arguments.packages as Record[]) { + expect(pkg).not.toHaveProperty('bid_price'); + } + const updated = result.phases.flatMap(phase => phase.steps).find(step => step.step_id === 'update_media_buy'); + expect(updated?.response).toMatchObject({ affected_packages: [ + { product_id: 'sports_display_auction', bid_price: 6, budget: 12000 }, + { product_id: 'outdoor_video_auction', bid_price: 16, budget: 13000 }, + ] }); +}); + +it('the legacy SDK sends a forbidden wholesale brief over MCP and stops later auction mutations on refusal', async () => { + const storyboard = fixtureTestSdk.parseStoryboard(readFileSync(fileURLToPath(new URL( + '../../../static/compliance/source/specialisms/sales-non-guaranteed/index.yaml', import.meta.url, + )), 'utf8')); + // Isolate the actual client request from controller preflight, which is + // independently covered by the complete modern-runner lifecycle above. + delete storyboard.prerequisites; + delete storyboard.fixtures; + delete storyboard.invariants; + const ids = ['get_products_brief', 'create_media_buy', 'update_media_buy']; + storyboard.phases = storyboard.phases.map(phase => ({ + ...phase, steps: phase.steps.filter(step => ids.includes(step.id)), + })).filter(phase => phase.steps.length > 0); + const start = wireRequests.length; + const result = await runLegacyStoryboard(url, storyboard, { + protocol: 'mcp', allow_http: true, auth: { type: 'bearer', token }, + brand: { domain: 'acmeoutdoor.example' }, adcpVersion: '3.1.31', + schemaRoot: fileURLToPath(new URL('../../../dist/schemas/3.1.31', import.meta.url)), + }); + const calls = wireRequests.slice(start); + const discovery = calls.find(call => call.name === 'get_products'); + expect(discovery?.arguments).toMatchObject({ buying_mode: 'wholesale', brief: expect.any(String) }); + expect(result.overall_passed).toBe(false); + expect(result.failed_count).toBe(1); + expect(result.skipped_count).toBe(2); + expect(calls.some(call => ['create_media_buy', 'update_media_buy'].includes(call.name))).toBe(false); +}); diff --git a/static/compliance/source/protocols/media-buy/scenarios/vendor_metric_catalog_precondition.yaml b/static/compliance/source/protocols/media-buy/scenarios/vendor_metric_catalog_precondition.yaml index 9c9d7c0fc0a..08d5b909c43 100644 --- a/static/compliance/source/protocols/media-buy/scenarios/vendor_metric_catalog_precondition.yaml +++ b/static/compliance/source/protocols/media-buy/scenarios/vendor_metric_catalog_precondition.yaml @@ -58,6 +58,14 @@ prerequisites: test_kit: "test-kits/acme-outdoor.yaml" controller_seeding: true +# Bind pre-flight product seeds and later catalog/buy requests to one account. +context: + account: + brand: + domain: "acmeoutdoor.example" + operator: "pinnacle-agency.example" + sandbox: true + fixtures: products: - product_id: "display_vendor_metric_catalog_precondition" @@ -109,6 +117,7 @@ phases: - brand: domain: "acmeoutdoor.example" operator: "pinnacle-agency.example" + sandbox: true billing: "operator" payment_terms: "net_30" idempotency_key: "$generate:uuid_v4#media_buy_seller_vendor_metric_catalog_precondition_sync_accounts" @@ -138,6 +147,9 @@ phases: catalog for this compliance session. sample_request: account: + brand: + domain: "acmeoutdoor.example" + operator: "pinnacle-agency.example" sandbox: true brand: domain: "acmeoutdoor.example" @@ -196,6 +208,7 @@ phases: brand: domain: "acmeoutdoor.example" operator: "pinnacle-agency.example" + sandbox: true start_time: "asap" end_time: "2099-06-30T23:59:59Z" packages: @@ -260,6 +273,7 @@ phases: brand: domain: "acmeoutdoor.example" operator: "pinnacle-agency.example" + sandbox: true start_time: "asap" end_time: "2099-06-30T23:59:59Z" packages: diff --git a/static/compliance/source/specialisms/sales-non-guaranteed/index.yaml b/static/compliance/source/specialisms/sales-non-guaranteed/index.yaml index c3425bec879..5246c89d8d5 100644 --- a/static/compliance/source/specialisms/sales-non-guaranteed/index.yaml +++ b/static/compliance/source/specialisms/sales-non-guaranteed/index.yaml @@ -159,25 +159,27 @@ phases: - id: product_discovery title: "Discover auction-based products" narrative: | - The buyer sends a brief to discover your non-guaranteed inventory. Products - come back with delivery_type: non_guaranteed, bid guidance, and any declared floors - that helps the buyer set competitive bids. + The buyer reads the wholesale auction catalog to locate the exact seeded + products used in this fixture-backed flow. Curated brief discovery may + legitimately rank other products ahead of these fixtures. Price guidance + and declared floors may help buyers set competitive bids when available. steps: - id: get_products_brief - title: "Send a brief for non-guaranteed inventory" + title: "Read the non-guaranteed auction catalog" narrative: | - The buyer describes what they want. Your platform returns non-guaranteed - products with auction mechanics and available audience segments. Floor + The buyer locates the seeded non-guaranteed products and pricing + options in the wholesale feed, independently of catalog order. Floor prices, recommended bid ranges, and win-rate forecasts are optional. task: get_products schema_ref: "media-buy/get-products-request.json" response_schema_ref: "media-buy/get-products-response.json" doc_ref: "/media-buy/task-reference/get_products" comply_scenario: full_sales_flow - stateful: false + stateful: true expected: | - Return non-guaranteed products matching the brief. Each product should include: + Return the non-guaranteed auction feed, including the seeded fixtures. + Each product should include: - product_id: unique identifier - name and description - delivery_type: non_guaranteed @@ -187,10 +189,9 @@ phases: - targeting: available audiences and contexts sample_request: - buying_mode: "brief" + buying_mode: "wholesale" brand: domain: "acmeoutdoor.example" - brief: "Display and video inventory across sports and outdoor lifestyle sites. Q2 flight, $25K budget. Adults 25-54, US. Auction-based, looking for competitive CPMs." filters: delivery_type: "non_guaranteed" is_fixed_price: false diff --git a/static/compliance/source/universal/canonical-format-validate-input.yaml b/static/compliance/source/universal/canonical-format-validate-input.yaml index caa8a15a710..bf99d59a04c 100644 --- a/static/compliance/source/universal/canonical-format-validate-input.yaml +++ b/static/compliance/source/universal/canonical-format-validate-input.yaml @@ -42,6 +42,14 @@ prerequisites: test_kit: "test-kits/acme-outdoor.yaml" controller_seeding: true +# Product fixtures use the same sandbox identity as the product-target probes. +context: + account: + brand: + domain: "acmeoutdoor.example" + operator: "pinnacle-agency.example" + sandbox: true + fixtures: products: - product_id: "validate_input_nondeterministic_video" diff --git a/tests/cli-scenario-fixtures.test.cjs b/tests/cli-scenario-fixtures.test.cjs index 816b161bec9..984ec8341ae 100644 --- a/tests/cli-scenario-fixtures.test.cjs +++ b/tests/cli-scenario-fixtures.test.cjs @@ -120,6 +120,33 @@ test('3.1 account-scoped creative scenarios declare the sandbox identity they us for (const row of fixtures) assert.deepEqual(row, fixtures[0], 'a warm 3.1 natural key must reseed idempotently'); }); +test('canonical product probes bind their fixtures to the product-target sandbox account', () => { + const storyboard = YAML.parse(fs.readFileSync(path.join( + __dirname, '../static/compliance/source/universal/canonical-format-validate-input.yaml' + ), 'utf8')); + const validateAccountRef = ajv.getSchema('/schemas/core/account-ref.json'); + assert.equal(validateAccountRef(storyboard.context.account), true, ajv.errorsText(validateAccountRef.errors)); + const productIds = new Set(storyboard.fixtures.products.map(product => product.product_id)); + const probes = storyboard.phases.flatMap(phase => phase.steps) + .filter(step => step.sample_request?.targets?.some(target => target.kind === 'product' && productIds.has(target.id))); + assert.equal(probes.length, 2, 'both missing-slot and nondeterministic probes must read the seeded product'); + for (const step of probes) assert.deepEqual(step.sample_request.account, storyboard.context.account, step.id); +}); + +test('vendor-metric catalog setup and both compatibility branches share the fixture sandbox account', () => { + const storyboard = loadAccountScenario('vendor_metric_catalog_precondition'); + const account = storyboard.context.account; + const validateAccountRef = ajv.getSchema('/schemas/core/account-ref.json'); + assert.equal(validateAccountRef(account), true, ajv.errorsText(validateAccountRef.errors)); + assert.equal(account.sandbox, true); + const steps = storyboard.phases.flatMap(phase => phase.steps); + const provision = steps.find(step => step.task === 'sync_accounts').sample_request.accounts[0]; + assert.deepEqual({ brand: provision.brand, operator: provision.operator, sandbox: provision.sandbox }, account); + const uses = steps.filter(step => ['comply_test_controller', 'create_media_buy'].includes(step.task)); + assert.equal(uses.length, 3, 'catalog seed and both accept/reject branches must share scope'); + for (const step of uses) assert.deepEqual(step.sample_request.account, account, step.id); +}); + // Exercise only the prerequisite contract through the public runner. Full // authored storyboards are verified separately against the local MCP agent. async function probeAccountPrerequisite(name, accounts, { omitFixture = false, rejectSeed = false } = {}) { diff --git a/tests/optional-discovery-maintenance.test.cjs b/tests/optional-discovery-maintenance.test.cjs index 95308a7f789..0aa7a387d0c 100644 --- a/tests/optional-discovery-maintenance.test.cjs +++ b/tests/optional-discovery-maintenance.test.cjs @@ -59,15 +59,14 @@ test('a creative library alone does not run provenance mutations on the maintain } }); -test('SDK 9.6.2 grades fixture-backed auction discovery, buyer bids, and budget-only updates without guidance', async () => { +function auctionSteps() { const storyboard = load('specialisms/sales-non-guaranteed/index.yaml'); const phases = storyboard.phases.filter(phase => ['get_products_brief', 'create_media_buy', 'update_media_buy'] .some(id => phase.steps.some(step => step.id === id))); storyboard.phases = phases.map(phase => ({ ...phase, steps: phase.steps.filter(step => ['get_products_brief', 'create_media_buy', 'update_media_buy'].includes(step.id)) })); - // Preload the controller-backed catalog and isolate these three real runner - // steps. This is construction/grading coverage, not a substitute for the - // independent response-schema and upstream-traffic integration suites. + // Isolate request construction from fixture/preflight and transport checks. + // The modern SDK's actual MCP lifecycle regression retains those checks. delete storyboard.prerequisites; delete storyboard.fixtures; delete storyboard.invariants; @@ -75,6 +74,41 @@ test('SDK 9.6.2 grades fixture-backed auction discovery, buyer bids, and budget- step.validations = step.validations.filter(validation => !['response_schema', 'upstream_traffic'].includes(validation.check)); } + return storyboard; +} + +test('SDK 9.6.2 cannot construct the maintained wholesale discovery and stops subsequent auction mutations', async () => { + const storyboard = auctionSteps(); + let discovery; + let mutations = 0; + const runOptions = options({ + resetContext() {}, + async getProducts(request) { + discovery = structuredClone(request); + // SDK 9 injects this brief even though the authored wholesale request + // omits it. A strict 3.1 seller must refuse the malformed combination. + assert.equal(request.buying_mode, 'wholesale'); + assert.equal(typeof request.brief, 'string'); + return { success: false, error: 'INVALID_REQUEST: brief is forbidden for wholesale discovery' }; + }, + async createMediaBuy() { mutations++; throw new Error('discovery failure must stop creation'); }, + async updateMediaBuy() { mutations++; throw new Error('discovery failure must stop updates'); }, + }); + runOptions.brand = { domain: 'acmeoutdoor.example' }; + const result = await runStoryboard('https://seller.example/mcp', storyboard, runOptions); + assert.equal(result.overall_passed, false); + assert.equal(result.failed_count, 1, JSON.stringify(result)); + assert.equal(result.skipped_count, 2, JSON.stringify(result)); + assert.equal(discovery.account.sandbox, true); + assert.equal(mutations, 0); +}); + +test('SDK 9.6.2 constructs fixture-backed buyer bids and budget-only updates after validated discovery', async () => { + const storyboard = auctionSteps(); + // This positive case starts after validated discovery. It does not qualify + // SDK 9's wholesale builder, whose malformed request is covered above. + storyboard.phases = storyboard.phases.filter(phase => + !phase.steps.some(step => step.id === 'get_products_brief')); const display = { product_id: 'sports_display_auction', delivery_type: 'non_guaranteed', format_ids: [{ id: 'display_300x250', agent_url: 'https://seller.example/mcp' }], @@ -89,14 +123,6 @@ test('SDK 9.6.2 grades fixture-backed auction discovery, buyer bids, and budget- let updated; const runOptions = options({ resetContext() {}, - async getProducts(request) { - assert.equal(request.account.sandbox, true); - return { success: true, data: { - // Unrelated inventory can precede both fixtures and have a higher floor. - products: [{ product_id: 'unrelated-first', pricing_options: [{ pricing_model: 'cpm', floor_price: 1000 }] }, video, display], - context: request.context, - } }; - }, async createMediaBuy(request) { assert.equal(request.account.sandbox, true); created = structuredClone(request); @@ -124,9 +150,13 @@ test('SDK 9.6.2 grades fixture-backed auction discovery, buyer bids, and budget- }, }); runOptions.brand = { domain: 'acmeoutdoor.example' }; + storyboard.context = { ...storyboard.context, products: [ + // Unrelated inventory can precede both fixtures and have a higher floor. + { product_id: 'unrelated-first', pricing_options: [{ pricing_model: 'cpm', floor_price: 1000 }] }, video, display, + ] }; const result = await runStoryboard('https://seller.example/mcp', storyboard, runOptions); assert.equal(result.overall_passed, true, JSON.stringify(result)); - assert.equal(result.passed_count, 3, JSON.stringify(result)); + assert.equal(result.passed_count, 2, JSON.stringify(result)); assert.equal(result.failed_count, 0); assert.equal(result.skipped_count, 0); assert.deepEqual(updated.packages.map(pkg => pkg.budget), [12000, 13000]);