Skip to content

[Task] F2: implement deterministic mock authentication account and session scenarios #12

Closed

Description

@DavidVFitzGerald

Delivery phase

Phase 1 - frontend with mock services

Goal

Provide all simulated authentication states needed for a complete frontend demo without contacting Firebase.

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, 6.8, 8.1; roadmap F2. Current planning baseline is on docs/agent-workflow, pending review/merge into main; proposed ADRs are not accepted authority. Implement mock auth adapter under apps/frontend/src/services/mock/; add deterministic synthetic account/session fixtures and boundary tests. These application paths are planned until created. Exclude all archive/reference folders.

Requirements and constraints

Use the existing auth interface, deterministic identities and controllable asynchronous outcomes. Model initial resolution, verified/unverified login, registration, verification/resend guidance, password reset, logout, expiry/revocation and refresh failure. Persist only safe simulated session information needed for demo restore, not entered passwords, secrets or provider tokens. Explicitly label this as local simulation.

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 - Tests exercise anonymous/resolving, verified, unverified, registration, duplicate-account/error and reset/verification success/failure paths through the auth boundary.
  • AC2 - Auth observers emit coherent state changes for login/logout, verification, restored session, failed refresh, expiry/revocation and switching synthetic accounts.
  • AC3 - A previously valid simulated session can restore after reload without requiring a Firebase project or external email delivery; password reset and verification have clear deterministic demo completion steps.
  • AC4 - No submitted password or real token/secret is stored in browser storage/logs; pending auth operations support repeatable errors/latency and safe cancellation where applicable.
  • AC5 - No mock auth operation grants access through an unverified state; service-level protected-call guards expose typed auth failures for integration tests.

Out of scope and follow-ups

Presentation/forms are #13; auth controller, query-cache clearance and shell guarding are #14. Production Firebase/Admin verification remains B2/I1.

Verification plan

Inside ./dev shell, run format:check/lint/typecheck/test:unit/build. Use deterministic timers/storage doubles for observer ordering, refresh failure and restore cases; inspect safe storage contents. UI E2E coverage is #15.

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 #10. 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. F1 #10 is closed following independent QA PASS, passing final PR/full-suite CI and the maintainer's explicit PR #44 merge (96129438d254fe897a3094f7e6923e4ec6cfb2e7). M1 is merged in PR #35 and #2 is closed; rootless Docker/Compose are available. The merged current PRD/specification, ADRs 0001–0003 and existing F1 auth/service contracts are the working baseline; historical planning-branch statements above are superseded. AC1–5 are unchanged.

Implement the deterministic mock adapter and synthetic auth scenarios behind the existing AuthService boundary, replacing the technical placeholder at composition. Keep scenario controls in services/mock or explicitly injected test configuration; components must not import fixtures or bypass auth. Preserve asynchronous typed-result, cancellation and observer conventions. Expose clear deterministic verification/reset completion steps for later #13 UI integration, with no actual email/Firebase/backend. Store only versioned safe synthetic session/account markers needed for restore; never submitted passwords or provider tokens. Unverified/restoring/failed states cannot grant protected service access. No UI forms or session/query-cache controller work here (#13/#14 own those).

