Skip to content

[Task] F2: connect mock login, registration, verification and password-reset flows #13

Closed

Description

@DavidVFitzGerald

Delivery phase

Phase 1 - frontend with mock services

Goal

Let a user complete the required account journeys entirely inside the login modal.

Context and authority

Milestone F2; read AGENTS.md, docs/team/product-manager.md, docs/product/LCA_diff_PRD.md, docs/engineering/roadmap.md, and docs/engineering/LCA_diff_Implementation_Specification.md §6.1. Current planning baseline is on docs/agent-workflow, pending review/merge into main; proposed ADRs are not accepted authority. Implement auth form/dialog states and service-boundary interactions in frontend auth UI; add component and browser tests. These application paths are planned until created. Exclude all archive/reference folders.

Requirements and constraints

Email is identity; no username/custom password backend. Use mock auth services for actions. Provide login, self-registration, reset, verification guidance/resend and pending/error states. Support keyboard navigation, visible field/error labels and correct focus transitions; controls remain usable after failures.

One session-sized task/PR including verification and handoff. Run all development, installation and checks in containers; install nothing on the host. No real backend, Firebase project, cloud credentials or proprietary inputs. If the current PRD/spec must change, prepare an ADR and updates to both current documents in the same PR.

Acceptance criteria

  • AC1 - A visitor can navigate email/password login, self-registration and password reset within the modal without a separate landing/login page.
  • AC2 - Unverified mock users see verification/resend guidance and cannot unlock data; verified login transitions through the observed auth state rather than bypassing the guard.
  • AC3 - Pending submissions prevent duplicate actions and expose progress; deterministic invalid credentials/duplicate account/reset errors are visible and recoverable.
  • AC4 - Form validation and errors have accessible labels/associations; keyboard submission and switching flows preserve predictable focus, and required-login cancellation cannot unlock the shell.
  • AC5 - Browser tests cover successful and failing simulated registration/login/reset/verification flows without live accounts or email delivery.

Out of scope and follow-ups

Session restoration/revocation and account-isolated caches are #14; consolidated F2 acceptance is #15. No real emails, Firebase project, backend endpoints or password storage implementation.

Verification plan

Inside ./dev shell, run established format:check/lint/typecheck/test:unit/build and npm --prefix apps/frontend run test:e2e. Use synthetic mock scenarios; record complete keyboard flow and visible error recovery.

Engineer records branch/SHA and exact results, leaves issue open, and hands off to QA. QA verifies every criterion at that SHA and reports PASS/FAIL/BLOCKED; mock evidence is not proof of real security/integration.

Dependencies and readiness

Blocked by #11, #12. No implementation until dependencies and the M1 environment runtime gate are satisfied. This body is groomed planning material, not PM READY while blockers remain. Coordinator/PM rechecks merged dependencies and session-sized scope before starting.

Current readiness — supersedes historical planning baseline/blockers above

PM: READY for Phase 1/F2 on merged main at d05e6823cf413f398eeba513a852eb18dd3cadb5. Dependencies #11 and #12 are closed after independent QA PASS, required hosted quality SUCCESS and explicit maintainer merges of PR #45 (f70420d) and PR #46 (d05e682). M1/M2/F1 prerequisites remain satisfied. Current merged documents/contracts replace the historical planning-branch statements above. AC1–5 are unchanged; no new ADR/product decision is required.

The shell currently defines a placeholder LoginDialog inside apps/frontend/src/App.tsx; no separate AuthDialog file exists yet. Extract/replace that presentation with working in-modal login, registration, password-reset and verification flows. Own AuthDialog/form components, their styles and tests, and the minimal App replacement. Keep native required-modal focus/inert/Escape behavior. Consume AuthService via the existing service context, retain observed auth as the sole unlock signal, disable duplicate pending actions, associate errors with inputs, and abort/ignore obsolete submissions on flow/unmount/account changes. Never directly fetch or import fixtures.

