Skip to content

fix(examples): wire assertMediaBuyTransition into hello_seller_adapter_non_guaranteed (#1499) - #1513

Merged
bokelley merged 1 commit into
mainfrom
bokelley/issue-1499-non-guaranteed-state-machine
May 3, 2026
Merged

bokelley merged 1 commit into
mainfrom
bokelley/issue-1499-non-guaranteed-state-machine

Conversation

@bokelley

@bokelley bokelley commented May 3, 2026

Copy link
Copy Markdown
Contributor

Closes #1499.

Why

The non-guaranteed worked-reference adapter had no state-machine enforcement on update_media_buy. The cascade media_buy_seller/invalid_transitions/second_cancel failed because the adapter accepted a re-cancel instead of rejecting with NOT_CANCELLABLE. SDK-side helpers shipped in 6.7 (MEDIA_BUY_TRANSITIONS + assertMediaBuyTransition, closing #1416) but this example didn't wire them.

What

  • Import assertMediaBuyTransition and AdcpMediaBuyStatus from @adcp/sdk/server
  • Add per-buy localBuyStatus Map for paused | canceled (mock upstream doesn't model these)
  • In updateMediaBuy, call assertMediaBuyTransition(currentStatus, 'canceled') on cancel and assertMediaBuyTransition(currentStatus, 'paused') on pause-of-active. Matches the guaranteed adapter's pattern
  • Drop adcp-client#1416 mask from the gate test; storyboard now passes unfiltered

Test plan

  • npm run format:check — clean
  • npm run typecheck — clean
  • npm run build:lib — clean
  • node --test test/examples/hello-seller-adapter-non-guaranteed.test.js — 3/3 pass with EXPECTED_FAILURES = []

🤖 Generated with Claude Code

…r_non_guaranteed (closes #1499)

The non-guaranteed worked-reference adapter had no state-machine
enforcement on update_media_buy; the cascade scenario
media_buy_seller/invalid_transitions/second_cancel failed because the
adapter accepted re-cancel instead of rejecting with NOT_CANCELLABLE.
SDK-side helpers shipped in 6.7 (MEDIA_BUY_TRANSITIONS +
assertMediaBuyTransition) but the example didn't wire them.

Adds a per-buy localBuyStatus Map for paused/canceled states (the mock
upstream doesn't model these) and calls assertMediaBuyTransition on
every cancel/pause path. Matches the pattern already in
hello_seller_adapter_guaranteed.

Drops the adcp-client#1416 mask from the gate test; the storyboard now
passes unfiltered.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@bokelley
bokelley merged commit ee12ec4 into main May 3, 2026
10 checks passed
bokelley added a commit that referenced this pull request May 3, 2026
Pulls in 4 commits:
 - docs(skills): close three #1496 follow-up review items + seller adapter format slot sweep (#1515)
 - docs(migration): add recipe #10b for derived-mode account_id refusal (#1492) (#1512)
 - fix(codegen): preserve asset_type discriminator on Individual*Asset slot types (closes #1498) (#1514)
 - fix(examples): wire assertMediaBuyTransition into hello_seller_adapter_non_guaranteed (closes #1499) (#1513)

Conflict resolution:

- src/lib/types/core.generated.ts: kept the 3.0.6 generation header from
  HEAD; ran `npm run generate-types:all` against the local mirror to
  pull in main's #1514 codegen fix (asset_type discriminator preserved
  on Individual*Asset slots) layered on top of 3.0.6 schemas.
- test/examples/hello-seller-adapter-non-guaranteed.test.js: kept main's
  empty allowlist + new helper-shape conditional. Main's #1513 closes
  #1416 by actually wiring `assertMediaBuyTransition` into the
  non-guaranteed adapter — superseding the follow-up note my branch
  carried.

Verified post-merge:
- npm run build clean
- 6/6 hello-adapter tests for the modified files green
- npm run format:check clean

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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.

fix(examples): wire assertMediaBuyTransition into hello_seller_adapter_non_guaranteed

1 participant