test(e2e): keyless required-lane coverage for mock runtime + terminal/webhooks/budget/checkpoints/audit/traces/session-search/rescue/billing-mode/resume/hibernate + wire orphaned secrets-dispatch #2293
Reference in New Issue
Block a user
Delete Branch "harden/keyless-feature-e2e-coverage"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Keyless, REQUIRED-lane (
E2E API Smoke Test) e2e coverage for the CTO goal "e2e covers every runtime and feature, no regressions" — the feature endpoints + lifecycle that ship without an LLM key and had no e2e assertion in the required lane, plus wiring an orphaned keyless contract test.New script —
tests/e2e/test_keyless_feature_contracts_e2e.shSelf-contained, hermetic (one
runtime=externalfixture, NO LLM key). For each endpoint it asserts the real HTTP contract and a meaningful failure mode so a regression goes RED, not silently green:GET /workspaces/:id/terminal/diagnoseworkspace_id+steps[]POST /webhooks/:typeignored(non-message)GET /workspaces/:id/budget+PATCH/workspaces/:id/checkpoints*GET /workspaces/:id/audittotal:0+chain_valid:nullfrom, 401GET /workspaces/:id/traces[]without LangfuseGET /workspaces/:id/session-search[]missGET /workspaces/:id/rescueMOLECULE_ORG_ID)GET/PUT /admin/workspaces/:id/llm-billing-modebyok+ readbackpause→resume+hibernateAuth mirrors
wsauth_middleware.go: WorkspaceAuth is strict (401 without bearer once a token exists); AdminAuth accepts the platformADMIN_TOKENor the workspace bearer (Tier-3). The script resolves its admin bearer fromMOLECULE_ADMIN_TOKEN/ADMIN_TOKENif set, else the minted workspace token — so it is green in both the current no-ADMIN_TOKENCI shape and the post-#2286ADMIN_TOKENshape.Mock runtime
The mock-runtime A2A canned round-trip is owned by #2286's
mockarm (run_mockintest_priority_runtimes_e2e.sh) — intentionally not duplicated here.Wire orphaned test
tests/e2e/test_secrets_dispatch.shwas referenced by NO workflow. Added as a required-lane step. It is hermetic (extracts + runs theSECRETS_JSONbranch-order block in isolation — no platform, no bearer, no network), guarding the 2026-05-03 "wrong LLM-key shape wins" incident class.Coordination with #2286 (open)
#2286 (
harden/enforce-ci-gates-core-v2) ownse2e-api.yml's admin-auth wiring,_lib.sh'se2e_admin_auth_args,test_api.sh's auth helpers, and thetest_priority_runtimesruntime arms. This PR touches none of those — it only adds tworun:steps toe2e-api.ymland adds one new file. Rebases cleanly whether #2286 lands first or this does.Proof
Local PG + Redis +
platform-server(CI shape):ADMIN_TOKENset): 48/48 greenADMIN_TOKEN): 48/48 greentest_secrets_dispatch.sh: 10/10 green; existingtest_api.shunchanged 61/61 greenbash -n+shellcheckclean (only the suite-standard SC1091 source-follow info)No "flaky": every assertion keys off a deterministic state (fresh-workspace zero-rows, fail-closed status, fixed status transitions, sorted/keyed responses).
Not keyless-coverable (flagged for staging tier)
GET /workspaces/:id/terminalitself is a WebSocket upgrade, not HTTP-assertable in this lane — its pure-HTTP sibling/terminal/diagnoseis covered instead./rescuehappy path (200 bundle) needs a captured rescue bundle +MOLECULE_ORG_ID; only the fail-closed 503 contract is keyless here. Full bundle round-trip belongs in the staging-saas tier./resume200-vs-503 depends on whether a provisioner is wired; the test accepts either valid contract.🤖 Generated with Claude Code
Closes coverage-audit gaps for CI-coverable, keyless feature endpoints that had NO e2e assertion in the required `E2E API Smoke Test` lane. New: tests/e2e/test_keyless_feature_contracts_e2e.sh — a self-contained, hermetic script (runtime=external fixture, NO LLM key) asserting the real HTTP contract + a meaningful failure mode for each endpoint: * GET /workspaces/:id/terminal/diagnose — 200 report / 401 no-auth (the /terminal WS-upgrade sibling that is HTTP-assertable keyless) * POST /webhooks/:type (public) — 200 ignored / 400 bad-json / 404 unknown * GET /workspaces/:id/budget + PATCH — periods view / set+persist / 400 / 401 * /workspaces/:id/checkpoints* — upsert→latest→list→delete→404 / 400 / 401 * GET /workspaces/:id/audit — total0+chain_valid null / 400 bad-from / 401 * GET /workspaces/:id/traces — 200 [] without Langfuse / 401 * GET /workspaces/:id/session-search — q-filter hit / [] miss / 401 * GET /workspaces/:id/rescue — fail-closed 503 (no MOLECULE_ORG_ID) / 401 * GET/PUT /admin/workspaces/:id/llm-billing-mode — flip byok+readback / 400 ×3 * Lifecycle pause→resume + hibernate — transitions / 404 wrong-state / 401 Auth model mirrors wsauth_middleware.go: WorkspaceAuth is strict (401 without bearer once a token exists), AdminAuth accepts the platform ADMIN_TOKEN OR the workspace bearer (Tier-3) — so the script is green in BOTH the current no-ADMIN_TOKEN CI shape and the post-#2286 ADMIN_TOKEN shape (proven locally, 48/48 each). Mock-runtime A2A canned round-trip is left to #2286's mock arm (not duplicated). Does not touch e2e-api.yml admin-auth wiring or test_priority_runtimes runtime arms (#2286 owns those) — only adds run steps. Wire: tests/e2e/test_secrets_dispatch.sh was orphaned (no workflow ran it). Added as a required-lane step. It is hermetic (extracts + runs the SECRETS_JSON branch-order block in isolation; no platform/bearer/network), guarding the 2026-05-03 "wrong LLM-key shape wins" incident class. Proof: local PG+Redis+platform-server (CI shape), all three scripts GREEN in lane order under both auth shapes; bash -n + shellcheck clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>Reviewed: keyless feature-contract coverage — 48 assertions across 11 endpoints (terminal-diagnose, webhooks, budget, checkpoints, audit, traces, session-search, rescue fail-closed, billing-mode flip, pause/resume/hibernate) each with happy + failure case, in the required E2E API Smoke lane; wires the orphaned secrets-dispatch test in. New self-contained script (no conflict with #2286 helpers). Locally proven 48/48 both auth shapes. Closes the keyless feature-coverage gap for the no-regressions goal. Approve.
5-axis review: APPROVED.
Correctness: This adds required-lane keyless E2E coverage for the feature endpoints named in the PR: terminal diagnose, webhooks, budget, checkpoints, audit, traces, session search, rescue, LLM billing mode, pause/resume, and hibernate. Each path has a happy-path assertion plus a meaningful failure mode, and the workflow now also runs the previously orphaned secrets-dispatch contract test.
Robustness: The fixture uses an external workspace and token/admin-auth handling that works across the pre/post ADMIN_TOKEN E2E shapes. The script accumulates assertion failures and exits non-zero at the end, so multiple contract breaks are visible in one run. Security: no LLM keys or live provider secrets are required; the tests explicitly validate auth rejection and fail-closed behavior. Performance: bounded curl-based E2E coverage in the existing E2E API Smoke lane; no unbounded loops or external provider calls. Readability: the script is long, but endpoint sections are named and the comments explain the key auth and fail-closed contracts.
Required-context review: head
d3d108a636is mergeable; CI/all-required, E2E API Smoke, and Handlers PG are green. Combined red is not used as the gate.