Skip to content

feat(examples): add hello_seller_adapter_proposal_mode for sole-stateful exemption coverage (#1549) - #1594

Merged
bokelley merged 1 commit into
mainfrom
bokelley/issue-1549-hello-proposal-mode-adapter
May 8, 2026
Merged

bokelley merged 1 commit into
mainfrom
bokelley/issue-1549-hello-proposal-mode-adapter

Conversation

@bokelley

@bokelley bokelley commented May 8, 2026

Copy link
Copy Markdown
Contributor

Closes #1549. Companion to PR #1548 (cascade-skip matrix refactor) and PR #1545 (the runner fix that surfaced the coverage gap).

Summary

Wires comply_test_controller into examples/hello_seller_adapter_proposal_mode.ts and adds invariant assertions to its gate test that verify the SDK behavior PR adcp-client#1545 introduced: a proposal-mode adopter that doesn't advertise sync_accounts (because account state materializes on the first get_products call) MUST NOT trip the cross-phase cascade.

nodejs-testing-expert's review on PR #1545 noted that none of the existing test/examples/hello-* adapters are shaped like proposal-mode — they all advertise sync_accounts, so the example-adapter test layer never exercised the sole-stateful-step pattern that PR adcp-client-python#550 hit. The runner-level invariant test added in PR #1545 covers the unit layer (cascade-skip-on-skip matrix); this PR adds the end-to-end mirror of how a real proposal-mode adopter exercises the SDK.

What the adapter advertises

Proposal-mode declares accounts.resolution: 'explicit', which the framework projects to account.require_operator_auth: true. Buyers discover accounts via list_accounts; the adapter doesn't implement sync_accounts. Tools advertised:

  • get_products — returns proposals[] alongside products[] when a brief is supplied (catalog mode otherwise).
  • get_products buying_mode: refine — refines a proposal (with optional action: finalize to commit).
  • create_media_buy — accepts proposal_id to convert a committed proposal into an active buy.
  • update_media_buy / get_media_buy_delivery / get_media_buys / tasks/get.
  • comply_test_controller (sandbox-gated via mode==='sandbox') — seed.media_buy, force.media_buy_status, simulate.delivery for parity with the other reference seller adapters; relevant when the broader sales_proposal_mode storyboard suite drives cascade scenarios.

Pointedly NOT advertised: sync_accounts, list_accounts. The adapter's whole point is the implicit-account / proposal-mode shape.

Proposal lifecycle wiring

  • getProducts mints a draft via the upstream /v1/proposals route when a brief lands; returns the proposals array unchanged.
  • refineProducts reads refine[].proposal_id and POSTs to /v1/proposals/{id}/refine.
  • finalizeProposal POSTs to /v1/proposals/{id}/finalize, refreshes recipes with the locked CPM and upstream line-item template ids, and hands the recipe map back to the framework. The framework stores it on the InMemoryProposalStore and hydrates ctx.recipes for the subsequent create_media_buy(proposal_id=...) call.
  • sales.createMediaBuy reads ctx.recipes, splits the budget across allocated products, and creates one upstream order + per-product line items.

State persists in ctx_metadata (per docs/guides/CTX-METADATA-SAFETY.md — non-secret upstream IDs only; credentials are re-derived per-request via verifyApiKey).

Gate test assertions

Three shared gates via runHelloAdapterGates (tsc-strict, storyboard, façade) plus issue-#1549 invariant assertions threaded into filterFailures so they run on every storyboard pass:

  1. sync_accounts carries the sole-stateful exemption marker. The setup-phase sync_accounts step is skipped: true, its skip_reason is in the exemption family (not_applicable / missing_tool / missing_test_controller — proposal-mode adopters land on not_applicable via the require_operator_auth projection), AND its warnings[0] matches /Sole stateful step exemption applied for phase 'setup'/ (the marker PR adcp-client#1545 emits at runner.ts:145).
  2. No downstream phase is cascade-skipped from setup. For each of brief_with_proposals, refine_proposal, finalize_proposal, accept_proposal, every step's skip detail must NOT match /prior stateful step "sync_accounts" (skipped|failed)/. Phases may pass, fail, or skip on their own merits — but never with detail naming sync_accounts as the cascade trigger.
  3. Stale-allowlist defensive check. EXPECTED_FAILURES lists get_products_refine (the one step blocked by the storyboard placeholder gap at adcp#4086 / draft PR #4088). When that PR lands and the refine step starts passing, the defensive check flips the gate red so the allowlist gets dropped — silent green CI on a stale entry would hide regressions.

Adversarial-sabotage validated locally: temporarily inverting EXEMPTION_MARKER to a synthetic regex makes assertion (1) fire with a clean diagnostic; flipping assert.doesNotMatch to assert.match on the empty-warnings happy path makes assertion (2) fire.

Non-obvious decisions

  • Skip reason is not_applicable, not missing_tool. The issue text says "missing_tool"; the actual current SDK behavior is not_applicable because the proposal-mode adapter declares accounts.resolution: 'explicit' which auto-projects account.require_operator_auth: true. PR adcp-client#1545 expanded the exemption family to cover both. The assertion accepts any reason in the exemption family so a future projection change doesn't flip the test red without an underlying behavior regression.
  • comply_test_controller is wired even though proposal_finalize.yaml doesn't invoke it. The issue requires the controller surface for parity with other reference adapters and for the broader sales_proposal_mode storyboard suite (which fans out into delivery_reporting, invalid_transitions, pending_creatives_to_start — all of which DO drive the controller). Wiring it into the proposal-mode adapter completes the reference set.
  • EXPECTED_FAILURES accepts get_products_refine. The proposal_finalize storyboard sends the literal balanced_reach_q2 placeholder as refine[0].proposal_id. The adapter forwards that id to its upstream which 404s. Tracked at adcp#4086 + draft PR #4088 (storyboard fix to add context_outputs/context_inputs chaining). Per the implementation guidance in Storyboard examples: add hello-seller-adapter-proposal-mode for sole-stateful-step coverage #1549, runner gaps that prevent the test from passing get filed as separate issues rather than worked around in the adapter — adcp#4086 was already filed and PR #4088 is in flight.

Test plan

  • node --test test/examples/hello-seller-adapter-proposal-mode.test.js passes (3/3 gates green).
  • node --test test/examples/hello-seller-adapter-guaranteed.test.js still passes (helper change-free).
  • npx tsc --noEmit clean across the project.
  • npm run format:check clean.
  • Adversarial sabotage: invert exemption marker → assertion (1) fires; flip downstream-phase doesNotMatch → assertion (2) fires.
  • Spot-run: adcp storyboard run http://127.0.0.1:PORT/mcp media_buy_seller/proposal_finalize --json returns overall_status: partial with the expected get_products_refine failure and the cascade-blocked downstream phases — matching the gate test's allowlist.

🤖 Generated with Claude Code

…ller_adapter_proposal_mode (#1549)

Wires comply_test_controller into the proposal-mode reference adapter
(seed.media_buy / force.media_buy_status / simulate.delivery, gated by
the framework's mode==='sandbox' admission per the other reference
sellers) and adds invariant assertions to the gate test that verify the
SDK behavior PR #1545 introduced: sync_accounts skip carries the
sole-stateful exemption marker AND none of the four downstream phases
(brief_with_proposals, refine_proposal, finalize_proposal,
accept_proposal) are cascade-skipped from the setup-phase skip.

Closes the example-tier coverage gap nodejs-testing-expert flagged on
PR #1545. The runner-level invariant test in the cascade-skip-on-skip
matrix already covers the unit layer; this adds the end-to-end mirror
of how proposal-mode adopters (adcp-client-python#550) actually
exercise the SDK.

The proposal lifecycle past brief_with_proposals stops on the
balanced_reach_q2 placeholder gap tracked at adcp#4086 + draft PR
#4088. The gate test acknowledges the failure via EXPECTED_FAILURES so
the issue-#1549 invariants run against a clean grader output, and the
defensive stale-allowlist check flips the gate red the moment that
spec PR lands.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@bokelley
bokelley merged commit 6b596e0 into main May 8, 2026
10 checks passed
bokelley added a commit that referenced this pull request May 8, 2026
…fork-target pointers (#1385) (#1597)

* docs(skills): collapse signal/creative/seller specialism skills onto fork-target pointers (#1385)

Extends the PR #1373 precedent (each specialism = "fork target +
deltas") to the in-scope specialisms. Each specialism file now opens
with a fork-target pointer and SHAPE-GOTCHAS reference; only this
specialism's deltas remain.

In-scope specialisms touched:

- signal-marketplace, signal-owned: full fork-target shape;
  signal-owned now a delta-only section.
- creative-generative: reuses creative-template adapter; delta-only
  section for brief-to-creative input + brand resolution.
- sales-broadcast-tv: reuses sales-guaranteed; DMA, GRP, daypart,
  agency estimate number, measurement windows.
- sales-streaming-tv (NEW): reuses sales-guaranteed; CTV deltas.
  Preview specialism — placeholder storyboard.
- sales-catalog-driven, sales-retail-media: reuses sales-social
  adapter (already implements syncCatalogs/syncEventSources/logEvent).
- audience-sync: reuses sales-social; audiences-only slice, no
  SalesCorePlatform.
- sales-proposal-mode: full pointer to PR #1594 hello adapter;
  deltas around ProposalManager + ctx.recipes hydration +
  sole-stateful-step exemption + ctx_metadata.
- build-seller-agent/SKILL.md: specialism table now lists each
  fork target + link to its deltas page.

* chore(changeset): add changeset for #1385 docs collapse

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

---------

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.

Storyboard examples: add hello-seller-adapter-proposal-mode for sole-stateful-step coverage

1 participant