test(e2e): forbid dev token path in staging peer visibility #1650
Reference in New Issue
Block a user
Delete Branch "fix/staging-token-diagnostic"
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
Removes the dev-only
/admin/workspaces/:id/test-tokenfallback from staging peer-visibility E2E and adds a focused staging token diagnostic forhermesvsclaude-code.Why
Staging/production E2E must prove production behavior.
/admin/workspaces/:id/test-tokenis intentionally disabled in production-like envs, so staging tests must use the production-safe admin routePOST /admin/workspaces/:id/tokensor fail.The diagnostic run also proved the original failure was not Hermes-specific: both Hermes and Claude Code failed on the stale staging tenant image, then both passed after staging CP was pointed at
platform-tenant:staging-latest.Brief-falsification log
[H1] Hermes-specific token issue.
Verification: Ran
PV_RUNTIMES='hermes claude-code' bash tests/e2e/test_peer_visibility_token_mint_staging.shagainst staging.Result: falsified. Both Hermes and Claude Code failed when staging pulled stale build
a93c4ce.[H2] Shared auth route missing because tenant image was stale.
Verification: Fresh tenant buildinfo showed
a93c4ce, which predates07457ad fix(core): add admin workspace token mint route; staging ECRlatestpointed tostaging-a93c4cewhilestaging-latestpointed to currentc3806cd.Result: supported. After switching Railway staging
TENANT_IMAGE/STAGING_TENANT_IMAGEto:staging-latestand redeploying CP, fresh tenant buildinfo showedc3806cdand token diagnostic passed for both Hermes and Claude Code.Comprehensive testing performed
bash -n tests/e2e/test_peer_visibility_mcp_staging.sh && bash -n tests/e2e/test_peer_visibility_token_mint_staging.sh && bash -n tests/e2e/test_peer_visibility_mcp_local.shif rg -n '/admin/workspaces/.*/test-token|test-token' tests/e2e/test_*staging*.sh; then exit 1; fi-> no matchesa93c4ce, bothhermesandclaude-codefailedPOST /admin/workspaces/:id/tokenswith Next.js 404c3806cd, token diagnostic passed forhermes claude-codeLocal-postgres E2E run
N/A for this PR: staging E2E harness change plus live staging diagnostic. Local peer-visibility script syntax was checked; no local platform behavior changed.
Staging-smoke verified or pending
Verified with
PV_RUNTIMES='hermes claude-code' bash tests/e2e/test_peer_visibility_token_mint_staging.shagainsthttps://staging-api.moleculesai.app. Result: passed after staging CP env moved toplatform-tenant:staging-latest.Root-cause not symptom
Root cause was staging tenant image tag drift: fresh staging tenants used stale ECR tag
latest(a93c4ce) instead of SSOT-publishedstaging-latest(c3806cd), so the production-safe admin token route did not exist in the tenant image.Five-Axis review walked
Correctness: staging tests now use only production-safe token route and classify all requested runtimes before failing. Readability: diagnostic wrapper is intentionally thin. Architecture: keeps the full MCP assertion shared; only adds a stop-after-token mode. Security: removes dev-only test-token use from staging. Performance: diagnostic mode exits before workspace online/MCP checks.
No backwards-compat shim / dead code added
Yes. No compatibility shim; the dev-only fallback was removed from staging tests.
Memory/saved-feedback consulted
No task-specific saved memory was used for this change. Applied current AGENTS/SOP and live Gitea/Railway/ECR evidence.
Verification
bash -n tests/e2e/test_peer_visibility_mcp_staging.sh && bash -n tests/e2e/test_peer_visibility_token_mint_staging.sh && bash -n tests/e2e/test_peer_visibility_mcp_local.sh->staging-no-dev-token-ok✅ token diagnostic passed for runtimes: hermes claude-codeCoverage ledger
tests/e2e/test_peer_visibility_mcp_staging.shauth_token; admin route must minttest_peer_visibility_token_mint_staging.shc3806cd.gitea/workflows/e2e-peer-visibility.yml::pr-validatetest-tokenrgfound notest-tokenintest_*staging*.shtests/e2e/test_peer_visibility_token_mint_staging.shIdempotency notes
The diagnostic uses the same scoped throwaway org teardown as the full staging peer-visibility gate. No cluster-wide cleanup.
Loki query
N/A — route/image drift was proven through tenant buildinfo, Gitea commit history, ECR tags, and live E2E output.
Tier
tier:low