feat(decisioning): dev-mode warn on multi-id truncation in getMediaBuyDelivery / getMediaBuys#1402
Closed
bokelley wants to merge 2 commits into
Closed
feat(decisioning): dev-mode warn on multi-id truncation in getMediaBuyDelivery / getMediaBuys#1402bokelley wants to merge 2 commits into
bokelley wants to merge 2 commits into
Conversation
…ssage; expand getMediaBuys test coverage https://claude.ai/code/session_01QQQayoudDsHqFnpREANjJ2
Contributor
Author
|
Closing as superseded — |
Contributor
Author
|
Acknowledged — superseded by #1408, which shipped the same Generated by Claude Code |
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.
Refs #1399
Adds a dev-mode
logger.warnin the dispatch path ofgetMediaBuyDeliveryandgetMediaBuyswhen the platform returns fewer rows than the buyer'smedia_buy_ids[]requested. This catches the "truncate-to-media_buy_ids[0]" footgun at adapter-development time — the class of bug documented in #1342.What changed
src/lib/server/decisioning/runtime/from-platform.tswarnMultiIdTruncation— fireslogger.warnwhenrequestedIds.length > returnedRows.lengthandNODE_ENVistestordevelopment.getMediaBuyDeliverydispatch: expanded from a one-liner to anasyncbody so the result can be inspected before returning.getMediaBuysdispatch: call added after the existingautoStoreResourcescall.isDevOrTestguard pattern from lines 756 and 773, and theADCP_DECISIONING_ALLOW_*env-var suppression pattern from lines 757 and 774.test/server-decisioning-multi-id-truncation-warn.test.js(new file)11 tests across both tools covering: warn fires on truncation; no warn on exact-count match; no warn when
media_buy_idsomitted (paginated-list contract); suppressed byADCP_DECISIONING_ALLOW_MULTI_ID_TRUNCATION=1; silent inNODE_ENV=production; silent whenNODE_ENVunset.Test plan
server-decisioning-from-platform.test.js+ related suites pass (0 failures)npm run format:checkcleannpm run build:lib(pre-push hook: typecheck + format) cleanPre-PR review
projectSyncerror path handled (warn only fires on successful responses),=== '1'guard matches file convention, 9 acceptance-criteria tests validated. Issues (fix or explain): issue link points to design: media_buy_ids[] fan-out semantics on getMediaBuyDelivery — framework aggregates vs. platform's job #1342 (root footgun, deliberate — more stable than the triage PR URL), missinggetMediaBuyspaginated-list + production tests added in fixup commit.Set ADCP_DECISIONING_ALLOW_MULTI_ID_TRUNCATION=1 to silence.matching the established pattern at lines 784 and 965.Nits surfaced (not fixed — out of PR scope)
opts.mediaBuylegacy merge-seam path silently bypasses the warning (existing migration path, documented comment at line 3178).responseRows.length > requestedIds.lengthpath — the>=guard handles it correctly but is untested).Session: https://claude.ai/code/session_01QQQayoudDsHqFnpREANjJ2
Generated by Claude Code