Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .changeset/fix-optional-discovery-conformance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
"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 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.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion scripts/lint-storyboard-validations-paths.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions server/src/training-agent/task-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
99 changes: 99 additions & 0 deletions server/tests/unit/training-agent-maintenance-negotiation.test.ts
Original file line number Diff line number Diff line change
@@ -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<string, unknown>[] = [];
const wireRequests: Array<{ name: string; arguments: Record<string, unknown> }> = [];

beforeAll(async () => {
process.env.NODE_ENV = 'test';
Expand All @@ -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<void>(resolve => server.once('listening', resolve));
Expand Down Expand Up @@ -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<string, unknown>[]) {
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);
});
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -184,6 +190,8 @@ phases:
stateful: true
sample_request:
buying_mode: wholesale
brand:
domain: acmeoutdoor.example
filters:
channels:
- olv
Expand All @@ -200,28 +208,29 @@ 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
path: context.expected_negative_delivery_types
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
Expand All @@ -237,6 +246,8 @@ phases:
stateful: true
sample_request:
buying_mode: wholesale
brand:
domain: acmeoutdoor.example
filters:
channels:
- olv
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading