Skip to content

fix: guard against top-level setup in media buy responses#556

Merged
bokelley merged 1 commit into
mainfrom
bokelley/setup-url-guard
Apr 17, 2026
Merged

fix: guard against top-level setup in media buy responses#556
bokelley merged 1 commit into
mainfrom
bokelley/setup-url-guard

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

Response builders (mediaBuyResponse, updateMediaBuyResponse, getMediaBuysResponse) now throw a descriptive error when setup appears at the top level of a media buy instead of nested inside account.setup.

Why

The IO-signing setup URL belongs on Account.setup, not on the media buy itself. Nothing in the schema has top-level setup on MediaBuy / CreateMediaBuySuccess / UpdateMediaBuySuccess, but DomainHandler accepts Record<string, unknown> (DX fix from #548), so TypeScript stops catching the mistake. Storyboard "expected" narrative uses setup.url shorthand, which agent builders were mirroring as a top-level field.

Error

mediaBuyResponse: `setup` is not a field on the media buy — it belongs inside
`account.setup`. Move `{ setup: { url, message } }` to
`{ account: { ..., setup: { url, message } } }`. The setup URL is a property
of the Account (returned alongside `status: 'pending_approval'`), not the MediaBuy.

Related

Test plan

  • 3 new unit tests in test/server-responses.test.js (throws for each builder, accepts nested case)
  • Full test suite: 3174 pass / 0 fail / 2 skipped
  • Changeset included (patch)

🤖 Generated with Claude Code

IO-signing setup URL belongs inside `account.setup` (a field on `Account`),
not on the media buy itself. The strict handler types would catch this, but
`DomainHandler` accepts `Record<string, unknown>` for handler DX, so the
mistake slipped through to runtime with no feedback.

`mediaBuyResponse`, `updateMediaBuyResponse`, and `getMediaBuysResponse` now
throw a descriptive error pointing the builder to the correct location.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bokelley
bokelley merged commit 4e0c482 into main Apr 17, 2026
11 checks passed
@bokelley
bokelley deleted the bokelley/setup-url-guard branch April 17, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant