Skip to content

Commit 89d1f25

Browse files
fix(e2e-account): route CI-only error codes to coverage allowlist; untrack dump.rdb
The e2e-account error codes (not_test_cohort, team_create_failed, user_create_failed, tier_not_allowed, tier_set_failed, rand_failed) are operator/CI-only — emitted only on the guarded /internal/e2e/account surface that is inert by default (404 unless E2E_ACCOUNT_TOKEN is set) and driven by the machine-to-machine E2E harness, never a customer agent. They were previously added to codeToAgentAction with operator-facing copy, which violated the customer-facing agent_action contract (TestAgentActionContract requires every entry to start "Tell the user ..." and carry a customer recovery URL). Move them to error_envelope_coverage_test.go's coverageAllowlist with a per-code rationale instead: the 503 arms fall back to AgentActionContactSupport via respondError's status>=500 path; the 4xx arms (400/403/429) carry a self-explanatory message with no agent_action, which is correct for a CI caller. Also untrack dump.rdb (local Redis artifact accidentally committed) and add it to .gitignore. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e160b72 commit 89d1f25

4 files changed

Lines changed: 29 additions & 24 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ node_modules
88

99
# Internal Claude Code skills (per-repo)
1010
.claude/
11+
12+
# Local Redis dump artifact — never commit
13+
dump.rdb

dump.rdb

-3.65 KB
Binary file not shown.

internal/handlers/error_envelope_coverage_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,21 @@ var coverageAllowlist = map[string]string{
4545
// real handler call sites. Filtered by the test (see emitCode).
4646
"code": "regex artefact — not a real emit",
4747
"x": "regex artefact — not a real emit",
48+
49+
// CI-only ephemeral-test-account surface (POST/DELETE /internal/e2e/account).
50+
// These codes are emitted only on the operator/CI-guarded endpoint, which is
51+
// inert by default (404 unless E2E_ACCOUNT_TOKEN is set) and driven by the
52+
// machine-to-machine E2E harness — never a customer agent. A customer-style
53+
// "Tell the user … https://instanode.dev/…" agent_action would be wrong for
54+
// a CI caller, so they intentionally carry no codeToAgentAction entry: the
55+
// 503 arms fall back to AgentActionContactSupport, the 4xx arms to an empty
56+
// agent_action with a self-explanatory message.
57+
"not_test_cohort": "CI-only /internal/e2e/account reap-safety 403 (machine-to-machine; not customer-facing)",
58+
"team_create_failed": "CI-only /internal/e2e/account mint 503 (machine-to-machine; not customer-facing)",
59+
"user_create_failed": "CI-only /internal/e2e/account mint 503 (machine-to-machine; not customer-facing)",
60+
"tier_not_allowed": "CI-only /internal/e2e/account gated-tier 400 (machine-to-machine; not customer-facing)",
61+
"tier_set_failed": "CI-only /internal/e2e/account mint 503 (machine-to-machine; not customer-facing)",
62+
"rand_failed": "CI-only /internal/e2e/account mint 503 (machine-to-machine; not customer-facing)",
4863
}
4964

5065
// TestErrorCode_HasAgentAction is the registry-iterating coverage gate.

internal/handlers/helpers.go

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,30 +1199,17 @@ var codeToAgentAction = map[string]errorCodeMeta{
11991199
AgentAction: "Tell the user this action requires a fresh session (admin-scope PAT mints need re-auth). Sign in again at https://instanode.dev/login — see https://instanode.dev/docs/auth.",
12001200
},
12011201

1202-
// ── CI-only ephemeral-test-account surface (POST/DELETE /internal/e2e/account) ──
1203-
// These codes only ever surface to the CI harness driving the guarded
1204-
// E2E_ACCOUNT_TOKEN endpoint — never to a real customer agent (the route
1205-
// is inert/404 unless the token is configured). The agent_action is
1206-
// therefore operator-facing: it points at the token + request shape rather
1207-
// than a customer recovery URL.
1208-
"not_test_cohort": {
1209-
AgentAction: "This is the guarded CI test-account endpoint: the target team is not in the test cohort, so it can never be reaped here. Operators: only is_test_cohort teams minted via POST /internal/e2e/account are reapable — check the team_id in the request.",
1210-
},
1211-
"rand_failed": {
1212-
AgentAction: "This is the guarded CI test-account endpoint: secure random generation failed while minting the account id. Operators: retry; if it persists the host's entropy source is unavailable.",
1213-
},
1214-
"team_create_failed": {
1215-
AgentAction: "This is the guarded CI test-account endpoint: creating the test team failed. Operators: check platform_db connectivity and the E2E_ACCOUNT_TOKEN / request before retrying.",
1216-
},
1217-
"tier_not_allowed": {
1218-
AgentAction: "This is the guarded CI test-account endpoint: the requested tier is not mintable here. Operators: pass an allowed tier (free/hobby/hobby_plus/pro) in the request — see the endpoint's tier allowlist.",
1219-
},
1220-
"tier_set_failed": {
1221-
AgentAction: "This is the guarded CI test-account endpoint: elevating the test team to the requested tier failed. Operators: check platform_db connectivity and the request before retrying.",
1222-
},
1223-
"user_create_failed": {
1224-
AgentAction: "This is the guarded CI test-account endpoint: creating the test primary user failed. Operators: check platform_db connectivity and the E2E_ACCOUNT_TOKEN / request before retrying.",
1225-
},
1202+
// NOTE: the CI-only ephemeral-test-account error codes (not_test_cohort,
1203+
// team_create_failed, user_create_failed, tier_not_allowed, tier_set_failed,
1204+
// rand_failed) are deliberately NOT registered here. codeToAgentAction holds
1205+
// CUSTOMER-facing agent guidance — the contract test (TestAgentActionContract)
1206+
// requires every entry to start "Tell the user …" and carry a customer
1207+
// recovery URL. The /internal/e2e/account surface is operator/CI-only and
1208+
// inert by default (404 unless E2E_ACCOUNT_TOKEN is set), so its codes never
1209+
// reach a customer agent: the 503 arms already get the generic
1210+
// AgentActionContactSupport via respondError's status>=500 fallback, and the
1211+
// 4xx arms (400/403/429) carry a self-explanatory message with no
1212+
// agent_action — correct for a machine-to-machine CI caller.
12261213
}
12271214

12281215
// ErrorResponse is the canonical JSON shape for every 4xx/5xx response.

0 commit comments

Comments
 (0)