feat(examples): collapse adapter-side comply gates onto framework gate (#1435 phase 3)#1470
Merged
Merged
Conversation
#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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 3 of #1435 — closes the loop on the framework-side
comply_test_controllergate that landed in #1453 (Phase 2). Thehello_seller_adapter_guaranteedexample now carries zero in-adapter comply gate logic. It's the worked zero-boilerplate adopter posture.What changed
examples/hello_seller_adapter_guaranteed.tsaccounts.resolvesynthesis branch — gate is nowif (ref.sandbox === true)(the spec-definedAccountReference.sandboxflag fromcore/account-ref.json). Stampsmode: 'sandbox'on the returnedAccount. The framework gate's resolver-path admit fires on that mode; noprocess.env.ADCP_SANDBOXis consulted.getAccountMode(ctx.account) === 'sandbox'replacesctx.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.complyTest:opts — droppedsandboxGate: () => process.env.ADCP_SANDBOX === '1'. The framework gate insidecreateAdcpServerFromPlatformis strictly stronger.test/examples/hello-seller-adapter-guaranteed.test.jsDropped
ADCP_SANDBOX: '1'fromextraEnv. The storyboard now passes purely on the resolver-stamped mode.Out of scope
hello_signals_adapter_marketplace.ts— uses the lower-levelregisterTestController(not thecomplyTest: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.resolve; the mock-server is the upstream HTTP backend (returnsnetwork_code/operator_id). Stampingmode: '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 buildcleannpm run test:lib— 6041 pass / 0 fail / 3 skipped (unchanged)node --test test/examples/hello-seller-adapter-guaranteed.test.js— 3/3 pass withoutADCP_SANDBOX=1npm run format:checkcleanADCP_SANDBOX/sandboxGatereferences in the guaranteed example are in explanatory comments pointing at the framework gateRefs
Account.mode,getAccountMode,assertSandboxAccountcreateAdcpServerFromPlatform)docs/proposals/lifecycle-state-and-sandbox-authority.md🤖 Generated with Claude Code