> 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/phase22-session02-hero-attention-reducer/validation.md).

# Validation Report

**Session ID**: `phase22-session02-hero-attention-reducer` **Package**: apps/web **Validated**: 2026-07-05 **Result**: PASS

## Validation Summary

| Check                     | Status | Notes                                                                                                                                           |
| ------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| Code Review               | PASS   | `code-review.md` exists with `Result: RESOLVED` and records review of all changes since base commit `2d9af05a53126c91bf0a54d2ae3d1d0ef6c8b1f1`. |
| Tasks Complete            | PASS   | 21/21 tasks complete.                                                                                                                           |
| Files Exist               | PASS   | 2/2 deliverables exist and are non-empty.                                                                                                       |
| ASCII Encoding            | PASS   | No non-ASCII bytes or CRLF endings found in changed code, workflow state, or session artifacts.                                                 |
| Tests Passing             | PASS   | Focused reducer test passed; root Vitest passed with 3175 passed, 1 skipped, 0 failed.                                                          |
| Database/Schema Alignment | N/A    | No DB-layer changes, migrations, schema files, SQL, ORM metadata, seeds, or server persistence changes.                                         |
| Success Criteria          | PASS   | Functional requirements, testing requirements, and quality gates are covered by tests, typecheck, code inspection, and security review.         |
| Conventions               | PASS   | Targeted Biome check passed; changed files follow web pure-helper and Vitest conventions.                                                       |
| Security & GDPR           | PASS   | Security PASS; GDPR N/A. See `security-compliance.md`.                                                                                          |
| Behavioral Quality        | PASS   | Application-code spot-check found no trust-boundary, resource, mutation, failure-path, or contract-alignment violations.                        |
| UI Product Surface        | N/A    | No user-facing UI files, routes, or rendered surfaces changed.                                                                                  |

**Overall**: PASS

## Evidence Ledger

Every row names the exact command or targeted inspection used.

| Check               | Command or Inspection                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | Result                                      | Evidence / Blocker                                                                                                                                                                                  |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Project state       | `if [ -d ".spec_system/scripts" ]; then bash .spec_system/scripts/analyze-project.sh --json; else bash /home/aiwithapex/.codex/plugins/cache/apexdev/apex-spec/2.2.18-codex/skills/apex-spec/scripts/analyze-project.sh --json; fi`                                                                                                                                                                                                                                                                                                                                                                                                      | PASS                                        | Active session resolved to `phase22-session02-hero-attention-reducer`; monorepo is true; package scope resolved to `apps/web`.                                                                      |
| Base commit         | `git rev-parse --verify --quiet 2d9af05a53126c91bf0a54d2ae3d1d0ef6c8b1f1^{commit}`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | PASS                                        | Base commit exists locally.                                                                                                                                                                         |
| Code review         | Targeted inspection of `.spec_system/specs/phase22-session02-hero-attention-reducer/code-review.md`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | PASS                                        | `Result: RESOLVED`; scope says all changes since base commit, including uncommitted work and session artifacts.                                                                                     |
| Task completion     | `rg -c '^- \[[ x]\] T[0-9]+' .spec_system/specs/phase22-session02-hero-attention-reducer/tasks.md`; `rg -c '^- \[x\] T[0-9]+' .spec_system/specs/phase22-session02-hero-attention-reducer/tasks.md`                                                                                                                                                                                                                                                                                                                                                                                                                                      | PASS                                        | 21 total tasks; 21 completed tasks.                                                                                                                                                                 |
| Deliverables        | `for f in apps/web/src/lib/gameProjection.ts apps/web/tests/gameProjection.test.ts; do test -s "$f"; done`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | PASS                                        | `gameProjection.ts` size 36002 bytes; `gameProjection.test.ts` size 28166 bytes. Both are inside `apps/web`.                                                                                        |
| ASCII/LF            | `file apps/web/src/lib/gameProjection.ts apps/web/tests/gameProjection.test.ts .spec_system/specs/phase22-session02-hero-attention-reducer/spec.md .spec_system/specs/phase22-session02-hero-attention-reducer/tasks.md .spec_system/specs/phase22-session02-hero-attention-reducer/implementation-notes.md .spec_system/specs/phase22-session02-hero-attention-reducer/code-review.md .spec_system/specs/phase22-session02-hero-attention-reducer/security-compliance.md .spec_system/specs/phase22-session02-hero-attention-reducer/validation.md .spec_system/state.json`; `LC_ALL=C grep -nP '[^\x00-\x7F]' ...`; `rg -nU $'\r' ...` | PASS                                        | `file` reports ASCII text for changed code and session artifacts; non-ASCII grep exited 1 with no matches; CRLF scan exited 1 with no matches.                                                      |
| Focused tests       | `npm test -- apps/web/tests/gameProjection.test.ts`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | PASS                                        | 1 test file passed; 16 tests passed; 0 failed.                                                                                                                                                      |
| Root tests          | `npm test`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | PASS                                        | 275 test files passed, 1 skipped; 3175 tests passed, 1 skipped; 0 failed.                                                                                                                           |
| Package typecheck   | `npm --workspace @factionos/web run typecheck`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | PASS                                        | `tsc -b --noEmit` exited 0.                                                                                                                                                                         |
| Workspace typecheck | `npm run typecheck --workspaces --if-present`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | PASS                                        | Typecheck passed for adapters, server, warroom, web, protocol, and public-website workspaces.                                                                                                       |
| Conventions         | `npm exec -- biome check apps/web/src/lib/gameProjection.ts apps/web/tests/gameProjection.test.ts`; targeted inspection of `.spec_system/CONVENTIONS.md`, `apps/README_apps.md`, and `apps/web/README_web.md`                                                                                                                                                                                                                                                                                                                                                                                                                            | PASS                                        | Biome checked 2 files with no fixes. Changed web files remain in `src/lib/` and `tests/` as expected for pure helpers and Vitest coverage.                                                          |
| Database/schema     | `git diff --name-only 2d9af05a53126c91bf0a54d2ae3d1d0ef6c8b1f1`; targeted inspection of changed files                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | N/A                                         | No database, migration, schema, SQL, ORM, seed, or server persistence files changed.                                                                                                                |
| Success criteria    | Targeted inspection of `spec.md`, `apps/web/src/lib/gameProjection.ts`, `apps/web/tests/gameProjection.test.ts`, focused tests, typecheck, root tests, and privacy tests                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | PASS                                        | Reducer purity, hero preservation, flare/gate lifecycle, alert priority, replay-safe counters, parser compatibility, and privacy exclusions are implemented and tested.                             |
| Security/GDPR       | `npm run security:secrets`; \`rg -n "process.env                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | localStorage                                | sessionStorage                                                                                                                                                                                      |
| Behavioral quality  | Targeted inspection of changed reducer paths against `references/behavioral-quality-checklist.md` priority categories                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | PASS                                        | Checked `gameProjection.ts` reducer/parser paths and `gameProjection.test.ts` coverage. No trust-boundary, resource-cleanup, mutation-safety, failure-path, or contract-alignment violations found. |
| UI product surface  | `git diff --name-only 2d9af05a53126c91bf0a54d2ae3d1d0ef6c8b1f1`; targeted inspection of changed files                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | N/A                                         | Changed files are pure reducer, tests, state, and spec artifacts; no `apps/web/src/components`, route, CSS, or rendered UI files changed.                                                           |
| State update        | Targeted update to `.spec_system/state.json`; \`jq '.next\_session\_history                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | length, .\[-5:]' .spec\_system/state.json\` | PASS                                                                                                                                                                                                |

## 1. Code Review Gate

### Status: PASS

**Report**: `code-review.md` **Result**: RESOLVED **Issues**: None

The report scope covers all changes since base commit `2d9af05a53126c91bf0a54d2ae3d1d0ef6c8b1f1`, including uncommitted work and session artifacts.

## 2. Task Completion

### Status: PASS

**Tasks**: 21/21 complete **Incomplete tasks**: None

## 3. Deliverables Verification

### Status: PASS

| File                                    | Found | Status                                 |
| --------------------------------------- | ----- | -------------------------------------- |
| `apps/web/src/lib/gameProjection.ts`    | Yes   | PASS - non-empty, inside package scope |
| `apps/web/tests/gameProjection.test.ts` | Yes   | PASS - non-empty, inside package scope |

**Missing deliverables**: None

## 4. ASCII Encoding Check

### Status: PASS

| File                                                                                  | Encoding              | Line Endings | Status |
| ------------------------------------------------------------------------------------- | --------------------- | ------------ | ------ |
| `apps/web/src/lib/gameProjection.ts`                                                  | ASCII                 | LF           | PASS   |
| `apps/web/tests/gameProjection.test.ts`                                               | ASCII                 | LF           | PASS   |
| `.spec_system/specs/phase22-session02-hero-attention-reducer/spec.md`                 | ASCII                 | LF           | PASS   |
| `.spec_system/specs/phase22-session02-hero-attention-reducer/tasks.md`                | ASCII                 | LF           | PASS   |
| `.spec_system/specs/phase22-session02-hero-attention-reducer/implementation-notes.md` | ASCII                 | LF           | PASS   |
| `.spec_system/specs/phase22-session02-hero-attention-reducer/code-review.md`          | ASCII                 | LF           | PASS   |
| `.spec_system/specs/phase22-session02-hero-attention-reducer/security-compliance.md`  | ASCII                 | LF           | PASS   |
| `.spec_system/specs/phase22-session02-hero-attention-reducer/validation.md`           | ASCII                 | LF           | PASS   |
| `.spec_system/state.json`                                                             | ASCII-compatible JSON | LF           | PASS   |

**Encoding issues**: None

## 5. Test Results

### Status: PASS

| Metric               | Value                                               |
| -------------------- | --------------------------------------------------- |
| Focused Test Command | `npm test -- apps/web/tests/gameProjection.test.ts` |
| Focused Tests        | 16 passed, 0 failed                                 |
| Root Test Command    | `npm test`                                          |
| Root Test Files      | 275 passed, 1 skipped                               |
| Root Tests           | 3175 passed, 1 skipped, 0 failed                    |
| Coverage             | Not generated by these commands                     |

**Failed tests**: None

## 6. Database/Schema Alignment

### Status: N/A

**Evidence**: `git diff --name-only 2d9af05a53126c91bf0a54d2ae3d1d0ef6c8b1f1` and targeted changed-file inspection found no DB-layer changes, schema artifacts, migrations, SQL, ORM metadata, seeds, or persisted server data shape changes.

**Issues found**: None

## 7. Success Criteria

From `spec.md`:

**Functional requirements**:

* PASS - `reduceGameProjection` returns the original state reference for ignored and unchanged events, verified by focused tests and reducer inspection.
* PASS - `internal_hero_spawn`, `roster_update`, and `hero_dismissed` preserve earned hero aggregates and avoid roster source-of-truth copies, verified by focused tests.
* PASS - `awaiting_input` records one active flare per hero without storing prompt text and promotes flare focus, verified by focused tests.
* PASS - `input_received` clears matching flares, promotes the next focus, and updates Swift Command counters only outside replay mode, verified by focused tests.
* PASS - Legacy `permission_request` and `permission_response` create and clear gate refs without storing rationale or detail, verified by focused tests.
* PASS - `guarded_action_update` and `command_center_permission_update` reconcile active and terminal gate refs, verified by focused tests and protocol inspection.
* PASS - `recomputeAlertFocus` produces `flare > gate > siege > ram > skirmisher > newCamp > null`, verified by focused tests.
* PASS - Snapshot and replay handling do not mint progress values, verified by focused tests and reducer inspection.

**Testing requirements**:

* PASS - `apps/web/tests/gameProjection.test.ts` covers reducer purity, unchanged references, hero lifecycle, flare and gate lifecycle, alert priority, replay-safe behavior, parser compatibility, and privacy serialization exclusions.
* PASS - `npm test -- apps/web/tests/gameProjection.test.ts` passed with 16 tests.
* PASS - `npm --workspace @factionos/web run typecheck` passed.

**Quality gates**:

* PASS - ASCII and LF checks passed.
* PASS - Targeted Biome check passed.
* PASS - No UI surface changed.

## 8. Conventions Compliance

### Status: PASS

**Categories spot-checked**: naming, file structure, error handling, comments, testing, and database conventions when relevant.

**Convention violations**: None

Evidence: `.spec_system/CONVENTIONS.md` defines npm workspaces, Biome, TypeScript typecheck, and Vitest. `apps/web/README_web.md` places pure helpers in `src/lib/` and tests in `tests/`. The changed files follow that structure, and `npm exec -- biome check apps/web/src/lib/gameProjection.ts apps/web/tests/gameProjection.test.ts` passed.

## 9. Security & GDPR Compliance

### Status: PASS

**Full report**: See `security-compliance.md` in this session directory.

#### Summary

| Area     | Status | Findings |
| -------- | ------ | -------- |
| Security | PASS   | 0 issues |
| GDPR     | N/A    | 0 issues |

**Critical violations**: None

## 10. Behavioral Quality Spot-Check

### Status: PASS

**Checklist applied**: Yes **Files spot-checked**:

* `apps/web/src/lib/gameProjection.ts`
* `apps/web/tests/gameProjection.test.ts`

**Categories spot-checked**: trust boundaries, resource cleanup, mutation safety, failure paths, and contract alignment.

**Violations found**: None

**Fixes applied during validation**: None

## 11. UI Product-Surface Spot-Check

### Status: N/A

**Surfaces inspected**: N/A - changed files are pure reducer, tests, state, and spec artifacts only. **Diagnostics found in primary UI**: None **Allowed debug/admin surfaces**: None **Fixes applied during validation**: None

## Validation Result

### PASS

All validation gates passed for `phase22-session02-hero-attention-reducer`.

### Unresolved Failures And Blockers

None

## Next Steps

Next command: `updateprd`

Reason: all validation checks passed; the session is ready to be marked complete.


---

# 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/phase22-session02-hero-attention-reducer/validation.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.
