Skip to content

fix(bridge): debug log on sandbox-gate reject across 13 dispatcher branches#1780

Merged
bokelley merged 2 commits into
mainfrom
bokelley/bridge-debug-log-gate-reject
May 16, 2026
Merged

fix(bridge): debug log on sandbox-gate reject across 13 dispatcher branches#1780
bokelley merged 2 commits into
mainfrom
bokelley/bridge-debug-log-gate-reject

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

Summary

  • Single logger.debug line in src/lib/server/create-adcp-server.ts that fires when the request carries a sandbox marker but the resolved ctx.account is explicitly sandbox: false.
  • Covers all 13 dispatcher branches in one shot — the debug emit sits between the request-sandbox check and the resolved-account check, so every per-tool branch inherits it without per-branch wiring.
  • Three regression tests in test/lib/seed-per-tool-wiring.test.js: gate-mismatch fires, production traffic does not fire, gate-pass does not fire and merge proceeds.

Why

After #1753 shipped, the #1 adopter support question was "why aren't my fixtures showing in storyboards" when their request was sandbox-shaped but their resolved account was production. The gate rejected silently and adopters had no diagnostic surface. The dev-only debug line surfaces the rejection without adding production-traffic noise — production traffic fails the first gate (isSandboxRequest) and never reaches this branch.

Product-review-driven during the post-merge review of (now-closed) #1754.

Test plan

  • NODE_ENV=test node --test test/lib/seed-per-tool-wiring.test.js — 138/138 pass (3 new + 135 existing).
  • tsc --noEmit clean.
  • prettier --check clean.
  • Pre-push validation (build + typecheck) clean.

…account mismatch

When an adopter sets account.sandbox: true (or context.sandbox: true) on
a request but resolveAccount returns sandbox: false, the dispatcher's
TestControllerBridge gate rejects the merge silently. Adopters chasing
"why aren't my fixtures showing in storyboards" had no diagnostic
surface — the request looked sandbox-shaped but no fixtures appeared
and no logs explained the gap. That was the #1 adopter support question
after #1753 shipped.

Adds a single logger.debug line inside create-adcp-server.ts covering
all 13 dispatcher branches in one shot — the diagnostic fires after
the request-sandbox check passes but before the resolved-account
check. Production traffic (no sandbox marker on request) fails the
first gate and never reaches this branch, so the log surface is
dev-only.

Three regression tests in seed-per-tool-wiring.test.js verify:
gate-mismatch fires debug; production traffic does not fire debug;
gate-pass does not fire debug and merge proceeds normally.

Product-review-driven during the post-merge review of (now-closed)
#1754.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Product-expert review of PR #1780 flagged the log line as diagnostic
but not prescriptive — it told you *what* (gate rejected) but not
*what to change* (which tenant key resolved to sandbox: false). Adding
resolved_account_id to the structured meta makes the line self-
diagnostic for the common case: scope3-shaped adopters can match the
rejected account against their resolveAccount source without
correlating across log lines.

account_ids appear in normal request logs already; no new PII surface.

Regression test updated to assert hit.data.resolved_account_id.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bokelley bokelley merged commit c02406a into main May 16, 2026
10 checks passed
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