Repository navigation
fix(e2e): WebKit admin sign-in — wait for hydration, verify the session identity (#1178) - #1191
Conversation
…#1178) WebKit typed the admin address before React hydrated the sign-in form, which reset it to the prefilled default user; the admin password then failed, the callback still answered 200, and the specs failed later as a 307 or a missing apiToken. Wait for SessionProvider's post-mount session fetch before typing, and throw when no session cookie is set. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…#1178) Review follow-up: checking the session's email instead of a cookie name also covers chunked and __Secure- cookies, and names the wrong identity. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Third-party review (review chain) — first commit b6acf64Findings
Verdict: the cookie check improves failure locality, but the proposed hydration barrier breaks 🟢 Review complete; one major synchronization defect requires correction REQUEST_CHANGES Dispositions are in the PR body; follow-up 793eee2 takes the MINOR. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
ReviewSmall, focused e2e helper fix. No blocking issues. Correctness
Tests
Style
Security and performance: no concerns. This is test-only code, and the extra request is negligible. |
Third Party Review — Kimi✅ Third Party Review: no defects found. Scope checked: the hydration wait's listener-before-navigation ordering, Model: k3[1m] |
Reviewer failover
|
…lated sign-ins (#1198) Since #1191 moved page.close() after an extra session request, three CI smoke runs hung in global setup for the full 30-minute job timeout, right after saving the default user's state. page.close() is the one call there with no timeout, and it now ran while the post-login /upload page was loading (compiled cold on CI). Close it straight after the credentials callback again, as before #1191, and check the session over the context's request API. Each isolated sign-in now fails after 60s, naming the user, instead of holding the job. Co-authored-by: Claude Opus 5.5 <[email protected]>
Closes #1178.
Cause
On WebKit,
signInAstyped the admin address before React hydrated/auth/signin. The form is controlled and prefilled with the default test user, so hydration put[email protected]back in the field. The admin password was then posted for that user. The credentials callback still answered 200 (with?error=CredentialsSigninin its body), so the helper returned a signed-out context. The specs failed later and looked unrelated:/admin307, and "no apiToken" inplan-limit. Chromium hydrates fast enough to hide the race, and the default user can't hit it because their address is the prefill.Evidence (WebKit probe): the posted body was
email=test%40narrativeml.com…and the response was{"url":"…/auth/signin?error=CredentialsSignin&code=credentials"}. Noauthjs.session-tokencookie was set.Fix (
e2e/helpers/apiAuth.ts, shared by global-setup, admin-guard and plan-limit)/api/auth/sessionfetch thatSessionProvidermakes once it has mounted./api/auth/sessionand require its email to be the requested one. Otherwise throwsignInAs(<email>): signed in as <who> instead.Verification
--grep "admin|plan"on webkit-full and chromium-full: 8/8 passed (failed 2/3 before).@smokeon webkit-full + chromium-smoke: 90 passed, 1 skipped.signInAs(admin-e2e@…): signed in as nobody instead.Review
Review chain: REQUEST_CHANGES.
session={null}so it never fetches; the wait will time out": refuted. Probes on both engines logged the/api/auth/sessionfetches on the fresh sign-in page, and 90 smoke tests ran through the wait with none timing out. The new postcondition fails loudly if that signal ever stops arriving in time..0cookies": taken. The check is now the session's email, which covers every cookie form and names the wrong identity.🤖 Generated with Claude Code