Skip to content

fix(e2e): say why the target refused the test account's sign-in - #2112

Merged
dawsontoth merged 3 commits into
stagefrom
claude/e2e-auth-setup-401
Nov 16, 2026
Merged

dawsontoth merged 3 commits into
stagefrom
claude/e2e-auth-setup-401

Conversation

@dawsontoth

@dawsontoth dawsontoth commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor
A badger doorkeeper points to the empty line in a guest ledger so a hedgehog with a key sees at once why the door stays shut

⊙ Problem

The first dev run of the post-deploy gate (run 43892069560) failed its auth setup with a bare 30-second waitForURL timeout. The real cause was a 401 from /Login/: the test account did not exist on dev. The setup also passed with no session for an unverified account, whose 403 sends Studio to /verifying, which also leaves /sign-in.

💡 Solution

  • The auth setup reads the /Login/ response before the URL and fails with the cause: 401 is an unknown email or a wrong password (accounts are per environment), 403 an account that cannot sign in with its password, no response within 30 s an unreachable central-manager, anything else a likely regression.
  • The setup docs say the test account has to exist on each target.

🔧 Changes

  • auth.setup.ts waits for the POST /Login/ request around the Sign In click and reads its response(), which is null when the request failed outright and is cut off after 30 s, since neither it nor Studio's 60 s API timeout ends before the test does. It throws on either, and on any non-2xx, before the existing check that the URL left /sign-in.
  • loginRefusal.ts (new) holds the message for each status and for no response, and the predicate that picks the sign-in request out of the page's traffic.
  • deploying.md: the test-account prerequisite now says the account must exist and be verified on each target, and that sign-in answers 401 where it was never created.

⚖️ Alternatives

  • Status, not page state. Excluding /verifying from the URL check and reading the form's inline error would depend on UI wording; the response status does not, and covers 401 and 403 alike.
  • A module, not an inline throw. A one-line Sign-in returned ${status} would lose only the per-status advice, but the advice is the point, and a module lets it be unit-tested without a browser.
  • Any non-2xx fails. Failing only on 401 and 403 would let other statuses fall through to the URL wait; central-manager answers a good sign-in with 200, so anything else is worth stopping on.
  • Quoting the body. The message carries up to 300 characters of it. central-manager's 401 and 403 bodies carry no credentials (its 409 names the email), and the test-account values are GitHub secrets, which Actions masks in logs.

✅ Verification

  • Ran the setup project against a local Vite server whose central-manager was a localhost stub. A stubbed 401, a 403 and a stopped stub (ERR_CONNECTION_REFUSED) each fail within seconds with their message, a stub that never answers fails at 30 s, and a 200 still passes. With stage's setup, the same 401 timed out after 30 s, and the 403 passed with no session.
  • loginRefusal.unit.spec.ts covers each status, the no-response message and which requests count as the sign-in. Changing either status check, the body clip, the origin, the missing-error fallback, the POST check or the path match turns a test red.
  • Gate: vitest 730 files (8,741 passed), tsc -b, the e2e project's tsc --noEmit and unit project (49), oxlint, dprint.

🤖 Generated with Claude Code

Related PRs: #2107 overlaps (also edits deploying.md)
Complexity: easy

Deferred findings

  • 384f4d7cf5467ea7 nit correctness — e2e/tests/loginRefusal.ts — isLoginRequest endsWith('/Login/') broader than the login collection — NOT FILED

Review-Coverage: authored=claude; ran=gemini,cursor-composer,codex; adjudicated=domain; declined=cursor-grok,muse; rounds=3; full=2 @ 18a4177

Review-Attention: skim ~2m (decisions: do-less-alternative, hung-response-bound, fail-on-any-non-2xx) @ 18a4177

dawsontoth and others added 3 commits November 16, 2026 14:56
The auth setup waited 30 seconds for the URL to leave /sign-in, so a 401 from a target with no such
account surfaced as a bare waitForURL timeout (the first dev run of the post-deploy gate). It now
reads the /Login/ response first and names the cause: 401 is an unknown email or wrong password,
403 an account that cannot sign in with its password.

Checking the response also fixes a false pass: an unverified account's 403 sends Studio to
/verifying, which leaves /sign-in too, so the setup saved a session-less state and passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A sign-in request that fails outright (central-manager down, or a proxy blocking it) never produces a
response, so waiting for one sat out the 30-second timeout. Waiting for the request and reading its
response() instead returns null on failure, and the setup now names the origin and the network error.

Also trims comments the review found restating the messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
request.response() has no timeout of its own and Studio's API client gives up only at 60 seconds, the
test's whole budget, so a central-manager that accepts the connection and never answers still ended in
Playwright's generic test timeout. The setup now gives up after 30 seconds with the no-response message,
reworded to cover a server that is down as well as one a proxy blocks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 85.88% 23181 / 26990
🔵 Statements 85.69% 24606 / 28714
🔵 Functions 81.85% 6451 / 7881
🔵 Branches 81.41% 20257 / 24881
File CoverageNo changed files found.
Generated in workflow #2601 for commit 18a4177 by the Vitest Coverage Report Action

@dawsontoth
dawsontoth marked this pull request as ready for review November 16, 2026 20:24
@dawsontoth
dawsontoth requested a review from a team as a code owner November 16, 2026 20:24
@dawsontoth
dawsontoth merged commit 951c4ba into stage Nov 16, 2026
7 checks passed
@dawsontoth
dawsontoth deleted the claude/e2e-auth-setup-401 branch November 16, 2026 20:25
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