Verification: guarded rootless container environment check; frozen frontend npm ci; format:check/lint/typecheck/test:unit/build. Meaningful deterministic timer/storage/service-boundary tests cover all AC1–5, including observer ordering, canceled/late auth actions, restored/malformed sessions, account switching, failed refresh, expiry/revocation, typed protected-call failures and storage inspection. Existing Chromium/Firefox foundation smoke should remain passing when composition changes. Engineering records exact commands/SHA and hands off to independent QA; no merge/close before QA, CI and maintainer-approved merge. No PRD/spec deviation or ADR is required for this bounded implementation.

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: #10. 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. F1 #10 is complete after PR #44 merge (9612943), independent QA PASS and successful required CI. M1 PR #35/#2 satisfied; rootless Docker and Compose confirmed available. Implement deterministic mock account/session scenarios against the existing AuthService boundary per specification §§6.1,6.8,8.1. #11 owns shell, #13 forms and #14 session/query-cache hardening. No new product decision/ADR required. Exact bounded scope and container verification are appended to the issue body. Handoff: Software Engineer, then independent QA at delivered SHA.

  4. DavidVFitzGerald commented on Nov 14, 2026

    @DavidVFitzGerald
    OwnerAuthor

    Engineering: READY FOR QA

    Delivered 8fc0de230c7b04036cc7fb5c51e899666ae56549, branch feat/f2-mock-auth, PR #46: #46.

    AC1–5 implemented: deterministic async account actions/observer lifecycle, verified and unverified sessions, registration/duplicates/reset/verification, safe active-session reload marker, expiry/revocation/refresh failure, cancellation/obsolete auth rejection, and typed raw-service guards. No app forms/controller or backend added. Demo credentials and verification/reset completion steps are in apps/frontend/src/services/README.md; active-marker-only persistence and disposable account reset after signout/reload are explicit.

    Container verification from /tmp/lca-diff-f2-auth:

    COMPOSE_PROJECT_NAME=lca-diff-f2-auth FRONTEND_PORT=5176 ./dev up
    COMPOSE_PROJECT_NAME=lca-diff-f2-auth FRONTEND_PORT=5176 ./dev check
    docker compose -p lca-diff-f2-auth exec -T workspace bash -lc 'npm --prefix apps/frontend ci --no-audit --no-fund'
    docker compose -p lca-diff-f2-auth exec -T workspace bash -lc 'npm --prefix apps/frontend run format:check && npm --prefix apps/frontend run lint && npm --prefix apps/frontend run typecheck && npm --prefix apps/frontend run test:unit && npm --prefix apps/frontend run build && npm --prefix apps/frontend run test:e2e'
    

    Environment/preflight PASS (eight scenarios, unchanged rootless/capability restrictions); frozen npm ci PASS (230 packages); format/lint/type PASS; unit PASS (134 tests/seven files, 30 auth scenarios); production build PASS; foundation Chromium and Firefox PASS (two tests). Final unit checks repeated after adding the last late-response regression and preserving the existing authenticated query-cancellation case. No host installs, secrets or lockfile drift. git diff --check PASS; worktree clean.

    Verification details: docs/engineering/f2-auth-verification.md. These service/component tests do not prove real identity/token/backend security; full account browser journeys remain #13/#15, expanded guard/controller behavior #14, real auth B2/I1. No PRD/spec deviation or ADR required. Next: independent QA at the delivered SHA, hosted quality CI, then maintainer review/merge. Leave issue open.

  5. DavidVFitzGerald commented on Nov 14, 2026

    @DavidVFitzGerald
    OwnerAuthor

    QA: PASS

    Reviewed SHA 8fc0de230c7b04036cc7fb5c51e899666ae56549, branch feat/f2-mock-auth, PR #46. Phase 1/F2, deterministic local auth/service adapter; no implementation, committed tests or acceptance criteria changed during independent QA.

    • AC1 PASS — 30 auth tests cover asynchronous resolving/anonymous and verified/unverified accounts, registration/duplicate and credential errors, reset success/failure, verification resend/refresh success and deterministic operation failures. Existing service/composition tests remain passing.
    • AC2 PASS — observer tests establish initial async ordering/unsubscribe, restored sessions, verification, account switching, logout, expiry/revocation and refresh failure. Delayed initial restore/signin cannot replace newer auth. Independent browser-source probes additionally confirm defensive observer copies and stale refresh cannot overwrite account B.
    • AC3 PASS — exact versioned synthetic session marker restores asynchronously, including unverified/pending-verification state. Malformed/non-synthetic markers resolve anonymous. README provides fixed demo credentials, explicit resend→refresh verification and reset→sign-in completion instructions. This is a disposable simulation: newly registered fixture metadata is retained for the active session/reload, then resets after signout+reload, as explicitly documented; no durable account database is claimed.
    • AC4 PASS — stored marker contains only version/synthetic user/verificationRequested, with no entered password, token or secret. Storage unavailability is tolerated. Abort/late-operation tests pass; independent probes cover preaborted signin without changing A, canceled verification without unlocking, failed restore clearing, and pending registration invalidated by logout without creating an account. Signout preserves unrelated workspace keys.
    • AC5 PASS — verified-only raw composed guard returns typed AUTH_REQUIRED/EMAIL_NOT_VERIFIED and rejects stale reads, including logout→same UID. Independent browser-source probes invoked every raw protected operation while unverified: all ten deny with EMAIL_NOT_VERIFIED; public health succeeds. Verification resend alone never unlocks. Provider guards/query-cache tests continue passing; expanded controller/UI coverage remains [Task] F2: guard protected queries through session restoration and account changes #14/[Task] F2: verify complete mock authentication and accessible shell journeys #15.

    Independent commands from /tmp/lca-diff-f2-auth:

    COMPOSE_PROJECT_NAME=lca-diff-f2-auth FRONTEND_PORT=5176 ./dev check
    docker compose -p lca-diff-f2-auth exec -T workspace bash -lc 'npm --prefix apps/frontend ci && npm --prefix apps/frontend run format:check && npm --prefix apps/frontend run lint && npm --prefix apps/frontend run typecheck && npm --prefix apps/frontend run test:unit && npm --prefix apps/frontend run build && npm --prefix apps/frontend run test:e2e'

    All PASS. Rootless parent UID/GID1000, all capabilities dropped/no-new-privileges, frozen uv and eight preflight regressions verified. Frozen npm install added 230 packages; lock/manifests unchanged. Unit suite: 134 tests/seven files. Production build and two existing browser smoke cases PASS (one Chromium, one Firefox), with no protected requests/runtime errors. Node24.22.3/npm11.19.1/Playwright1.65.1 unchanged from foundation.

    Supplemental QA-only source-browser probe, kept outside tracked implementation: VITE_SERVICE_MODE=mock npm --prefix apps/frontend run dev, then node /tmp/lca-f2-auth-extra-qa.mjs in the same container. Eight additional edge probes PASS independently in each of Chromium/Firefox, covering the sequencing/abort/restore/copy/storage/all-operation denial scenarios above. No runtime errors. Delivered working tree is clean.

    Hosted required quality PASS: https://github.com/DavidVFitzGerald/LCA-diff/actions/runs/43592498569. Historical folders excluded; no PRD/specification deviation requiring an ADR. Forms and complete application lifecycle remain #13/#14/#15. Safari, real Firebase/API/mail, token refresh/revocation, authorization and licensed-data security are untested and not claimed. Next action: coordinator/maintainer review and explicit merge; keep #12 open until approved merge. F2 milestone is not complete.

  6. DavidVFitzGerald commented on Nov 14, 2026

    @DavidVFitzGerald
    OwnerAuthor

    Coordinator: merged/closed. Maintainer confirmed PR #46 merged; GitHub records d05e682 at 2026-11-14T12:25:44Z. Independent QA PASS at delivered SHA 8fc0de2: #12 (comment). Required quality run 43592498569 SUCCESS. AC1–5 deterministic mock adapter slice is complete; forms/session/consolidated acceptance remain #13–#15. No real Firebase/mail/token/backend authorization completion claimed.

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