Commit 16ae02d
test(e2e): W1 LIVE auth/login coverage (OAuth, logout-revocation, CLI, /auth/me, CORS) (#172)
Adds e2e/live-auth.spec.ts — the W1 (P0) real-backend auth suite from
docs/sessions/2026-06-04/USER-FLOW-INVENTORY-AND-TEST-MATRIX.md §W1. Closes
the matrix gap whose failure surface caused the 2026-05-29→30 prod-login
outage (a UI↔backend auth-integration regression).
Legs covered (E2E_LIVE=1-gated; whole file skips loudly in per-PR CI so the
gate never depends on a live backend):
- A4/A6 GitHub OAuth: start → github.com authorize w/ single-use state;
forged/never-issued state callback must fail closed (no session_token).
- A7 /auth/exchange CORS contract (ACAC:true + ACAO:https://instanode.dev) —
the AUTH-004 surface.
- A8/A9 /auth/me: valid synthetic bearer → 200 + claimed email + tier='free';
tampered + expired bearers → 401.
- A10 logout revocation (the precise incident class): valid bearer 200 →
POST /auth/logout → SAME bearer/jti on /auth/me → 401.
- A12/A13 CLI device-flow: POST /auth/cli auth_url host == canonical
instanode.dev (parsed hostname, not the api host); pre-approval poll →
status, no api_token.
- A1 magic-link START leg → 2xx {ok:true}; the FULL callback flow is
test.skip with an explicit "blocked on Brevo sender validation (operator)"
annotation, NOT a silent omission.
Mint path is Brevo-free (TEST-ACCOUNTS-AND-NR-SYNTHETICS-PLAN.md §1.1):
account legs provision→/claim a real user/team then mint an HS256 session JWT
with E2E_JWT_SECRET; they self-skip loudly when the secret is unset while the
contract-only legs still run. Every minted resource is cohort-branded +
ledgered-before-assert + reaped inline / afterAll / reap-cohort.ts (rule 24).
Mirrors live-anon-provision + auth-roundtrip patterns; named live-*.spec.ts so
playwright.live.config.ts picks it up and the default mocked config ignores it.
Wires optional E2E_JWT_SECRET into e2e-live.yml.
npm run gate: GREEN (tsc --noEmit + build + vitest 1115 passed / 3 skipped,
80 files; mocked suite unchanged). live config lists 11 tests, all skip
cleanly without E2E_LIVE.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent f7879e0 commit 16ae02d
2 files changed
Lines changed: 615 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
100 | 107 | | |
101 | 108 | | |
102 | 109 | | |
| |||
0 commit comments