> For the complete documentation index, see [llms.txt](https://faction-os.gitbook.io/faction-os-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://faction-os.gitbook.io/faction-os-docs/.spec_system/archive/sessions/phase05-session03-web-room-lifecycle-and-state-store/tasks.md).

# Task Checklist

**Session ID**: `phase05-session03-web-room-lifecycle-and-state-store` **Total Tasks**: 22 **Estimated Duration**: 3-4 hours **Created**: 2026-05-29

***

## Legend

* `[x]` = Completed
* `[ ]` = Pending
* `[P]` = Parallelizable (can run with other \[P] tasks)
* `[SNNMM]` = Session reference (NN=phase number, MM=session number)
* `TNNN` = Task ID

***

## Progress Summary

| Category       | Total  | Done   | Remaining |
| -------------- | ------ | ------ | --------- |
| Setup          | 3      | 3      | 0         |
| Foundation     | 6      | 6      | 0         |
| Implementation | 9      | 9      | 0         |
| Testing        | 4      | 4      | 0         |
| **Total**      | **22** | **22** | **0**     |

***

## Setup (3 tasks)

Initial configuration and environment preparation.

### apps/web

* [x] T001 \[S0503] Verify the existing War Room panel, shell metadata, and CockpitShell test baseline before replacing the disabled stub (`apps/web/src/components/WarRoomPanel.tsx`)
* [x] T002 \[S0503] Verify Session 02 protocol exports and web package dependency availability for Worker contract consumption (`apps/web/package.json`)
* [x] T003 \[S0503] Create War Room web test utilities for mocked fetch, WebSocket, and localStorage lifecycle cases (`apps/web/tests/warRoomTestUtils.ts`)

***

## Foundation (6 tasks)

Core client, storage, store, and UI helper structures.

### apps/web

* [x] T004 \[S0503] \[P] Create typed Worker REST and socket client result types, dependency injection, and URL normalization (`apps/web/src/lib/warRoomClient.ts`)
* [x] T005 \[S0503] \[P] Create bounded participant and Worker URL persistence helpers with malformed-storage recovery (`apps/web/src/lib/warRoomIdentity.ts`)
* [x] T006 \[S0503] Create War Room Zustand state shape, initial local-only state, selectors, and action signatures (`apps/web/src/store/useWarRoomStore.ts`)
* [x] T007 \[S0503] \[P] Create War Room lifecycle copy and tone helpers for local-only, unavailable, pending, connected, and disconnected states (`apps/web/src/lib/warRoomUi.ts`)
* [x] T008 \[S0503] \[P] Add focused identity persistence tests for defaults, valid hints, malformed JSON, invalid URLs, oversize names, and reset (`apps/web/tests/warRoomIdentity.test.ts`)
* [x] T009 \[S0503] Update shell metadata helper types from deferred stub copy to optional Worker lifecycle copy (`apps/web/src/lib/cockpitShell.ts`)

***

## Implementation (9 tasks)

Main web lifecycle implementation.

### apps/web

* [x] T010 \[S0503] Implement Worker health, room snapshot, create-room, and join-room requests with schema-validated responses, timeouts, and explicit error mapping (`apps/web/src/lib/warRoomClient.ts`)
* [x] T011 \[S0503] Implement socket URL creation plus connect and disconnect helpers with cleanup on scope exit for all acquired resources (`apps/web/src/lib/warRoomClient.ts`)
* [x] T012 \[S0503] Implement persisted hint hydration, hint updates, local-only reset, and malformed-storage fallback without storing room events or local sensitive state (`apps/web/src/store/useWarRoomStore.ts`)
* [x] T013 \[S0503] Implement create-room action with duplicate-trigger prevention while in-flight, Worker-unavailable fallback, and leader participant capture (`apps/web/src/store/useWarRoomStore.ts`)
* [x] T014 \[S0503] Implement join-room action with validated room code, pending/full/not-found/rate-limited states, duplicate-trigger prevention while in-flight, and explicit error mapping (`apps/web/src/store/useWarRoomStore.ts`)
* [x] T015 \[S0503] Implement connect and disconnect actions with participant revalidation, socket cleanup, failed-upgrade handling, and state reset or revalidation on re-entry (`apps/web/src/store/useWarRoomStore.ts`)
* [x] T016 \[S0503] Replace the disabled War Room panel with Worker URL, participant name, room code, create, join, connect, disconnect, reset, and status controls with platform-appropriate accessibility labels, focus management, and input support (`apps/web/src/components/WarRoomPanel.tsx`)
* [x] T017 \[S0503] Render local-only, loading, empty, invalid input, unavailable, pending, connected, disconnected, and rate-limited panel states without raw request, URL, token, path, prompt, command, export, replay, media, scan, or diagnostic data (`apps/web/src/components/WarRoomPanel.tsx`)
* [x] T018 \[S0503] Update web README Phase 05 notes for lifecycle controls, local-only fallback, bounded persistence, and Session 04-05 deferrals (`apps/web/README_web.md`)

***

## Testing (4 tasks)

Verification and quality assurance.

### apps/web

* [x] T019 \[S0503] \[P] Add Worker client tests for success, timeout, offline, malformed response, rate-limit envelope, room errors, and socket URL behavior (`apps/web/tests/warRoomClient.test.ts`)
* [x] T020 \[S0503] \[P] Add War Room store tests for local-only hydration, create, join, pending, connected, disconnected, unavailable, duplicate guards, and socket cleanup (`apps/web/tests/warRoomStore.test.ts`)
* [x] T021 \[S0503] \[P] Add WarRoomPanel component tests for accessible controls, local-only copy, validation errors, create/join flows, pending state, connected state, disconnect, and unavailable Worker feedback (`apps/web/tests/WarRoomPanel.test.tsx`)
* [x] T022 \[S0503] Update cockpit shell tests and run focused web typecheck/tests plus ASCII/LF validation for the session files (`apps/web/tests/CockpitShell.test.tsx`)

***

## Completion Checklist

Before marking session complete:

* [x] All tasks marked `[x]`
* [x] All tests passing
* [x] All files ASCII-encoded
* [x] `implementation-notes.md` updated
* [x] Ready for the validate workflow step

***

## Next Steps

Run the implement workflow step to begin AI-led implementation.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://faction-os.gitbook.io/faction-os-docs/.spec_system/archive/sessions/phase05-session03-web-room-lifecycle-and-state-store/tasks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
