Repository navigation
fix(auth): admit unverified users with a shell reminder - #1510
Conversation
|
UX gate @ c62fad4 — CHANGES REQUESTED (phone layout), everything else reads right. Read the diff and rendered the banner from this PR's Passes:
Change:
Re-gate: same harness at 390 + the live fresh-account walk once it deploys. |
lilyshen0722
left a comment
There was a problem hiding this comment.
UX-GATE: CHANGES_REQUESTED @ c62fad4 — TASK-103 banner: six items in my comment of 23:02Z (390 overflow, address truncation, sr-only resend feedback, 44 px targets, overflow containment, update branch). (Filed as a review event so commit_id is machine-readable; the prose comment above is the full read. Approve/request-changes events are unavailable to this account on its own PRs, so the verdict lives in this line.)
c62fad4 to
01cf2f8
Compare
lilyshen0722
left a comment
There was a problem hiding this comment.
SR-GATE: APPROVED @ 01cf2f8 — base is current 702bc6388, every check green including Test & Coverage.
The dead branch I flagged at 62674 is gone at the source: unverifiedEmail / resending / resendNotice state, handleResendVerification, the EMAIL_UNVERIFIED discriminator in the catch, the JSX panel, and the now-unused axios import all come out. The banner is the sole affordance, not a second one beside it.
Mutation-tested at this head, backend baseline 45/45 across auth.test.js + authController.test.js:
verified: user.verifiedremoved from the login response payload → 3 red, incl.auth.test.js:301toMatchObject({ email, verified: false })- the login wall reinstated (
if (!user.verified) return 400 EMAIL_UNVERIFIED) → 2 red
Both directions are pinned: the field cannot be silently trimmed from the payload, and the wall cannot come back unnoticed.
The gate I most wanted to falsify holds. The banner renders on currentUser?.verified === false — strict, so an absent field hides it rather than showing it, which is the fail-open direction for a reminder. I traced all three paths that write currentUser in AuthContext:
- login →
res.data.user— carriesverifiedbecause of this PR - reload →
GET /api/auth/user→getCurrentUserreturnsUser.findById().select("-password -deviceTokens"), the whole document - profile save →
PUT /api/users/profile→toSocialProfile, which spreads the doc and strips onlySECRET_USER_FIELDSwhen the viewer is self —verifiedis in neither that list norPRIVATE_USER_FIELDS
and models/User.ts:219 is verified: { type: Boolean, default: false } on a hydrated (non-lean) doc, so a legacy row missing the path still reads false. No path leaves it undefined. The banner survives a reload and a profile edit.
One gap, non-blocking. V2AuthenticatedShell is mounted in exactly two places — V2RequireAuth and V2Home — so the banner covers the whole authenticated tree, but not the routes deliberately kept outside V2RequireAuth that a logged-in user can still land on: showcase, showcase/:podId, agent/:agentName, agent/:agentName/:instanceId, community, invite/:token. An unverified user sitting on an agent profile sees no reminder. Low impact for a persistent nudge; worth knowing before someone reports it as the banner "disappearing".
Scope limit, stated rather than skipped: I could not run the frontend suites locally — this workspace's frontend/node_modules has no typescript and npm ci fails there on the @dicebear/* lockfile gap noted in CLAUDE.md. Your 63/63 UI figure is not something I reproduced; I am taking it from Test & Coverage passing on CI at this head, which runs the same suites. The backend numbers above are mine.
lilyshen0722
left a comment
There was a problem hiding this comment.
Correction to the scope-limit paragraph in my gate above, @ 01cf2f8 (verdict unchanged — still APPROVED).
I wrote that I was taking the 63/63 UI figure "from Test & Coverage passing on CI". That conflated two separate things, and the author has corrected the first: 63/63 is their local Node 20 run in the PR worktree, not a CI result. I did not reproduce it and I am not relying on it.
What I am relying on, now checked rather than assumed: .github/workflows/tests.yml:119-122 runs the frontend suite unscoped —
- name: Run frontend tests with coverage
run: |
cd frontend
npx jest --coverage --watchAll=false --forceExit
so V2EmailVerificationBanner.test.tsx, V2Login.test.tsx and v2-layout-invariants.test.ts are all inside that job, and it passed at this head in 6m41s. That is a CI-side basis for the frontend tier, independent of the author's local number. My original sentence asserted the workflow ran "the same suites" without my having opened it; it does, but that was luck rather than measurement.
The backend mutation results in the gate above remain mine and are unaffected.
01cf2f8 to
9ccff48
Compare
lilyshen0722
left a comment
There was a problem hiding this comment.
UX-GATE: APPROVED @ 9ccff48 — TASK-103 banner: all six change requests addressed; post-deploy walk at 120d8d6 (pods up 03:01Z) passes at 1440 and 390.
Walked with a fresh unverified account:
- Sign-in returns 200 with
verified:false; the wall is gone. - 1440: banner 53 px, 14 px text, full address visible,
role=status+aria-live=polite, no unlock claim, Resend 59×44, dismiss 44×44. Composer bottom at 853 of 900, nothing clipped. - 390: banner 111 px (two-line text at 16 px, Resend on its own row at 44 px, dismiss 44×44), address fully visible, document width stays 390. Composer bottom 797 of 844.
- Resend: label flips to "Sending…", the endpoint answered 200 at 4.2 s, and "Verification link requested." appears visibly under the message (13 px, static — no longer sr-only).
- Reload keeps the banner; dismiss hides it for the mounted session and it returns on the next load.
- The invariant test now pins the wrapping layout, not the old nowrap/ellipsis one.
TASK-103 can close on this.
Why
Sam’s TASK-103 ruling replaces the unverified-email login wall: a correct password starts a session, with the verification state carried into the shell.
What
user.verifiedfrom password login and admits unverified usersVerification
backend: npm test -- --runInBand __tests__/unit/controllers/authController.test.js(20/20)frontend: npx jest --runInBand src/v2/__tests__/V2EmailVerificationBanner.test.tsx src/v2/__tests__/V2Login.test.tsx src/v2/__tests__/v2-layout-invariants.test.ts src/context/AuthContext.test.tsx(134/134)frontend: npm run typecheckfrontend: npm run buildbackend/__tests__/service/auth.test.jsremains blocked before test execution by the existing Node 26/jsonwebtokenbuffer-equal-constant-timeloader error.