fix(bridge): guard mergeSeededProductsIntoResponse against the Submitted arm#1781
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_productsformally 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.{ status: 'submitted', task_id, message? }, the dispatcher routes it throughwrapSubmittedEnvelope— but the bridge merge runs after wrap and would spreadproducts: [...]into the Submitted envelope, producing an invalid hybrid wire shape:{ status: 'submitted', task_id, products: [...], sandbox: true }.Scope
get_productsonly. 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/: onlyget_products,build_creative,create_media_buy,update_media_buy,sync_creatives, andsync_catalogshave formal Submitted arms in 3.0.11; of those, onlyget_productsis bridged. So this is a real latent bug reachable today by any spec-compliantget_productshandler 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 --noEmitclean.prettier --checkclean.