Repository navigation
docs(server): document media_buy_ids[] pass-through contract (#1342) - #1395
Merged
Merged
Conversation
Picks Option B from #1342 — framework passes the array through, platform owns fan-out. The decision is documented in JSDoc on the two specialism methods that take `media_buy_ids[]`: - `SalesPlatform.getMediaBuyDelivery` - `CreativeAdServerPlatform.getCreativeDelivery` Why pass-through, not framework fan-out (Options A or C-when-default): `aggregated_totals` carries `reach` (depends on cross-buy dedup capability), `new_to_brand_rate` (weighted across buys, not a per-buy average), and `frequency` (depends on dedup) — these can't be synthesized correctly by a naive framework loop because the dedup strategy is platform-domain knowledge. A capability flag with naive sum-and-concat as the false-default would just let adopters opt out of broken behavior. Pass-through keeps domain decisions with the seller. Sellers who can compute the cross-buy fields populate them; sellers who can't omit them, and buyers fall back to per-buy values. Closes #1342. Test-only behavior change (JSDoc clarification + test asserting the contract is honored). No changeset entry — empty changeset for test-only / docstring changes. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
… + getMediaBuys Two changes in response to expert review: 1. **Flip the recommended pattern** (product expert). Real reporting APIs (GAM ReportService, TTD, DV360, Magnite, PubMatic, retail media) accept multi-id queries natively; the per-id loop is an N-roundtrip anti-pattern that triggers rate limits on 50-buy reports. Show the multi-id pattern first, with the loop as fallback for genuinely-single-id upstreams. 2. **Extend the contract to getMediaBuys** (protocol expert). Same `media_buy_ids[]` shape on `getMediaBuys` — and it's REQUIRED for non-guaranteed sellers, so it'll hit more adopters than the optional `getMediaBuyDelivery`. Add the same JSDoc note; reference #1342 for the rationale. The multi-id contract on `sync_creatives` / `sync_plans` / `sync_catalogs` / `get_plan_audit_logs` is already obvious because those are sync/upsert surfaces; the delivery-style aggregation hazard doesn't apply there. Per protocol-expert review on PR #1395.
This was referenced May 3, 2026
bokelley
added a commit
that referenced
this pull request
May 3, 2026
Came in via the main merge (#1342 → #1395). Buyers calling get_media_buy_delivery / get_creative_delivery with multiple media_buy_ids hand the array to the platform as-is — framework doesn't synthesize per-buy fan-out because cross-buy aggregates (reach, new_to_brand_rate, frequency) depend on dedup capability that's platform-domain knowledge. Closes one of the gaps the upstream-feedback screenshot flagged as "Not yet — adapters can still silently truncate." composeMethod test recipes (the other gap) are tracked separately in #1371. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
4 tasks done
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
Closes #1342 by picking Option B from the issue's three-way design choice: framework passes the
media_buy_ids[]array through; platform owns fan-out and aggregation.Why pass-through, not framework fan-out
GetMediaBuyDeliveryResponse.aggregated_totalscarries cross-buy fields that can't be synthesized correctly by a naive framework loop:reach— "Deduplicated reach across all media buys (if the seller can deduplicate across buys)" — only the seller knows their dedup capabilitynew_to_brand_rate— "weighted by conversion volume, not a simple average of per-buy rates"frequency— depends on cross-buy dedupattribution_window— applied uniformly across the result; framework can't pick which windowA capability-flag default of "framework fans out" (Option C) would just let adopters opt out of broken behavior. Better: keep domain decisions with the seller. Sellers who can compute cross-buy fields populate them; sellers who can't omit them and buyers fall back to per-buy values from
media_buy_deliveries[].The same reasoning applies to
getCreativeDelivery, which carriesmedia_buy_ids[]andcreative_ids[].Changes
JSDoc additions on the two methods carrying multi-id arrays:
SalesPlatform.getMediaBuyDelivery— explicit "platform MUST iterate every id; reading onlymedia_buy_ids[0]silently truncates" note, plus a recommended-pattern code snippetCreativeAdServerPlatform.getCreativeDelivery— same contract for bothmedia_buy_ids[]andcreative_ids[]Test —
test/server-decisioning-media-buy-ids-fanout.test.jsexercises:media_buy_ids→ platform receivesundefined(paginated-list contract per the wire schema)No library behavior change — the framework dispatch already passes
paramsthrough verbatim. This PR documents the contract that's already in effect, plus a test asserting it stays in effect.Test plan
test/server-decisioning-media-buy-ids-fanout.test.jspassnpm run build:libcleannpm run format:checkclean🤖 Generated with Claude Code