fix(layout+pages): default user=null + page audit sweep (P0 #7) #15
No reviewers
Labels
No labels
agent-context-drift
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: rstillwell/deckhearth#15
Loading…
Reference in a new issue
No description provided.
Delete branch "convoy/fix-layout-default-user"
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?
Summary
Resolves P0 #7 from
.convoys/ship-readiness.md— the last open P0 ship-blocker. Until now, every page that rendered<Layout>without explicitly passinguserimpersonated the maintainer (me@randallstillwell.com) in the navbar and three additional page bodies leaked the same email through hardcodeduseStateseeds.This PR is the
fix-layout-default-userconvoy, two briefs in two commits on a single branch:Brief 1 —
components/Layout.js(commitddf8fd2)user = { email: 'me@randallstillwell.com', role: 'user' }→user = nullUserProfileDropdownnow branches onuser === nulland renders a "Sign in" →/loginCTA instead of the maintainer's avatartest/components/Layout.test.jswith 5 regression-lock assertions (no maintainer email when prop omitted / null; "Sign in" link present; supplied email renders; no "Guest" placeholder)jsdom@^29+@testing-library/react@^16todevDependenciesand a 3-lineesbuildblock tovitest.config.jsto parse JSX in.jsfilesBrief 2 — 7 pages swept (commit
8c7d127)Per the architect's per-page bucket table (Decision B in
.convoys/fix-layout-default-user.md), 7 of 17 Layout-importing pages needed code changes — the other 10 were already correct.Pass
user={user}to Layout (4 pages, 11 call sites):pages/scanner.js(1 call)pages/decks.js(3 calls)pages/deck-builder.js(4 calls)pages/deck/[id].js(3 calls)All four still import
useAuthfromlib/auth-context.js— intentional and stays as-is until the queuedsingle-auth-providerconvoy collapses the three parallel auth surfaces.Replace leaky page-level seed with
useState(null)+ null-guards (R2 mitigation):pages/profile.js— 15 syncuser.*reads, all guarded (optional chaining on JSX reads; earlyif (!user) return ''ingetDisplayName/getInitials;{user?.created_at && ...}wrapping theformatDateblock to avoid "Invalid Date")pages/settings.js— 1 syncuser.emailread on a disabled input, guarded viavalue={user?.email || ''}Replace hardcoded const with
useAuth():pages/card/[id].js—const user = { email: 'me@...', role: 'user' }→const { user } = useAuth()fromlib/use-auth.jsVerification
npm run test:run→ 21/21 green (16 pre-existing + 5 new from Brief 1)npm run lint→ exit 1, 128 problems (exact baseline match — confirmed via stash before/after)curl /cards→ HTTP 200, zero maintainer-email matchesFlagged but deferred (out of scope)
useAuthfromlib/auth-context.js→single-auth-providerconvoy (P1 #9)components/MobileNavigation.jsstill receives a deaduserprop →cleanup-mobile-nav-dead-props(or fold intogod-component-split)pages/card/[id].jsalso importsuseIsAdminfromlib/admin-auth(third parallel auth surface) → samesingle-auth-providerconvoynext/image,react-hooks/exhaustive-deps, etc.) inprofile.jsandcard/[id].js— verified pre-existing via stash before/afterTest plan
rg 'me@randallstillwell.com' pages/→ 0 hitscurl /cards→ no maintainer email leak/cards,/card/<id>,/collection/<slug>show "Sign in" CTA, no maintainer email/dashboard,/profile,/settings,/decks,/scanner,/deck-builderrender withoutnull-deref console errors during the auth loading windowCloses P0 #7. After merge, doc-writer will mark
.convoys/ship-readiness.md+ AGENTS.md gotcha #8 RESOLVED.Made with Cursor
The latest updates on your projects. Learn more about Vercel for GitHub.
Pipeline Health
Build + CI gates
Build runs on Vercel; this CI runs lint and schema-map drift only (no duplicate build).
Role reports
See individual comments above for details. This rollup updates automatically.
Visual Diff
Screenshots and diffs uploaded as artifacts: view run
If intentional changes: update snapshots locally with
npx playwright test --project=visual --update-snapshotsand commit.