Skip to content

feat(examples): collapse adapter-side comply gates onto framework gate (#1435 phase 3)#1470

Merged
bokelley merged 1 commit into
mainfrom
bokelley/phase-3-collapse-comply-gates
May 3, 2026
Merged

feat(examples): collapse adapter-side comply gates onto framework gate (#1435 phase 3)#1470
bokelley merged 1 commit into
mainfrom
bokelley/phase-3-collapse-comply-gates

Conversation

@bokelley

@bokelley bokelley commented May 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Phase 3 of #1435 — closes the loop on the framework-side comply_test_controller gate that landed in #1453 (Phase 2). The hello_seller_adapter_guaranteed example now carries zero in-adapter comply gate logic. It's the worked zero-boilerplate adopter posture.

What changed

examples/hello_seller_adapter_guaranteed.ts

  1. accounts.resolve synthesis branch — gate is now if (ref.sandbox === true) (the spec-defined AccountReference.sandbox flag from core/account-ref.json). Stamps mode: 'sandbox' on the returned Account. The framework gate's resolver-path admit fires on that mode; no process.env.ADCP_SANDBOX is consulted.
  2. HITL bypassgetAccountMode(ctx.account) === 'sandbox' replaces ctx.account.id.startsWith(SANDBOX_ID_PREFIX) && process.env.ADCP_SANDBOX === '1'. Same trust signal but no env var; more robust against any production account whose id happens to share the sandbox prefix.
  3. complyTest: opts — dropped sandboxGate: () => process.env.ADCP_SANDBOX === '1'. The framework gate inside createAdcpServerFromPlatform is strictly stronger.

test/examples/hello-seller-adapter-guaranteed.test.js

Dropped ADCP_SANDBOX: '1' from extraEnv. The storyboard now passes purely on the resolver-stamped mode.

Out of scope

  • hello_signals_adapter_marketplace.ts — uses the lower-level registerTestController (not the complyTest: opts surface). Phase 2's gate doesn't intercept that path. Migration is non-mechanical (would need the recorder integration to fit a comply-adapter shape upstream); leaving on the legacy path. Tracked as a follow-up.
  • Mock-server — unchanged. Account synthesis happens in the adapter's resolve; the mock-server is the upstream HTTP backend (returns network_code / operator_id). Stamping mode: 'sandbox' lives in the resolver, where it belongs.
  • test/server-decisioning-comply-test.test.js — left alone. It intentionally exercises the deprecated env-fallback admit path so the bridge stays tested through its life.
  • hello_seller_adapter_social.ts, hello_seller_adapter_multi_tenant.ts, hello_creative_adapter_template.ts — none wire the controller. Nothing to do.

Test plan

  • npm run build clean
  • npm run test:lib — 6041 pass / 0 fail / 3 skipped (unchanged)
  • node --test test/examples/hello-seller-adapter-guaranteed.test.js — 3/3 pass without ADCP_SANDBOX=1
  • All 5 hello-adapter test files — 19/19 pass
  • npm run format:check clean
  • Verified: post-Phase-3, the only ADCP_SANDBOX / sandboxGate references in the guaranteed example are in explanatory comments pointing at the framework gate

Refs

🤖 Generated with Claude Code

#1435 phase 3)

The hello_seller_adapter_guaranteed example no longer carries any in-adapter
comply_test_controller gate logic — it's the worked zero-boilerplate
adopter posture Phase 2 enabled.

Three changes:

1. accounts.resolve synthesis branch — drop `&& process.env.ADCP_SANDBOX === '1'`
   from the cascade-scenario gate (now `if (ref.sandbox === true)`) and stamp
   `mode: 'sandbox'` on the returned Account so the framework gate's
   resolver-path admit fires.

2. HITL bypass — replace
   `ctx.account.id.startsWith(SANDBOX_ID_PREFIX) && process.env.ADCP_SANDBOX === '1'`
   with `getAccountMode(ctx.account) === 'sandbox'`. Same trust signal, no env,
   more robust against production accounts that share the sandbox id prefix.

3. complyTest opts — drop `sandboxGate: () => process.env.ADCP_SANDBOX === '1'`.
   The framework gate inside createAdcpServerFromPlatform is strictly stronger;
   the in-adapter callback was redundant.

Test wiring: `test/examples/hello-seller-adapter-guaranteed.test.js` no longer
sets ADCP_SANDBOX=1 in extraEnv. Storyboard passes (3/3) purely on the
resolver-stamped mode.

Other Hello adapters were already clean. hello_signals_adapter_marketplace
uses the lower-level registerTestController (not Phase-2-gated) and stays on
the legacy path. Mock-server unchanged: account synthesis lives in the
adapter's resolver, not the upstream backend.

Existing env-fallback coverage retained: server-decisioning-comply-test.test.js
keeps exercising the ADCP_SANDBOX path so the deprecated bridge stays tested
through its life.

Closes phase 3 of #1435.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bokelley bokelley merged commit 796fa5d into main May 3, 2026
10 checks passed
@bokelley bokelley deleted the bokelley/phase-3-collapse-comply-gates branch May 3, 2026 14:47
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