Skip to content

fix(bridge): guard mergeSeededProductsIntoResponse against the Submitted arm#1781

Merged
bokelley merged 2 commits into
mainfrom
bokelley/bridge-guard-submitted-arm-on-products
May 16, 2026
Merged

fix(bridge): guard mergeSeededProductsIntoResponse against the Submitted arm#1781
bokelley merged 2 commits into
mainfrom
bokelley/bridge-guard-submitted-arm-on-products

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

Summary

  • get_products formally permits an async Submitted arm per AdCP 3.0.11 (schemas/cache/3.0.11/media-buy/get-products-async-response-submitted.json) for queued custom / bespoke product curation.
  • When a handler returns { status: 'submitted', task_id, message? }, the dispatcher routes it through wrapSubmittedEnvelope — but the bridge merge runs after wrap and would spread products: [...] into the Submitted envelope, producing an invalid hybrid wire shape: { status: 'submitted', task_id, products: [...], sandbox: true }.
  • Detect the Submitted shape in the merge helper and short-circuit (reference-equal return). One regression test.

Scope

get_products only. The other 12 bridged read tools (list_creatives, get_media_buys, get_media_buy_delivery, list_accounts, get_account_financials, list_creative_formats, list_property_lists, get_property_list, list_collection_lists, get_collection_list, list_content_standards, get_content_standards, get_signals, get_creative_delivery, get_creative_features) do NOT have a formal Submitted arm in 3.0.11 — a uniform guard across all helpers would defend against a spec violation the SDK should surface via response validation rather than silently route around.

Background

Identified during the post-merge expert review of (now-closed) #1754. Verified during the same review against schemas/cache/3.0.11/: only get_products, build_creative, create_media_buy, update_media_buy, sync_creatives, and sync_catalogs have formal Submitted arms in 3.0.11; of those, only get_products is bridged. So this is a real latent bug reachable today by any spec-compliant get_products handler that defers curation.

Test plan

  • NODE_ENV=test node --test test/lib/seed-get-products-wiring.test.js — 14/14 pass (1 new + 13 existing).
  • tsc --noEmit clean.
  • prettier --check clean.

…bmitted arm

get_products formally permits an async Submitted arm in the AdCP 3.0.11
spec (schemas/cache/3.0.11/media-buy/get-products-async-response-submitted.json)
for queued custom / bespoke product curation. When a handler returns
{ status: 'submitted', task_id, message? }, the dispatcher routes the
response through wrapSubmittedEnvelope, but the bridge merge runs after
that wrap step and without a guard would spread products: [...] into
the Submitted envelope, producing an invalid hybrid wire shape:
{ status: 'submitted', task_id, products: [...], sandbox: true }.

Add a local isSubmittedArm predicate (mirrors the dispatcher's
isSubmittedEnvelope — kept local because that helper lives inside the
dispatcher closure) and short-circuit the merge when the response
matches the Submitted shape. Returns the handler response
reference-equal so the dispatcher's existing skip-on-reference-equality
wrap-avoidance kicks in.

Scope is get_products-specific by design — none of the other 12
bridged read tools have a formal Submitted arm in 3.0.11. A uniform
guard across all helpers would defend against a spec violation the
SDK should surface via response validation rather than silently route
around.

Regression test in seed-get-products-wiring.test.js verifies the bridge
leaves a Submitted envelope unmodified (no products spread, no sandbox
stamp).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…p order

Protocol expert review of PR #1781 flagged the JSDoc narration as
slightly inverted. The bridge merge runs on the unwrapped Submitted
body (received via formatted.structuredContent), not on the wrapped
McpToolResponse envelope. Re-phrase to match the actual dispatcher
flow and add a reference to schemas/cache/3.0.11/core/async-response-data.json
as the authoritative source for which read tools have formal Submitted
arms.

No code behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bokelley bokelley merged commit 7a6a6c9 into main May 16, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant