fix(testing): get_media_buys / get_media_buy_delivery skip 'unknown' fallback (#983)#988
fix(testing): get_media_buys / get_media_buy_delivery skip 'unknown' fallback (#983)#988bokelley wants to merge 2 commits into
Conversation
…fallback (#983) request-builder.get_media_buys and get_media_buy_delivery always returned { media_buy_ids: [context.media_buy_id ?? 'unknown'] }. When a storyboard's sample_request omitted media_buy_ids (testing the broad-list / pagination path), the merge kept the placeholder because the fixture didn't override it. Agents received a placeholder ID, returned 0 matches, and pagination assertions failed. Per get-media-buys-request.json the field is optional (minItems: 1). Omitting it asks for a paginated set of accessible media buys — a conformant broad-list query. Mirroring peer paginated-read enrichers (list_creatives, list_creative_formats, list_accounts, get_signals) — none of which fabricate IDs — both enrichers now return empty when context lacks a real media_buy_id. The fixture's sample_request becomes authoritative on that path. For get_media_buy_delivery (which requires media_buy_ids per the spec), the same change turns silent NOT_FOUND responses into surfacing INVALID_REQUEST errors that authors can debug. 8 new tests in test/lib/request-builder.test.js. Unblocks adcontextprotocol/adcp#3122 (get_media_buys pagination conformance storyboard). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…m, parity tests
Expert review appliedBoth reviewers (code-reviewer + ad-tech-protocol-expert) converged on the same blocker: my JSDoc + changeset claim that Fixed in commit d78b454:
Filed for follow-up#989 — audit other request-builder enrichers for the same Test count64 tests in Latest commit: d78b454. |
Approvedad-tech-protocol-expert review: approve.
|
|
Closing as superseded — the same fix landed via PR #987 (commit Verified on
The functional fix is identical. #987 used a slightly more concise expression; this PR's longer JSDoc explanation and broader test coverage (broad-list intent, fixture-wins, empty-string handling) are nice-to-have but not essential — the core 4 tests on main cover both enricher behaviors. The expert review summary documented for posterity in #988's comment thread. Closes adcp-client#983 (already closed via #987). |
…to 'unknown' (#989) Audit of the 12 enricher call sites flagged by the code-reviewer in PR - `get_content_standards` keeps `'unknown'` — `standards_id` is required by `GetContentStandardsRequestSchema` (no `.optional()`), so returning `{}` would break the schema round-trip invariant. Added a comment explaining the schema constraint and why this differs from the `get_media_buys` fix in #983/#988. - 4 mutating-write enrichers used `'test-creative'` as the fallback for `creative_id` / `artifact_id`. Unlike `'unknown'`, `'test-creative'` could be silently accepted by a pre-seeded test agent, masking an authoring error. Changed all four to `'unknown'` for consistency with every other ID placeholder in the file: - `report_usage.usage[].creative_id` - `calibrate_content.artifact.artifact_id` - `validate_content_delivery.records[].artifact.artifact_id` - `creative_approval.creative_id` - All other `'unknown'` mutating-write placeholders verified correct. They trigger clean NOT_FOUND when context lacks a real id, surfacing "wire context_outputs from the create step." Adds 3 unit tests for `get_content_standards` in `test/lib/request-builder.test.js` covering the `'unknown'` fallback, context injection, and fixture-wins precedence. https://claude.ai/code/session_01UP9cSBJMZSd2QKRkfmuehT
…to 'unknown' (#989) (#991) * fix(testing): standardise creative/artifact-id enricher placeholders to 'unknown' (#989) Audit of the 12 enricher call sites flagged by the code-reviewer in PR - `get_content_standards` keeps `'unknown'` — `standards_id` is required by `GetContentStandardsRequestSchema` (no `.optional()`), so returning `{}` would break the schema round-trip invariant. Added a comment explaining the schema constraint and why this differs from the `get_media_buys` fix in #983/#988. - 4 mutating-write enrichers used `'test-creative'` as the fallback for `creative_id` / `artifact_id`. Unlike `'unknown'`, `'test-creative'` could be silently accepted by a pre-seeded test agent, masking an authoring error. Changed all four to `'unknown'` for consistency with every other ID placeholder in the file: - `report_usage.usage[].creative_id` - `calibrate_content.artifact.artifact_id` - `validate_content_delivery.records[].artifact.artifact_id` - `creative_approval.creative_id` - All other `'unknown'` mutating-write placeholders verified correct. They trigger clean NOT_FOUND when context lacks a real id, surfacing "wire context_outputs from the create step." Adds 3 unit tests for `get_content_standards` in `test/lib/request-builder.test.js` covering the `'unknown'` fallback, context injection, and fixture-wins precedence. https://claude.ai/code/session_01UP9cSBJMZSd2QKRkfmuehT * test(testing): add regression tests for creative/artifact-id enricher changes (#989) Cover the four enrichers whose placeholder was changed from 'test-creative' to 'unknown': report_usage, calibrate_content, validate_content_delivery, and creative_approval. Each gets an 'unknown' fallback assertion and a context-injection assertion, matching the pattern established by the get_content_standards block. Addresses code-reviewer and ad-tech-protocol-expert feedback from the pre-PR review on #989. https://claude.ai/code/session_01UP9cSBJMZSd2QKRkfmuehT * style: prettier format test/lib/request-builder.test.js Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
Summary
Closes #983.
request-builder.get_media_buysandget_media_buy_deliveryalways returned{ media_buy_ids: [context.media_buy_id ?? 'unknown'] }. When a storyboard'ssample_requestomittedmedia_buy_ids— e.g. testing the broad-list / pagination path — the merge{ ...enriched, ...fixture }kept the["unknown"]placeholder because the fixture didn't override it. Agents received a placeholder ID, returned 0 matches, and pagination assertions failed.Fix
Per
get-media-buys-request.jsonthe field is optional (minItems: 1). Omitting it asks for "a paginated set of accessible media buys matchingstatus_filter" — a conformant broad-list query. Both enrichers now return{}when context lacks a realmedia_buy_id; the fixture'ssample_requestbecomes authoritative.This mirrors peer paginated-read enrichers (
list_creatives,list_creative_formats,list_accounts,get_signals) — none of which fabricate IDs.For
get_media_buy_delivery(which requiresmedia_buy_idsper the spec), the same change converts the silent NOT_FOUND failure mode into surfacing INVALID_REQUEST errors that authors can debug.Behavior
media_buy_id[context.media_buy_id](unchanged)media_buy_idmedia_buy_idsmedia_buy_idsabsent on the wire (broad-list path)media_buy_idsTest plan
test/lib/request-builder.test.js(62/62)tsc --noEmitclean,prettier --checkclean,eslint0 errorsUnblocks
adcontextprotocol/adcp#3122— once this fix ships, theget-media-buys-pagination-integritystoryboard returns to its multi-page walk against the broad-list path.🤖 Generated with Claude Code