Use the merged mock contract documented in src/services/README.md: synthetic @example.invalid accounts, fixed demo-password, resend then explicit refresh to simulate verification-link completion, reset then return to sign-in with the fixed password. Display these as local simulation guidance with no actual email delivery. Success/failure messages must let the user recover; unverified users remain locked and can sign out/switch account. Passwords are neither persisted nor logged. #14 owns controller/query gating/cache/in-flight-response hardening; coordinate any minimal service-context API change without overlapping App edits.

Verification: guarded rootless environment check; frozen npm ci; format:check/lint/typecheck/test:unit/build; Chromium and Firefox full available test:e2e. Cover successful/failing login, registration/duplicate, reset/unknown account, verification pending/resend/explicit refresh, keyboard submit/flow focus, recoverable errors, duplicate prevention, Escape and zero protected reads before observed verification. Unit injected services can trigger deterministic action failures; actual product browser journeys use the composed mock adapter. Record exact commands, SHA and limitations; hand off to independent QA, then required hosted CI and maintainer merge. #15 owns consolidated F2 gate evidence.

Activity

  1. added
    task
    frontend
    blocked
    on Nov 13, 2026
  2. DavidVFitzGerald commented on Nov 13, 2026

    @DavidVFitzGerald
    OwnerAuthor

    PM: BLOCKED

    Groomed using docs/team/product-manager.md for F2, Phase 1 — frontend with mock services. Documentation review: PASS for scope, required sections, specification coverage and acyclic dependency links; this is not application QA or implementation readiness.

    Blocking predecessor issues: #11, #12. The M1 runtime gate (#2) and merged bootstrap/M2 configuration (#3) also remain required. PM must recheck merged dependencies and current interfaces before changing this to READY.

    Engineer implements one issue, commits regularly and hands the delivered SHA plus exact container checks to independent QA; do not close before QA, review and approved merge. No backend/Firebase/cloud credentials or host installations are required for Phase 1.

  3. DavidVFitzGerald commented on Nov 14, 2026

    @DavidVFitzGerald
    OwnerAuthor

    PM: READY — Phase 1/F2, AC1–5 unchanged. #11/#12 have independent QA PASS and successful required hosted quality; maintainer merged PR #45 (f70420d) and #46 (d05e682), dependencies now closed. Implement modal account forms per specification §6.1 against merged AuthService/mock contract; extract current App LoginDialog, preserve native focus/inert locking and observed auth unlocking. Forms/App ownership is #13; service-context/query/provider lifecycle ownership is #14. Mock verification/reset instructions and exact component/browser checks are appended to the body. No ADR/product change required. Handoff to Software Engineer, then independent QA at delivered SHA.

  4. DavidVFitzGerald commented on Nov 14, 2026

    @DavidVFitzGerald
    OwnerAuthor

    Engineering: READY FOR QA

    Branch feat/f2-auth-forms, delivered SHA dbc8f22, PR #47 (no closing keyword).

    Changes: src/auth/AuthDialog.tsx (+ auth.css, tests) replaces the placeholder App LoginDialog. App keeps the modal mounted through action-driven resolving. An optional composition-supplied demo field on ApplicationRuntime/service context provides mock guidance. This is a minimal additive service-context change, and the #14 controller/query/cache lifecycle is untouched. Foundation smoke now expects initial focus on Email.

    Criteria

    • AC1: sign-in, registration and reset are switchable views in one modal at /, with no separate page. Implemented.
    • AC2: the unverified verify view offers resend, explicit refresh and switching account. The shell stays inert, and only the observed verified state unmounts the modal. A unit test proves that an ok action result without a verified state does not unlock. Implemented.
    • AC3: single-flight actions use aria-disabled, aria-busy, read-only inputs and live progress. Invalid credentials, duplicate registration, unknown-reset-address, temporary and thrown failures all show messages and can be retried. Implemented.
    • AC4: field errors use aria-invalid/aria-describedby, and alerts are referenced by Email. Focus goes to the first invalid field or to Email after a service error, to the new view's first control on a flow switch, and to Return to sign in after a reset. Escape (repeated) and backdrop never unlock. Implemented.
    • AC5: Playwright covers sign-in (validation, invalid, then success), registration (duplicate, then verification pending/resend/refresh), unverified lock and switch, and reset (unknown, known, return, sign-in). There are no live accounts or email. Implemented.

    Commands (project lca-diff-f2-forms, all inside the rootless workspace):

    • ./dev check PASS
    • npm --prefix apps/frontend ci --no-audit --no-fund gives 230 packages, lock unchanged
    • cd apps/frontend && npm run format:check && npm run lint && npm run typecheck && npm run test:unit && npm run build && npm run test:e2e all PASS. Unit: 153/153 in 8 files. E2E: 12/12 (Chromium + Firefox).

    Manual check: run npm run preview with VITE_SERVICE_MODE=mock and use "About this demo" for the accounts. Password is demo-password.

    Limitations: The browser mock has zero latency, so pending/abort states are covered by component tests only. Safari wasn't available. Hosted CI is pending on PR #47. This mock does not prove real auth or security.

    Next: independent QA at dbc8f22.

  5. DavidVFitzGerald commented on Nov 14, 2026

    @DavidVFitzGerald
    OwnerAuthor

    QA: PASS

    Reviewed SHA: dbc8f22b132544428d428a84a0057afa812475f0 (PR #47, branch feat/f2-auth-forms). Verified in an isolated detached worktree, with no changes to the shared checkout.
    Mode: Phase 1 mock services only. This verifies the mock browser journeys and the services boundary. It is not evidence of real Firebase authentication, token lifecycle, authorization or data security.
    Environment: rootless workspace container, project lca-diff-qa-13, FRONTEND_PORT=5178.

    Commands and results

    Command Result
    COMPOSE_PROJECT_NAME=lca-diff-qa-13 FRONTEND_PORT=5178 ./dev up then ./dev check PASS: rootless identity, restricted capabilities, 8/8 preflight regressions, frozen uv lock
    docker compose -p lca-diff-qa-13 exec -T workspace bash -lc 'cd apps/frontend && npm ci --no-audit --no-fund' 230 packages; the tree stayed clean (lock unchanged)
    npm run format:check / npm run lint / npm run typecheck PASS / PASS (0 warnings) / PASS
    npm run test:unit PASS: 153/153 tests in 8 files (includes 13 AuthDialog cases)
    npm run build PASS (JS 286.70 kB, 88.38 kB gzip)
    npm run test:e2e PASS: 12/12 (Chromium and Firefox × 4 auth plus 2 foundation specs)
    gh pr checks 47 quality pass (2m9s, run 43598551394), PR head = dbc8f22

    Criteria

    • AC1: PASS. Sign in, Create an account and Reset your password are views of one native <dialog> at /. There is no route or page. E2E reaches registration by keyboard (Tab×3 then Enter) and reset by clicking "Forgot password?". The typed email carries across flows and the password does not.
    • AC2: PASS. An unverified sign-in or registration shows Verify your email with Resend, "I've verified my email" (refresh) and "Use a different account". The shell stays inert, and Escape and reload keep it locked. Unlock happens only when App observes a verified AuthState. The unit test "does not unlock on a successful action result without an observed verified state" settles ok and asserts the dialog is still present and the shell still inert until a verified state is emitted. E2E covers both refresh paths: refresh before resend reports "not verified yet", and resend then refresh unlocks.
    • AC3: PASS. useAuthAction allows one action at a time (ref guard plus an early return on pending). Controls get aria-disabled, the form gets aria-busy, inputs become read-only and a polite live region shows progress. In the unit tests, double click plus submit calls signIn once, and the verify-panel actions and reset are also single-flight (my probe). Errors for invalid credentials, duplicate registration, unknown reset address, temporary failures (with a reference) and thrown failures are all displayed, and a retry succeeds.
    • AC4: PASS. Field errors use aria-invalid/aria-describedby. The service alert is referenced by Email, which receives focus (E2E toHaveAccessibleDescription). Focus goes to the first invalid field on validation, to the new view's first control on a switch, and to Return to sign in after a reset. Escape ×3, a backdrop click and a programmatic dialog.close() all leave the modal open, the shell inert and focus restored (my probe in both browsers). Tab focus stays inside the dialog over 12 presses.
    • AC5: PASS. e2e/auth.spec.ts covers successful and failing sign-in, registration (including the duplicate), unverified lock with an account switch, and reset (unknown, known, return, sign-in) through the composed mock adapter. Each case asserts there are no fetch/XHR/API/external requests and no console or page errors. No live account or email is involved.

    PM handoff requirements

    • Native modal focus/inert/Escape behavior is preserved, and a browser force-close reopens the modal: verified.
    • AuthDialog gets AuthService only via useServiceContext(). Grep of src/auth and App.tsx finds no fetch, services/mock, fixture, storage or console use. Mock guidance arrives through the optional composition-supplied demo runtime field. This is a minimal additive context change and is documented in services/README.md.
    • Observed auth is the sole unlock signal, and duplicate pending actions are disabled: verified (see above).
    • Obsolete submissions are aborted or ignored on a flow switch (unit test plus my reset probe), on an account change (unit test u3 to u4; my probe: a pending sign-in followed by an observed unverified state aborts, and the late failure shows no alert), and on an unlocking unmount (my probe: no React warnings).
    • Passwords are neither persisted nor logged. My probe ran a failed sign-in and then a successful one, and found no password in localStorage, sessionStorage or any console.* call.
    • Mock guidance is worded as "Local simulation … No email was sent". The injected/test runtime shows no demo credentials or "Local demo" label (unit test).
    • There are zero protected reads before observed verification: every data-service method is a spy and stays uncalled in the composed and controlled cases, and E2E finds no protected text.
    • Initial resolving shows "Restoring your session…" without flashing the modal (my probe).

    Test quality

    The tests check observable behavior rather than mirroring the implementation. They drive real DOM and keyboard input, use controlled deferred services for pending/abort/throw paths, check the injected data spies, and the E2E specs use the real composed adapter. The foundation smoke change (initial focus now on Email) is a justified update.

    ADR / documentation

    There is no PRD or specification deviation, and no ADR is required. The behavior matches spec §6.1 (in-modal auth, no landing page, required-login Escape behavior, no modal flash) and §6.8 (keyboard/focus). The historical folders were not used.

    Throwaway probes (not committed, removed before teardown)

    • A unit probe with 6 cases ran 5 PASS. The forced-close case failed only because the jsdom close() polyfill in src/test/setup.ts does not fire a close event. That is not a defect, and the same case was then verified in real browsers.
    • A Playwright probe (forced close, backdrop, focus containment, unverified reload) passed in Chromium and Firefox.

    Non-blocking notes and follow-ups

    1. The pending and abort states run with zero latency in the browser mock, so they are proven by component tests only. Safari was not tested.
    2. The unknown-address reset error ("We couldn't send a reset email to this address") follows the mock contract. With a real Firebase adapter that has email-enumeration protection, that error should not reveal whether an account exists. Phase 2 (B2/I1) should reconcile the adapter's error mapping.
    3. Real authentication, session restoration/revocation and cache isolation remain [Task] F2: guard protected queries through session restoration and account changes #14, [Task] F2: verify complete mock authentication and accessible shell journeys #15 and Phase 2.

    Next: coordinator/maintainer review and merge of PR #47. #13 stays open until the merge is approved.

  6. DavidVFitzGerald commented on Nov 14, 2026

    @DavidVFitzGerald
    OwnerAuthor

    Coordinator: closing. Independent QA PASS at dbc8f22, required hosted quality SUCCESS, and maintainer merge of PR #47 as 9012a65. Follow-up note for Phase 2 (B2/I1): reconcile reset-error mapping with Firebase email-enumeration protection (see QA comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedfrontendtask

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions