Skip to content

feat(decisioning): dev-mode warn on multi-id truncation in getMediaBuyDelivery / getMediaBuys#1402

Closed
bokelley wants to merge 2 commits into
mainfrom
claude/issue-1399-dev-mode-multi-id-truncation-warn
Closed

feat(decisioning): dev-mode warn on multi-id truncation in getMediaBuyDelivery / getMediaBuys#1402
bokelley wants to merge 2 commits into
mainfrom
claude/issue-1399-dev-mode-multi-id-truncation-warn

Conversation

@bokelley

@bokelley bokelley commented May 3, 2026

Copy link
Copy Markdown
Contributor

Refs #1399

Adds a dev-mode logger.warn in the dispatch path of getMediaBuyDelivery and getMediaBuys when the platform returns fewer rows than the buyer's media_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.ts

  • New private helper warnMultiIdTruncation — fires logger.warn when requestedIds.length > returnedRows.length and NODE_ENV is test or development.
  • getMediaBuyDelivery dispatch: expanded from a one-liner to an async body so the result can be inspected before returning.
  • getMediaBuys dispatch: call added after the existing autoStoreResources call.
  • Follows the exact isDevOrTest guard pattern from lines 756 and 773, and the ADCP_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_ids omitted (paginated-list contract); suppressed by ADCP_DECISIONING_ALLOW_MULTI_ID_TRUNCATION=1; silent in NODE_ENV=production; silent when NODE_ENV unset.

Test plan

  • All 11 new tests pass
  • 121 tests in server-decisioning-from-platform.test.js + related suites pass (0 failures)
  • npm run format:check clean
  • npm run build:lib (pre-push hook: typecheck + format) clean
  • Changeset included (patch — additive dev-mode diagnostic only)

Pre-PR review

  • code-reviewer: approved — logic correct, projectSync error 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), missing getMediaBuys paginated-list + production tests added in fixup commit.
  • dx-expert: approved with one blocker fixed — warning message now includes 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.mediaBuy legacy merge-seam path silently bypasses the warning (existing migration path, documented comment at line 3178).
  • No over-delivery test (responseRows.length > requestedIds.length path — the >= guard handles it correctly but is untested).

Triage-managed PR. This bot does not currently iterate on
review comments or PR conversation threads (only on the source
issue). To unblock:

  • Push fixup commits directly: gh pr checkout <num>
    fix → push.
  • Or re-trigger: comment /triage execute on the source
    issue.

See adcp#3121
for context.

Session: https://claude.ai/code/session_01QQQayoudDsHqFnpREANjJ2


Generated by Claude Code

@bokelley

bokelley commented May 3, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded — multi-id-truncation-warn shipped via #1408 (commit on main now). Same dev-mode logger.warn on the dispatch path of getMediaBuyDelivery / getMediaBuys when handler returns fewer rows than the buyer's media_buy_ids[] requested. Covered in the migration doc as a paired callout under recipe #14 / 'What else changed'.

@bokelley bokelley closed this May 3, 2026
@bokelley

bokelley commented May 3, 2026

Copy link
Copy Markdown
Contributor Author

Acknowledged — superseded by #1408, which shipped the same logger.warn on multi-id truncation in getMediaBuyDelivery / getMediaBuys. No further action needed on this draft.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants