> 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/phase23-session03-projection-folding/tasks.md).

# Task Checklist

**Session ID**: `phase23-session03-projection-folding` **Total Tasks**: 20 **Estimated Duration**: 3-4 hours **Created**: 2026-07-05

***

Legend: `[x]` completed; `[ ]` pending; `[P]` parallelizable; `[SNNMM]` session ref; `TNNN` task ID.

***

## Setup (3 tasks)

* [x] T001 \[S2303] Verify current `suggestion_update` reducer no-op, projection alert focus helpers, and Session 01 reconciliation exports (`apps/web/src/lib/gameProjection.ts`, `apps/web/src/lib/legionCamps.ts`)
* [x] T002 \[S2303] Verify existing suggestion snapshot factories and no-progress regression assertions (`apps/web/tests/gameProjection.test.ts`)
* [x] T003 \[S2303] Verify focused web test and typecheck commands for this package (`package.json`, `apps/web/package.json`)

***

## Foundation (4 tasks)

* [x] T004 \[S2303] Import the pure camp reconciliation helper and update reducer signatures for typed `suggestion_update` input with explicit replay rejection (`apps/web/src/lib/gameProjection.ts`)
* [x] T005 \[S2303] Add reducer-local camp record equality helpers so no-op snapshots preserve object identity and `lastEventAt` (`apps/web/src/lib/gameProjection.ts`)
* [x] T006 \[S2303] Add reducer-local sector record equality helpers for stable safe labels, cells, fog, and touch timestamps (`apps/web/src/lib/gameProjection.ts`)
* [x] T007 \[S2303] Add or adapt test helpers for multi-sector codebase issue snapshots, large issue sets, replay context, and mock context (`apps/web/tests/gameProjection.test.ts`)

***

## Implementation (7 tasks)

* [x] T008 \[S2303] Replace the `suggestion_update` camp no-op with `reconcileLegionCamps` using codebase issues, previous camps, previous sectors, and snapshot timestamp fallback (`apps/web/src/lib/gameProjection.ts`)
* [x] T009 \[S2303] Apply reconciled camps and sectors only when aggregate records differ, returning the original state for identical snapshots (`apps/web/src/lib/gameProjection.ts`)
* [x] T010 \[S2303] Update `lastEventAt` only when camp or sector reconciliation changes projection state (`apps/web/src/lib/gameProjection.ts`)
* [x] T011 \[S2303] Recompute alert focus through existing priority helpers after camp changes without overriding flares, gates, siege, rams, or skirmishers (`apps/web/src/lib/gameProjection.ts`)
* [x] T012 \[S2303] Preserve pending links, camp links, mission links, heroes, essence, buildings, War Tide, council, nemeses, season, attention, and flare ceremony during scanner reconciliation (`apps/web/src/lib/gameProjection.ts`)
* [x] T013 \[S2303] Keep replayed `suggestion_update` events progress-inert and camp-inert through an explicit reducer guard (`apps/web/src/lib/gameProjection.ts`)
* [x] T014 \[S2303] Allow mock-enabled non-replay snapshots to fold camps in memory while leaving persistence guard behavior unchanged (`apps/web/src/lib/gameProjection.ts`)

***

## Testing (6 tasks)

* [x] T015 \[S2303] \[P] Add tests that a three-issue, two-sector snapshot creates two camps with expected HP, tiers, stable labels, stable cells, and sorted issue ids (`apps/web/tests/gameProjection.test.ts`)
* [x] T016 \[S2303] \[P] Add tests for large issue coalescing, repeated-snapshot entrenchment increment, changed-membership reset, and removed issue cleanup (`apps/web/tests/gameProjection.test.ts`)
* [x] T017 \[S2303] \[P] Add tests proving replayed snapshots do not mutate camps and mock-enabled snapshots fold in memory without changing persistence guard assertions (`apps/web/tests/gameProjection.test.ts`)
* [x] T018 \[S2303] \[P] Add tests proving scanner reconciliation does not mutate XP, loot, banners, achievements, camp damage, pending links, camp links, or unrelated projection fields (`apps/web/tests/gameProjection.test.ts`)
* [x] T019 \[S2303] \[P] Add alert focus and privacy tests for new-camp priority, higher-priority focus preservation, and absence of raw issue prompts, messages, absolute paths, event bodies, terminal output, provider payloads, file contents, environment values, or secrets (`apps/web/tests/gameProjection.test.ts`)
* [x] T020 \[S2303] Run focused Vitest, web typecheck, and ASCII/LF validation (`npm --workspace @factionos/web test -- gameProjection.test.ts`, `npm --workspace @factionos/web run typecheck`, `apps/web/src/lib/gameProjection.ts`)

***

## Completion Checklist

* [x] All tasks marked `[x]`
* [x] All tests and checks passing
* [x] All files ASCII-encoded with LF line endings
* [x] implementation-notes.md updated
* [x] Ready for `creview` (next step in the implement -> creview -> validate sequence)

***

## Next Steps

Run the `creview` workflow step.


---

# 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/phase23-session03-projection-folding/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.
