Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
4a21304
Add auth service
Apr 15, 2026
a977740
Add documentation for widget-scoped auth service and establish implem…
Apr 15, 2026
00d8fd4
Refine auth service slice-1 checklist and update auth service types a…
Apr 15, 2026
5e69084
Update checklist items for slice-1 auth service implementation and te…
Apr 15, 2026
66a51ca
Add fail-first frontend tests for auth service functionality
Apr 15, 2026
f4aa5d2
Integrate XState for login machine management in auth service
Apr 15, 2026
5700665
Archive Priority 5 Auth Service Slice 1 Checklist
Apr 15, 2026
42fb3aa
Add Priority 5 Auth Service Slice 2 Checklist draft
Apr 16, 2026
8862c4d
Mark checklist item C01 as complete for tightening the slice-2 public…
Apr 16, 2026
77511cc
Add fail-first frontend tests for auth service initialization behavior
Apr 16, 2026
a3bd192
Implement slice-2 bootstrap behavior in auth service to manage user v…
Apr 16, 2026
d593f50
Add Priority 5 Auth Service Slice 3 Checklist draft for planning and …
Apr 16, 2026
65f9181
Mark checklist item C01 as complete for tightening the slice-3 public…
Apr 16, 2026
25e6922
Archive and supersede Priority 5 Frontend Architecture Decoupling Che…
Apr 23, 2026
8f7e472
Add .codex to .gitignore to exclude Codex files from version control
Apr 23, 2026
9e72b47
Implement login command ownership and add tests for auth service logi…
Apr 23, 2026
69851f9
Add tests for logout command ownership in auth service
Apr 23, 2026
ea86166
Implement logout command ownership in auth service and handle user st…
Apr 23, 2026
a868165
Add Priority 5 Auth Service Slice 3 Checklist to document completed t…
Apr 23, 2026
2ec8b02
Archive Priority 5 Auth Service Slice 2 Checklist
Apr 23, 2026
e644443
Add Priority 5 Completion Items documentation for auth-service owners…
Apr 23, 2026
7a3d6ad
Update archive status for Priority 5 Auth Service Slice 1 and 2 check…
Apr 23, 2026
4d92615
Update Priority 5 Completion Items: mark direct auth side effects in …
Apr 23, 2026
6ee5e1d
Add tests for signup command ownership in auth-service to validate cr…
Apr 23, 2026
3f740b1
Implement signup command ownership in auth-service to handle user reg…
Apr 23, 2026
263621a
Archive Priority 5 Auth Service Slice 4 Checklist as completed
Apr 23, 2026
dd5dc10
Init guest login slice
Apr 23, 2026
d40e598
Tighten guest login public contract
Apr 23, 2026
bd18d77
Add guest login ownership tests
Apr 23, 2026
1a47af3
Implement guest login command ownership
Apr 23, 2026
c79f414
Archive Priority 5 Auth Service Slice 5 Checklist
Apr 23, 2026
d47bcb9
Remove obsolete auth-service scaffold helper
Apr 23, 2026
f54cb23
Draft auth persistence slice
Apr 23, 2026
501e5a7
Draft login auth-service wiring slice
Apr 24, 2026
68497fa
Draft slice 7 plan
Apr 24, 2026
c22bc50
Expand slice 7 test checklist
Apr 24, 2026
c3f23b0
Clarify slice 7 service seam
Apr 24, 2026
9e148de
Clarify slice 7 runtime snapshot item
Apr 24, 2026
5fdca27
Refine checklist item C03 to clarify the replacement of direct auth A…
Apr 24, 2026
85e0fb5
[codex] Add Svelte component test harness (#180)
rendall Apr 24, 2026
2a93dee
Refactor test watch scripts to use concurrently for unit and componen…
Apr 27, 2026
97a0cd1
Approve slice 7 checklist
Apr 27, 2026
86a1d1b
Add login init delegation test
Apr 27, 2026
09cae27
Add login submit delegation test
Apr 27, 2026
df54d2d
Add signup delegation test
Apr 27, 2026
d5900a2
Add guest delegation tests
Apr 27, 2026
461228d
Add login validation guard tests
Apr 27, 2026
87bbc8b
Add logout delegation test
Apr 27, 2026
0ea1709
Add direct auth call guard test
Apr 27, 2026
3811f06
Add login state bridge test
Apr 27, 2026
4c98a9a
Thread auth service through widget
Apr 27, 2026
2984d1e
Expose auth runtime snapshot
Apr 27, 2026
ef93f37
Delegate login auth commands to service
Apr 28, 2026
675fc8c
Format slice auth service files
Apr 28, 2026
e87ebf3
Archive Priority 5 Auth Service Slice 7 plan and checklist
Apr 28, 2026
c0a9544
Update Priority 5 Auth Service Slice 6 Checklist and Plan to reflect …
Apr 28, 2026
6c58821
Add auth persistence boundary tests
Apr 28, 2026
28499dc
Implement auth persistence boundary
Apr 28, 2026
7bea44e
Add auth service persistence tests
Apr 28, 2026
3be3e07
Inject auth persistence into service
Apr 28, 2026
e4242f3
Update login guest persistence test
Apr 28, 2026
82ef260
Remove login storage ownership
Apr 28, 2026
0b7ea5b
Format slice persistence files
Apr 28, 2026
73b21a3
Archive auth service slice 6 docs
Apr 28, 2026
752b545
Refactor draft slices for auth-service integration in `Login.svelte`
Apr 28, 2026
ee659e5
Approve slice 8 auth bridge plan
Apr 28, 2026
44d3bc8
Add auth store bridge tests
Apr 28, 2026
0cf27e8
Implement auth store bridge
Apr 28, 2026
16a6117
Install auth store bridge
Apr 28, 2026
12f6bf4
Expect Login to stop auth store publish
Apr 28, 2026
6bb66b0
Stop Login auth store publishing
Apr 28, 2026
89e42f7
Mark priority 5 item 8 complete
Apr 28, 2026
73fd24a
Approve slice 9 login relay plan
Apr 28, 2026
c39c38c
Add auth request outcome tests
Apr 28, 2026
c8baf79
Publish auth request outcomes
Apr 28, 2026
765a458
Add Login auth request tests
Apr 28, 2026
d110a6f
Loosen Login validation assertion
Apr 28, 2026
cd27830
Consume pending auth requests in Login
Apr 28, 2026
8b69be2
Add CommentInput auth request tests
Apr 28, 2026
7a63e7c
Remove CommentInput login relay
Apr 28, 2026
77bb1d8
Fix CommentInput auth lint
Apr 28, 2026
6b12d50
Mark priority 5 item 9 complete
Apr 28, 2026
791f7f6
Archive auth service slice 9 docs
Apr 28, 2026
b55e9ca
Approve slice 10 logout relay plan
Apr 28, 2026
abe7e5b
Add SelfDisplay auth logout tests
Apr 28, 2026
bc4cfaf
Use auth service logout in SelfDisplay
Apr 28, 2026
c25a50c
Pass auth service to SelfDisplay
Apr 28, 2026
9e4cde0
Format SelfDisplay auth tests
Apr 28, 2026
d3318c4
Mark priority 5 item 10 complete
Apr 28, 2026
7390a90
Archive completed auth service slices
Apr 28, 2026
fc10865
Side-quest: update Cypress and get cypress tests green.
Apr 28, 2026
53a1ec9
Fix Cypress frontend bootstrap
Apr 28, 2026
296e22d
Approve slice 11 cleanup plan
Apr 28, 2026
3b3a4a2
Add auth relay cleanup tests
Apr 28, 2026
ef5b75b
Remove Login auth relay handling
Apr 28, 2026
c30b708
Subscribe SimpleComment to auth service
Apr 28, 2026
5cfe7ab
Remove obsolete auth store tests
Apr 28, 2026
e70a4cf
Delete obsolete auth relay stores
Apr 28, 2026
3a30bac
Record priority 5 slice 11 completion
Apr 28, 2026
3b78674
Archive priority 5 slice 11 docs
Apr 28, 2026
ea651cc
Record priority 5 auth state architecture decision
Apr 28, 2026
458fea3
Record priority 5 auth eventing decision
Apr 28, 2026
f1e85c1
Record priority 5 validation expectations
Apr 29, 2026
2aece14
Record priority 5 scope boundaries
Apr 29, 2026
d12eb2c
Archive priority 5 completion docs
Apr 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ debug.log
!/dist/css/simple-comment-style.css
!/cypress/**/*.js
deno.lock
.codex
92 changes: 92 additions & 0 deletions docs/archive/Priority5AuthServiceSlice10Checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Priority 5 Auth Service Slice 10 Checklist

Status: approved

Classification: approved implementation checklist

Source plan: `docs/plans/Priority5AuthServiceSlice10Plan.md`

Parent plan: `docs/plans/Priority5Completion.md` (Item 10: Draft a slice for removing `dispatchableStore` / `loginStateStore` logout relay behavior from `SelfDisplay.svelte`)

## Scope Lock

In scope:

- add an explicit `authService` prop to `SelfDisplay.svelte`
- pass the widget-scoped `authService` from `SimpleComment.svelte` to `SelfDisplay.svelte`
- remove `SelfDisplay.svelte` use of `dispatchableStore`
- remove `SelfDisplay.svelte` subscription to `loginStateStore`
- use `authService.authRuntimeSnapshot` for processing state and logout-button visibility
- call `authService.logout()` directly from `SelfDisplay.svelte`
- keep test-writing passes separate from production implementation passes

Out of scope:

- removing `dispatchableStore` from `Login.svelte`
- removing `loginStateStore` selected-tab publication from `Login.svelte`
- removing legacy store definitions
- removing the temporary Slice 8 auth bridge
- changing `CommentInput.svelte`
- changing backend/API contracts
- choosing the final direct-props versus thin auth-service-backed store architecture

## Slice Intent

This slice removes the logout relay from `SelfDisplay.svelte`. After the slice, the visible user panel should observe logout availability through the injected widget-scoped `authService` and call `authService.logout()` directly. `SelfDisplay.svelte` should no longer depend on `dispatchableStore` or `loginStateStore` for logout behavior.

## Atomic Checklist Items

- [x] T01 `[tests]` Add fail-first `SelfDisplay.svelte` component tests for auth-service-driven logout behavior in `src/tests/frontend/components/SelfDisplay.auth-service.test.ts`.
- Depends on: none.
- Required coverage:
- when `authService.authRuntimeSnapshot.nextEvents` includes `LOGOUT`, the logout button is visible for a current user.
- clicking the logout button calls `authService.logout()` directly instead of dispatching `logoutIntent`.
- when auth runtime state is processing, the skeleton display remains visible.
- source guard proves `SelfDisplay.svelte` does not import `dispatchableStore` or `loginStateStore`.
- Trace:
- "Add fail-first component tests proving `SelfDisplay.svelte` reads auth runtime state from `authService`, calls `authService.logout()` directly, and does not import legacy relay stores." (`docs/plans/Priority5AuthServiceSlice10Plan.md`, Approach)
- "Pass: `SelfDisplay.svelte` component tests prove logout button visibility comes from `authService.authRuntimeSnapshot`, clicking Log out calls `authService.logout()`, and legacy relay stores are not imported." (`docs/plans/Priority5AuthServiceSlice10Plan.md`, Validation Strategy)
- "Clicking the logout button calls `authService.logout()` directly." (`docs/plans/Priority5AuthServiceSlice10Plan.md`, Acceptance Criteria)

- [x] C01 `[frontend]` Refactor `src/components/SelfDisplay.svelte` to use injected `authService` runtime state and direct `authService.logout()` instead of legacy logout relay stores.
- Depends on: T01.
- Validated by: T01.
- Trace:
- "add `export let authService: AuthService`" (`docs/plans/Priority5AuthServiceSlice10Plan.md`, Detailed File Impact)
- "subscribe to `authService.authRuntimeSnapshot`" (`docs/plans/Priority5AuthServiceSlice10Plan.md`, Detailed File Impact)
- "call `authService.logout()` directly in `onLogoutClick`" (`docs/plans/Priority5AuthServiceSlice10Plan.md`, Detailed File Impact)
- "remove `dispatchableStore` and `loginStateStore` imports." (`docs/plans/Priority5AuthServiceSlice10Plan.md`, Detailed File Impact)

- [x] C02 `[frontend]` Pass the widget-scoped `authService` from `src/components/SimpleComment.svelte` to `SelfDisplay.svelte`.
- Depends on: C01.
- Validated by: `yarn typecheck`.
- Trace:
- "Pass the existing widget-scoped `authService` from `SimpleComment.svelte` to `SelfDisplay.svelte`." (`docs/plans/Priority5AuthServiceSlice10Plan.md`, In Scope)
- "pass `{authService}` to `SelfDisplay.svelte`." (`docs/plans/Priority5AuthServiceSlice10Plan.md`, Detailed File Impact)
- "`SimpleComment.svelte` passes the widget-scoped `authService` to `SelfDisplay.svelte`." (`docs/plans/Priority5AuthServiceSlice10Plan.md`, Acceptance Criteria)

## Behavior Slices

### Slice 10A

Goal: prove and implement direct logout behavior in `SelfDisplay.svelte`.

Items: T01, C01

Type: behavior

### Slice 10B

Goal: wire the composition root to provide the widget-scoped auth service to `SelfDisplay.svelte`.

Items: C02

Type: mechanical

## Conformance QC (Checklist)

- Missing from plan: none.
- Extra beyond plan: none; each item maps to the plan's file impacts, approach, and validation strategy.
- Atomicity fixes needed: none; each item can be checked and committed independently.
- Validation mapping gaps: none; implementation items are covered by fail-first component tests or typecheck.
- Pass/Fail: checklist achieves plan goals — **Pass**.
184 changes: 184 additions & 0 deletions docs/archive/Priority5AuthServiceSlice10Plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
# Priority 5 Auth Service Slice 10 Plan

Status: approved

Source backlog: `docs/RepoHealthImprovementBacklog.md` (`Priority 5`)

Parent plan: `docs/plans/Priority5Completion.md` (Item 10)

Related artifacts:

- `docs/archive/Priority5AuthServiceSlice9Plan.md`
- `docs/archive/Priority5AuthServiceSlice9Checklist.md`

## Goal

Remove the logout relay dependency from `SelfDisplay.svelte` so logout is triggered through the widget-scoped `auth-service` instead of through `dispatchableStore` and `loginStateStore`.

## Intent

This slice is about letting the visible user panel perform logout directly through the shared auth service.

Today, `SelfDisplay.svelte` uses `loginStateStore` to decide whether auth is processing and whether logout is allowed. When the user clicks the logout button, it dispatches a `logoutIntent` event through `dispatchableStore`, and `Login.svelte` receives that event and calls `authService.logout()`. That keeps logout behavior coupled to a legacy global relay and to the login form component.

After this slice, `SelfDisplay.svelte` should no longer import or use those legacy stores. It should receive the widget-scoped `authService`, observe auth runtime state from that service, and call `authService.logout()` directly when the user clicks Log out.

In plain terms: the user panel should log out through the auth service, not ask the login form to do it by shouting through a shared store.

## In Scope

- Add an `authService` prop to `SelfDisplay.svelte`.
- Pass the existing widget-scoped `authService` from `SimpleComment.svelte` to `SelfDisplay.svelte`.
- Remove `SelfDisplay.svelte` imports and use of `dispatchableStore`.
- Remove `SelfDisplay.svelte` imports and subscription to `loginStateStore`.
- Have `SelfDisplay.svelte` observe `authService.authRuntimeSnapshot` for auth processing state and `nextEvents`.
- Have `SelfDisplay.svelte` call `authService.logout()` directly from the logout button.
- Preserve the current visible user display and skeleton/processing behavior.
- Add fail-first component tests before production changes.

## Out of Scope

- Removing `dispatchableStore` from `Login.svelte`.
- Removing `loginStateStore` selected-tab publication from `Login.svelte`.
- Removing `loginStateStore`, `dispatchableStore`, or `currentUserStore` definitions.
- Removing the temporary Slice 8 auth store bridge.
- Changing `CommentInput.svelte`.
- Changing backend/API contracts.
- Choosing the final direct-props versus thin auth-service-backed store architecture for the whole widget.

## Constraints

- Keep `auth-service` widget-scoped; do not introduce a singleton auth-service import.
- Keep the implementation narrow to `SelfDisplay.svelte` logout behavior and its composition-root prop wiring.
- Keep test-writing passes separate from production implementation passes.
- Do not edit tests during implementation unless the implementation stops and explains why a test is wrong.
- Preserve current behavior where the logout button is visible only when auth runtime state allows `LOGOUT`.

## Current State

At the start of this slice:

- `SelfDisplay.svelte` receives `currentUser` as a prop.
- `SelfDisplay.svelte` imports `dispatchableStore` and dispatches `logoutIntent` from its logout button.
- `SelfDisplay.svelte` imports `loginStateStore` to observe `state` and `nextEvents`.
- `Login.svelte` still subscribes to `dispatchableStore` for `logoutIntent`.
- `SimpleComment.svelte` creates the widget-scoped `authService` but does not pass it to `SelfDisplay.svelte`.
- `auth-service.ts` already owns `logout()` and exposes `authRuntimeSnapshot`.

## Detailed File Impact

### `src/components/SelfDisplay.svelte`

Expected role: user panel that observes auth state and delegates logout directly to `authService`.

Expected changes:

- add `export let authService: AuthService`,
- subscribe to `authService.authRuntimeSnapshot`,
- derive processing state from `authRuntimeSnapshot.state`,
- derive logout-button visibility from `authRuntimeSnapshot.nextEvents`,
- call `authService.logout()` directly in `onLogoutClick`,
- clean up the auth-service subscription in `onDestroy`,
- remove `dispatchableStore` and `loginStateStore` imports.

Non-goals:

- do not change avatar/user-display markup except as required by auth-service wiring.

### `src/components/SimpleComment.svelte`

Expected role: current composition root that owns and passes the widget-scoped auth service.

Expected changes:

- pass `{authService}` to `SelfDisplay.svelte`.

Non-goals:

- do not remove the temporary auth store bridge in this slice.

### `src/components/Login.svelte`

Expected role: unchanged during Slice 10.

Expected changes:

- no production changes expected.

Non-goals:

- do not remove the now-obsolete `logoutIntent` handler in this slice; leave dead relay cleanup to Slice 11.

### `src/lib/svelte-stores.ts`

Expected role: unchanged legacy compatibility surface.

Expected changes:

- none.

## Approach

1. Add fail-first component tests proving `SelfDisplay.svelte` reads auth runtime state from `authService`, calls `authService.logout()` directly, and does not import legacy relay stores.
2. Wire `SelfDisplay.svelte` to the injected auth service and remove legacy store usage.
3. Pass `authService` from `SimpleComment.svelte` to `SelfDisplay.svelte`.
4. Stop there. Do not remove the legacy store definitions, the Slice 8 bridge, or `Login.svelte` dead relay handling.

## Risks and Mitigations

- Risk: this slice quietly becomes the cleanup slice by deleting legacy stores or bridge code.
- Mitigation: keep all legacy-store deletion and bridge cleanup deferred to Slice 11.

- Risk: logout button visibility changes because `SelfDisplay.svelte` observes auth-service state instead of `loginStateStore`.
- Mitigation: derive visibility from the same `nextEvents` shape already bridged from `authService.authRuntimeSnapshot`.

- Risk: processing skeleton behavior changes unintentionally.
- Mitigation: preserve the existing processing-state vocabulary and cover it with component tests.

## Acceptance Criteria

1. `SelfDisplay.svelte` receives `authService` as an explicit prop.
2. `SimpleComment.svelte` passes the widget-scoped `authService` to `SelfDisplay.svelte`.
3. `SelfDisplay.svelte` no longer imports or uses `dispatchableStore`.
4. `SelfDisplay.svelte` no longer imports or subscribes to `loginStateStore`.
5. Clicking the logout button calls `authService.logout()` directly.
6. Logout button visibility still follows whether auth runtime `nextEvents` includes `LOGOUT`.
7. Processing skeleton behavior remains based on auth runtime state.
8. `Login.svelte` logout relay cleanup is deferred to Slice 11.

## Validation Strategy

Required evidence types for Slice 10:

- **Component evidence**
- Pass: `SelfDisplay.svelte` component tests prove logout button visibility comes from `authService.authRuntimeSnapshot`, clicking Log out calls `authService.logout()`, and legacy relay stores are not imported.
- Fail: `SelfDisplay.svelte` still dispatches `logoutIntent` or reads `loginStateStore` for logout behavior.

- **Type/build evidence**
- Pass: frontend typecheck succeeds after passing `authService` into `SelfDisplay.svelte`.
- Fail: component composition or auth-service prop typing introduces type errors.

## Open Questions / Assumptions

- Assumption: `SelfDisplay.svelte` should use `authService.authRuntimeSnapshot` directly rather than a new auth-state store, because the final direct-props versus thin-store architecture decision remains deferred.
- Assumption: leaving the obsolete `Login.svelte` logout relay listener in place until Slice 11 is acceptable because this slice only removes `SelfDisplay.svelte` as a relay producer/consumer.
- Assumption: the temporary Slice 8 auth bridge remains until Slice 11 cleanup.

## Scope Guard

The following work is explicitly deferred and must not be folded into Slice 10 without a separate approved plan/checklist update:

- removing `dispatchableStore` handling from `Login.svelte`,
- deleting `loginStateStore`, `currentUserStore`, or `dispatchableStore`,
- removing the temporary Slice 8 auth bridge,
- changing `CommentInput.svelte`,
- redesigning the frontend auth architecture beyond explicit widget-scoped `authService` props.

## Conformance QC (Plan)

- Intent clarity issues: none; the plan states the user-facing goal and the narrow replacement path.
- Missing required sections: none.
- Ambiguities/assumptions to resolve: none blocking; cleanup work is explicitly deferred.
- Validation strategy gaps: none; component and type/build evidence are defined.
- Traceability readiness: ready; scope, acceptance criteria, and validation statements are quoteable under stable headings.
- Pass/Fail: ready for checklist authoring — **Pass**.
Loading