> 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-session06-battlefield-camp-layer/code-review.md).

# Code Review and Repair Report

**Session ID**: `phase23-session06-battlefield-camp-layer` **Package**: apps/web **Reviewed**: 2026-07-05 **Base Commit**: 9bd52bab83a07b4ca415b0d864f8df491d9b1194 **Scope**: All changes since the base commit (uncommitted work plus mid-session commits) **Result**: RESOLVED

## Review Surface

**Files reviewed** (all changes since the base commit):

* `.spec_system/state.json` - tracked-modified
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/spec.md` - untracked
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - untracked
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - untracked
* `apps/web/src/components/battlefield/Battlefield.tsx` - tracked-modified
* `apps/web/src/components/battlefield/CampLayer.tsx` - untracked
* `apps/web/src/index.css` - tracked-modified
* `apps/web/tests/Battlefield.test.tsx` - tracked-modified

**Inventory commands**: `git status`, `git log --oneline "$BASE"..HEAD`, `git diff "$BASE"`, `git diff --cached "$BASE"`, `git ls-files --others --exclude-standard`

## Findings by Severity

### Critical

* No findings.

### High

* No findings.

### Medium

* No findings.

### Low

* `apps/web/tests/Battlefield.test.tsx:180` - The new dry Banish test stubbed global `fetch`, but the file cleanup did not unstub globals. That could leak the fetch mock into later tests in the same worker and hide network-related failures. | Fix: Added `vi.unstubAllGlobals()` to the file-level `afterEach`, matching the existing cleanup pattern used by other web tests that call `vi.stubGlobal`. | Status: FIXED

## Assumptions and Deliberate Non-Fixes

None.

## Behavior Changes

None from review repair. The only repair changes test cleanup isolation and does not alter product runtime behavior.

## Evidence Ledger

Every row names the exact command or targeted inspection used.

| Check                          | Command or Inspection                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | Result | Evidence / Blocker                                                                                                                                                                                                                                                   |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Analyzer                       | `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   | Current session resolved to `phase23-session06-battlefield-camp-layer`; monorepo true; package context `apps/web`.                                                                                                                                                   |
| Base commit                    | `git rev-parse --verify 9bd52bab83a07b4ca415b0d864f8df491d9b1194^{commit}`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | PASS   | Base commit exists and resolved to `9bd52bab83a07b4ca415b0d864f8df491d9b1194`.                                                                                                                                                                                       |
| Inventory                      | `git status --short`; `git log --oneline 9bd52bab83a07b4ca415b0d864f8df491d9b1194..HEAD`; `git diff --name-status 9bd52bab83a07b4ca415b0d864f8df491d9b1194`; `git diff --cached 9bd52bab83a07b4ca415b0d864f8df491d9b1194`; `git ls-files --others --exclude-standard`                                                                                                                                                                                                                                                                                                                          | PASS   | Four tracked modified files, four untracked files before this report, no staged changes, and no mid-session commits after the base.                                                                                                                                  |
| Context review                 | Targeted inspections: `.spec_system/CONVENTIONS.md`, `.spec_system/CONSIDERATIONS.md`, session `spec.md`, `tasks.md`, and full `implementation-notes.md`; `package.json`; `apps/web/package.json`; `biome.jsonc`; `apps/web/tsconfig.json`; `vitest.config.ts`                                                                                                                                                                                                                                                                                                                                 | PASS   | Confirmed Node 26.2.0/npm 11.16.0, Biome format/lint, strict web TypeScript, Vitest web tests under happy-dom, and all 22 session tasks complete.                                                                                                                    |
| Behavioral and security review | Targeted inspections: `apps/web/src/lib/legionCamps.ts`, `apps/web/src/lib/gameProjection.ts`, `apps/web/src/lib/questBoard.ts`, `apps/web/src/store/useGameStore.ts`, `apps/web/src/components/battlefield/Battlefield.tsx`, `apps/web/src/components/battlefield/CampLayer.tsx`, `apps/web/src/index.css`, `apps/web/tests/Battlefield.test.tsx`                                                                                                                                                                                                                                             | PASS   | Camp rendering stays presentation-only, selector-led, product-facing, accessible, and bounded to existing Quest Board focus/Banish actions; no new protocol event, storage key, server route, art asset, reward, hosted state, or raw issue details were introduced. |
| Repair verification            | `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm test -- apps/web/tests/Battlefield.test.tsx`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | PASS   | Focused Battlefield suite passed: 1 file, 20 tests.                                                                                                                                                                                                                  |
| Type checker                   | `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm --workspace @factionos/web run typecheck`; `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm run typecheck --workspaces --if-present`                                                                                                                                                                                                                                                                                                                                                                            | PASS   | Web `tsc -b --noEmit` passed; workspace typecheck passed for adapters, server, warroom, web, protocol, and public-website.                                                                                                                                           |
| Tests                          | `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm test`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | PASS   | Full Vitest suite passed: 278 files passed, 1 skipped; 3247 tests passed, 1 skipped.                                                                                                                                                                                 |
| Formatter                      | `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm run format:check`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | PASS   | Biome checked 778 files with no fixes applied.                                                                                                                                                                                                                       |
| Linter                         | `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm run lint`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | PASS   | Biome checked 780 files with no fixes applied.                                                                                                                                                                                                                       |
| Whitespace                     | `git diff --check`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | PASS   | No whitespace errors.                                                                                                                                                                                                                                                |
| ASCII                          | `perl -ne 'if (/[^\\x00-\\x7F]/) { print "$ARGV:$.:$_"; $bad=1 } END { exit($bad ? 1 : 0) }' .spec_system/state.json .spec_system/specs/phase23-session06-battlefield-camp-layer/spec.md .spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md .spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md .spec_system/specs/phase23-session06-battlefield-camp-layer/code-review.md apps/web/src/components/battlefield/Battlefield.tsx apps/web/src/components/battlefield/CampLayer.tsx apps/web/src/index.css apps/web/tests/Battlefield.test.tsx` | PASS   | No non-ASCII characters found in changed session files, including this report.                                                                                                                                                                                       |
| LF line endings                | `perl -ne 'if (/\\r/) { print "$ARGV:$.:CRLF\\n"; $bad=1 } END { exit($bad ? 1 : 0) }' .spec_system/state.json .spec_system/specs/phase23-session06-battlefield-camp-layer/spec.md .spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md .spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md .spec_system/specs/phase23-session06-battlefield-camp-layer/code-review.md apps/web/src/components/battlefield/Battlefield.tsx apps/web/src/components/battlefield/CampLayer.tsx apps/web/src/index.css apps/web/tests/Battlefield.test.tsx`       | PASS   | No CRLF line endings found in changed session files, including this report.                                                                                                                                                                                          |
| Final diff re-read             | `git diff 9bd52bab83a07b4ca415b0d864f8df491d9b1194` plus full reads of untracked text files and targeted line-number inspections                                                                                                                                                                                                                                                                                                                                                                                                                                                               | PASS   | Final reread found no remaining defects after the test cleanup repair.                                                                                                                                                                                               |

## Summary

1. Reviewed 8 files from the session review surface before this report: 4 tracked modified files and 4 untracked text files, with no mid-session commits.
2. Findings: 0 critical, 0 high, 0 medium, 1 low. The low finding was fixed by unstubbing globals in `Battlefield.test.tsx` cleanup.
3. No deliberate non-fixes and no remaining blockers.
4. Evidence: focused Battlefield tests, full workspace tests, web and workspace typechecks, Biome format check, Biome lint, whitespace check, ASCII check, LF check, and final diff reread passed.


---

# 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-session06-battlefield-camp-layer/code-review.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.
