Repository navigation
feat(decisioning): ProposalManager v1.5 follow-ups (wire-leak strip, recipe rename, extensibility) - #1562
Conversation
… recipe rename, extensibility Addresses every actionable concern from the parallel expert review on PR #1557 (code-reviewer / ad-tech-protocol-expert / security-reviewer / adtech-product-expert). Stacks on the v1.5 base; will be opened as a follow-up PR once #1557 lands. 1. Wire-leak prevention: strip Product.implementation_config Recipe data (network_code, ad_unit_ids, line_item_template_id, GAM line-item priority) rides on Product.implementation_config server- side as the typed contract between ProposalManager and DecisioningPlatform. The wire schema is additionalProperties: true so the field is technically legal — but emitting it leaks publisher topology to buyers. Framework now runs stripImplementationConfig at the dispatcher response-boundary chokepoint right after stripCtxMetadata, parallel pattern. New helpers re-exported from @adcp/sdk/server. Test coverage in test/lib/proposal-implementation-config-strip.test.js. 2. Recipe rename: KevelLikeRecipe → AuctionLikeRecipe Conflating a decision-engine (Kevel) with a wire protocol (OpenRTB) under one recipe_kind: 'kevel' was a category error per product- expert review. Renamed to AuctionLikeRecipe with recipe_kind: 'auction'. Adopters who want sharper-typed shapes declare their own recipe_kind subtype on top. Breaking but pre-release. 3. Recipe extensibility: extensions slot Both GAMLikeRecipe and AuctionLikeRecipe gain an optional extensions?: Record<string, unknown> field. Adopters carrying richer upstream payloads (GAM creative_placeholders, Kevel frequency_caps, OpenRTB private_auction, FreeWheel placement_types) use this slot rather than forking recipe_kind. Adopters with stricter shape requirements declare a typed subtype literal on top. 4. HITL finalize cancel-race documentation Inline comment in runtime/from-platform.ts at the finalize-intercept site documents the known gap: if the buyer cancels mid-handoff, the framework marks the task cancelled but intercept.project still runs store.commit. Same gap exists for createMediaBuy HITL today. Mitigations: 7-day eviction window in InMemoryProposalStore + optional task-registry sweep by production stores. End-to-end fix requires AbortSignal propagation into projection callbacks — a framework-level concern, not finalize-specific. 5. projectFinalizeResponse products echo: explicit decision Inline comment documents the products: [] choice. Echoing would either re-emit from the persisted draft (extra wire bytes) or call back into the adopter (extra round-trip). Buyers fetching products on the finalize response use a follow-up get_products call keyed off proposals[0].allocations[].product_id. 6. Spec issue filed: adcp#4107 Clarifies refine[] mixed-action semantics when finalize is one of multiple entries. Spec is silent today; both SDKs implement first-finalize-only by convention. Companion to adcp#4086. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
… leak surfaced by security review PR #1562 security review caught a ship-blocker the parent PR (#1557) also inherited: the wire-strip chokepoint in projectSync only covers the sync arm. The HITL handoff path runs the projection callback inside dispatchHitl, then writes the projected result directly to taskRegistry.complete + emitTaskWebhook without re-stripping. Buyers polling tasks_get see ctx_metadata + implementation_config verbatim; webhook receivers see them too. Three fixes: 1. stripCtxMetadata + stripImplementationConfig now run inside dispatchHitl before taskRegistry.complete. Mirrors projectSync's chokepoint pattern. Every downstream consumer (tasks/get polling at line 1826, emitTaskWebhook at line 2493, idempotency replays of the Submitted envelope) inherits a clean payload. 2. CARRIER_KEYS extended with 'proposal' / 'proposals'. Without it, server-only fields on proposals[].products[] survived the strip — a proposal-mode-specific nesting the pre-existing carrier list didn't anticipate. Pre-existing latent ctx_metadata leak too. 3. stripImplementationConfig now reuses CARRIER_KEYS rather than maintaining its own narrower list. The two strips share a carrier set so future spec additions can't silently extend one and not the other. Also adds credential-leak warning to the recipe `extensions` slot JSDoc on both GAMLikeRecipe and AuctionLikeRecipe (security M3 from the review): adopters putting credentials there are protected only by coincidence of the implementation_config strip, not by a credential scanner. Test coverage: - New e2e regression in test/lib/proposal-manager-e2e.test.js drives a finalize HITL → tasks/get round-trip with both server-only fields embedded; asserts no leak via either path. - New shared-carrier test asserts implementation_config strip walks media_buys[].products[] and creatives[].product (carriers the narrower original list missed). 148/148 targeted tests pass (proposal primitives + lifecycle + e2e + strip + recipes + mock-server). 46/46 existing ctx_metadata tests still pass. check:adopter-types passes. prettier + tsc clean. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Pushed HIGH (ship-blocker, fixed): HITL handoff result bypassed the strip. MEDIUM (carrier-list divergence, fixed): MEDIUM ( Idempotency-cache write (verified, no fix needed): traced the cache write at Code-reviewer nits (fixed): dropped the misleading Test coverage: new e2e regression in 148/148 targeted tests pass; 46/46 existing |
|
Acknowledged — Generated by Claude Code |
|
Thanks for the confirmation, @bokelley. No further action needed on my end — standing by on the source issue if anything resurfaces. Generated by Claude Code |
Summary
Follow-ups to PR #1557, addressing every actionable concern from the parallel expert review (code-reviewer / ad-tech-protocol-expert / security-reviewer / adtech-product-expert).
What lands
1. Wire-leak prevention: strip
Product.implementation_config(security + protocol)Recipe data (
network_code,ad_unit_ids,line_item_template_id, GAM line-item priority, etc.) rides onProduct.implementation_configserver-side as the typed contract betweenProposalManagerandDecisioningPlatform. The wire schema isadditionalProperties: trueso the field is technically legal — but emitting it leaks publisher topology to buyers. Framework now runsstripImplementationConfigat the dispatcher response-boundary chokepoint right afterstripCtxMetadata, parallel pattern. New helpersstripImplementationConfig+hasImplementationConfigre-exported from@adcp/sdk/server. Test coverage intest/lib/proposal-implementation-config-strip.test.js.2. Recipe rename:
KevelLikeRecipe→AuctionLikeRecipe(product / naming honesty)Conflating a decision-engine (Kevel) with a wire protocol (OpenRTB) under one
recipe_kind: 'kevel'was a category error. Renamed toAuctionLikeRecipe(generic across auction-cleared remnant backends) withrecipe_kind: 'auction'. Adopters wanting sharper-typed shapes declare their ownrecipe_kind: 'kevel' | 'openrtb' | 'beeswax' | ...subtype on top.3. Recipe extensibility:
extensionsslot (product / forward-compat)Both
GAMLikeRecipeandAuctionLikeRecipegain an optionalextensions?: Record<string, unknown>field. Adopters carrying richer upstream payloads (GAMcreative_placeholders, Kevelfrequency_caps, OpenRTBprivate_auction, FreeWheelplacement_types, Operativerevenue_type) use this slot rather than forkingrecipe_kindinto N variants.4. HITL finalize cancel-race documentation (security M2)
Inline comment in
runtime/from-platform.tsat the finalize-intercept site documents the known gap: if the buyer callstasks/cancelwhile the adopter's HITL handoff is still mid-run, the framework marks the task cancelled butintercept.project(which fires when the handoff resolves) still runsstore.commit. Same gap exists forcreateMediaBuyHITL today. Mitigations: 7-day eviction window inInMemoryProposalStore, optional task-registry sweep by production durable stores. End-to-end fix requiresAbortSignalpropagation into projection callbacks — framework-level work, not finalize-specific.5.
projectFinalizeResponseproducts: []echo: explicit decision (code-review nit)Inline comment documents the design choice. Echoing on finalize would either re-emit from the persisted draft (extra wire bytes the buyer already has from
brief_with_proposals) or call back into the adopter (extra round-trip). Buyers fetching products on the finalize response useget_products({ product_ids: [...] })keyed offproposals[0].allocations[].product_id.6. Spec issue filed: adcp#4107 — clarifies
refine[]mixed-action semantics whenfinalizeis one of multiple entries. Spec is silent today; both SDKs implement first-finalize-only by convention. Companion to adcp#4086.Verification
npx tsc --noEmitcleannpm run check:adopter-typesPASSprettier --checkcleanhello_seller_adapter_proposal_modeTest plan
stripImplementationConfigdeletes the field on Product carriers (top-levelproducts[], nestedproposals[].products[]), preserves non-Product objects, handles null/non-object inputs,hasImplementationConfigdetects across carriers.recipes.test.jsupdated forAuctionLikeRecipe/buildAuctionLikeRecipe/AUCTION_LIKE_OVERLAP/recipe_kind: 'auction'.options.extensionsonto the recipe when supplied.🤖 Generated with Claude Code