> 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/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md).

# Implementation Notes

**Session ID**: `phase02-session03-hero-and-mission-workflow-completion` **Package**: apps/web **Started**: 2026-05-29 07:35 IDT **Last Updated**: 2026-05-29 08:00 IDT

***

## Session Progress

| Metric              | Value   |
| ------------------- | ------- |
| Tasks Completed     | 22 / 22 |
| Estimated Remaining | 0 hours |
| Blockers            | 0       |

***

## Task Log

### 2026-05-29 - Session Start

**Environment verified**:

* [x] Prerequisites confirmed with `check-prereqs.sh --json --env --package apps/web`
* [x] Tools available with `check-prereqs.sh --json --tools node,npm`
* [x] Directory structure ready

**Baseline evidence**:

* `npm test -- apps/web/tests/HeroCard.test.tsx apps/web/tests/HeroDetailDrawer.test.tsx apps/web/tests/MissionDetailDrawer.test.tsx apps/web/tests/MissionLog.test.tsx apps/web/tests/MissionLogClickable.test.tsx apps/web/tests/MissionLogFilter.test.tsx apps/web/tests/MissionTimeline.test.tsx apps/web/tests/Leaderboard.test.tsx apps/web/tests/CockpitShell.test.tsx` - 9 files passed, 130 tests passed.
* `npm test -- apps/web/tests` - 61 files passed, 1438 tests passed.

**Open risks**:

* Node runtime is v24.14.0 in this environment while the package only requires Node >=20 and the spec calls for Node.js 20 knowledge.
* Worktree already contains many modified and untracked files from previous sessions; this session will keep edits scoped to `apps/web` and this spec directory.

***

### Task T001 - Verify prerequisites and baseline tests

**Started**: 2026-05-29 07:34 IDT **Completed**: 2026-05-29 07:35 IDT **Duration**: 1 minute

**Notes**:

* Verified Session 01 and Session 02 are listed as completed in `.spec_system/state.json`.
* Verified the active package `apps/web` and required Node/npm tools through the spec system prerequisite script.
* Captured focused and full web baseline test evidence before application edits.

**Files Changed**:

* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Captured baseline evidence and session risks.

**BQC Fixes**:

* N/A - setup evidence only.

***

### Task T002 - Create implementation notes

**Started**: 2026-05-29 07:35 IDT **Completed**: 2026-05-29 07:36 IDT **Duration**: 1 minute

**Notes**:

* Created this implementation log with environment evidence, baseline commands, completed task log, and open risk tracking.
* Established the per-task evidence format for the rest of the session.

**Files Changed**:

* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Added session progress, baseline evidence, and task logs.

**BQC Fixes**:

* N/A - spec artifact only.

***

### Task T003 - Audit workflow contracts

**Started**: 2026-05-29 07:36 IDT **Completed**: 2026-05-29 07:38 IDT **Duration**: 2 minutes

**Notes**:

* Compared current web workflow code against PRD hero/mission requirements, UX workflow requirements, and API permission/plan response docs.
* Confirmed no new protocol scope is needed for this session; existing `Hero`, `Mission`, `Plan`, `permission_response`, and `plan_approval_response` shapes cover the UI work.
* Identified implementation gaps to close in later tasks: shared hero/mission openers, reversible hero-scope filter copy, missing-data fallbacks, permission expiry context, and duplicate decision guards.

**Files Changed**:

* `apps/web/README_web.md` - Added the local hero, mission, permission, and plan workflow contract used by this session.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded audit evidence.

**BQC Fixes**:

* N/A - documentation audit only.

***

### Task T004 - Create workflow context helper

**Started**: 2026-05-29 07:38 IDT **Completed**: 2026-05-29 07:40 IDT **Duration**: 2 minutes

**Notes**:

* Added pure workflow helpers for hero and mission labels, active filter summaries, deterministic empty-state copy, permission expiry states, permission context, and plan/task status copy.
* Used `Record<PlanState, ...>` and `Record<PlanTaskState, ...>` maps so plan enum handling stays exhaustive against the protocol contract.

**Files Changed**:

* `apps/web/src/lib/workflowContext.ts` - Added workflow state, copy, and status helpers.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded helper implementation evidence.

**BQC Fixes**:

* Contract alignment: Plan and task state labels are keyed by protocol enum records so newly-added enum values will produce a TypeScript error.
* Failure path completeness: Invalid or missing expiry, prompt, rationale, detail, and token values produce explicit fallback copy instead of blank surfaces.

***

### Task T005 - Write workflow context unit tests

**Started**: 2026-05-29 07:40 IDT **Completed**: 2026-05-29 07:41 IDT **Duration**: 1 minute

**Notes**:

* Added unit coverage for selected hero and mission labels, filter summaries, empty states, permission expiry handling, permission context fallback copy, plan summaries, and every declared plan task state.
* Made token-budget formatting deterministic with `en-US` numeric formatting while writing the assertions.

**Files Changed**:

* `apps/web/tests/workflowContext.test.ts` - Added 12 focused helper tests.
* `apps/web/src/lib/workflowContext.ts` - Made token budget formatting locale-stable for test and UI consistency.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded test evidence.

**Verification**:

* `npm test -- apps/web/tests/workflowContext.test.ts` - 1 file passed, 12 tests passed.

**BQC Fixes**:

* Contract alignment: Tests enumerate every current `PlanTaskState` value and assert a status mapping.
* Failure path completeness: Tests cover missing hero, missing mission, invalid expiry, missing rationale, and empty plan tasks.

***

### Task T006 - Add synchronized workflow actions

**Started**: 2026-05-29 07:41 IDT **Completed**: 2026-05-29 07:42 IDT **Duration**: 1 minute

**Notes**:

* Added `openHeroDetail`, `openMissionDetail`, and `clearHeroScope` actions to the game store.
* Routed existing `setSelectedHeroId` and `setSelectedMissionId` through the shared actions so older callers keep working while new components use the workflow names.
* Mission opening now revalidates the mission id, opens mission detail, and synchronizes hero selection when the mission hero exists.

**Files Changed**:

* `apps/web/src/store/useGameStore.ts` - Added synchronized hero and mission workflow actions.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded store action implementation evidence.

**Verification**:

* `npm test -- apps/web/tests/MissionLogClickable.test.tsx apps/web/tests/HeroDetailDrawer.test.tsx apps/web/tests/MissionDetailDrawer.test.tsx apps/web/tests/workflowContext.test.ts` - 4 files passed, 75 tests passed.

**BQC Fixes**:

* State freshness on re-entry: Missing heroes or missions clear stale selected ids instead of keeping dead drawer state.
* Contract alignment: Mission openers reselect the mission's existing hero, keeping `selectedHeroId` and `selectedMissionId` aligned.

***

### Task T007 - Harden permission and plan resolution guards

**Started**: 2026-05-29 07:42 IDT **Completed**: 2026-05-29 07:43 IDT **Duration**: 1 minute

**Notes**:

* Added accepted-decision tracking for permission and plan responses so repeated local resolve calls after the first accepted decision return `false` and do not duplicate state changes.
* Added local result toasts for approved, denied, accepted, and rejected decisions.
* Cleared decision tracking when matching server response events arrive or new matching plans are generated.

**Files Changed**:

* `apps/web/src/store/useGameStore.ts` - Added permission and plan duplicate-response guards plus result feedback.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded duplicate guard evidence.

**Verification**:

* `npm test -- apps/web/tests/MissionLogClickable.test.tsx apps/web/tests/workflowContext.test.ts` - 2 files passed, 17 tests passed.
* `npm --workspace apps/web run typecheck` - Passed.

**BQC Fixes**:

* Duplicate action prevention: Store resolution actions now no-op after the first accepted local permission or plan decision.
* Failure path completeness: Missing requests and missing plans now return `false` instead of silently implying success.

***

### Task T008 - Create shared workflow fixtures

**Started**: 2026-05-29 07:43 IDT **Completed**: 2026-05-29 07:44 IDT **Duration**: 1 minute

**Notes**:

* Added shared builders for hero, mission, tool-use, permission request, plan, and plan task records.
* Added map helpers so component tests can seed store records without repeating object boilerplate.

**Files Changed**:

* `apps/web/tests/workflowFixtures.ts` - Added shared focused workflow fixtures.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded fixture implementation evidence.

**Verification**:

* `npm --workspace apps/web run typecheck` - Passed.

**BQC Fixes**:

* N/A - test fixture data only.

***

### Task T009 - Update HeroCard workflow selection

**Started**: 2026-05-29 07:44 IDT **Completed**: 2026-05-29 07:45 IDT **Duration**: 1 minute

**Notes**:

* Routed hero card selection through `openHeroDetail`.
* Added `aria-pressed`, `data-selected`, and an accessible label that includes hero state plus active mission context.
* Added screen-reader-only active mission prefix so the prompt is not contextless.

**Files Changed**:

* `apps/web/src/components/HeroCard.tsx` - Updated selected state, labels, and shared opener.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded component update evidence.

**Verification**:

* `npm test -- apps/web/tests/HeroCard.test.tsx apps/web/tests/MissionLogClickable.test.tsx` - 2 files passed, 12 tests passed.

**BQC Fixes**:

* Accessibility and platform compliance: Hero cards now expose selected state and a complete accessible name.
* State freshness on re-entry: Selection uses the shared store opener, which clears stale mismatched mission state.

***

### Task T010 - Update HeroRoster selected scope

**Started**: 2026-05-29 07:45 IDT **Completed**: 2026-05-29 07:46 IDT **Duration**: 1 minute

**Notes**:

* Added a selected hero scope strip that explains mission-log scoping, counts hero-scoped missions, and exposes a clear action.
* Added scoped header state and a more explicit empty state when only dismissed heroes remain.

**Files Changed**:

* `apps/web/src/components/HeroRoster.tsx` - Added selected scope summary, clear affordance, and explicit empty copy.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded roster update evidence.

**Verification**:

* `npm test -- apps/web/tests/HeroRosterSort.test.tsx apps/web/tests/HeroCard.test.tsx` - 2 files passed, 19 tests passed.

**BQC Fixes**:

* State freshness on re-entry: Clear action resets hero scope through the store action instead of ad hoc local state.
* Accessibility and platform compliance: Clear control has an explicit accessible name tied to the selected hero.

***

### Task T011 - Update HeroDetailDrawer mission handoffs

**Started**: 2026-05-29 07:46 IDT **Completed**: 2026-05-29 07:47 IDT **Duration**: 1 minute

**Notes**:

* Routed active and recent mission openings through `openMissionDetail`.
* Added missing active mission copy for stale local snapshots.
* Expanded mission handoff accessible labels with hero name and mission state.

**Files Changed**:

* `apps/web/src/components/HeroDetailDrawer.tsx` - Updated active and recent mission handoffs and missing active mission copy.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded drawer handoff evidence.

**Verification**:

* `npm test -- apps/web/tests/HeroDetailDrawer.test.tsx apps/web/tests/MissionDetailDrawer.test.tsx` - 2 files passed, 58 tests passed.

**BQC Fixes**:

* State freshness on re-entry: Mission handoffs now revalidate mission and hero context through the shared store opener.
* Failure path completeness: Missing active mission records now render explicit local snapshot copy instead of silently disappearing.

***

### Task T012 - Update MissionLog filtering workflow

**Started**: 2026-05-29 07:47 IDT **Completed**: 2026-05-29 07:48 IDT **Duration**: 1 minute

**Notes**:

* Added active filter summary with clear-hero and clear-all actions.
* Routed mission row openings through `openMissionDetail`.
* Made filtering empty states specific to no data versus hidden rows.
* Added deterministic started-time sorting with id tie-breaks and bounded assistant-text search input to the first 2000 characters.

**Files Changed**:

* `apps/web/src/components/MissionLog.tsx` - Added filter summary, clear actions, bounded filtering, deterministic ordering, and shared mission opener.
* `apps/web/src/lib/workflowContext.ts` - Updated empty-state copy to name active filters.
* `apps/web/tests/MissionLogClickable.test.tsx` - Updated accessible label assertion for richer mission row labels.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded mission log evidence.

**Verification**:

* `npm test -- apps/web/tests/MissionLog.test.tsx apps/web/tests/MissionLogClickable.test.tsx apps/web/tests/MissionLogFilter.test.tsx apps/web/tests/MissionLogTags.test.tsx apps/web/tests/workflowContext.test.ts` - 5 files passed, 55 tests passed.

**BQC Fixes**:

* State freshness on re-entry: Mission rows use the shared mission opener, which revalidates selected mission and hero context.
* Failure path completeness: Empty states distinguish no data from filters that hide rows.
* Error information boundaries: Search only inspects a bounded assistant-text preview rather than unbounded streamed text.

***

### Task T013 - Update MissionDetailDrawer context

**Started**: 2026-05-29 07:48 IDT **Completed**: 2026-05-29 07:49 IDT **Duration**: 1 minute

**Notes**:

* Added local context with hero handoff, missing hero copy, and offline snapshot copy.
* Added mission status context for pending, awaiting approval, failed, and cancelled states.
* Added plan context when the open workpad plan matches the mission plan id, plus missing plan snapshot copy when only the id is present.
* Bounded assistant text rendering to the first 4000 characters with explicit trim copy.

**Files Changed**:

* `apps/web/src/components/MissionDetailDrawer.tsx` - Added hero, runtime, plan, status, and bounded text context.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded mission detail evidence.

**Verification**:

* `npm test -- apps/web/tests/MissionDetailDrawer.test.tsx` - 1 file passed, 26 tests passed.

**BQC Fixes**:

* Failure path completeness: Missing hero, missing plan snapshot, offline runtime, and terminal mission states now have explicit UI copy.
* Error information boundaries: Assistant text is bounded in the detail view instead of rendering an unlimited streamed buffer.
* Accessibility and platform compliance: Hero handoff is a native button with a specific accessible name.

***

### Task T014 - Update MissionTimeline captions and labels

**Started**: 2026-05-29 07:49 IDT **Completed**: 2026-05-29 07:50 IDT **Duration**: 1 minute

**Notes**:

* Added a visible caption that describes mission bars, tool-call line, active hours, and no-history state.
* Added per-bar accessible labels so mission and tool counts are not color-only.

**Files Changed**:

* `apps/web/src/components/MissionTimeline.tsx` - Added timeline summary copy and per-bar labels.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded timeline evidence.

**Verification**:

* `npm test -- apps/web/tests/MissionTimeline.test.tsx apps/web/tests/HeroDetailDrawer.test.tsx` - 2 files passed, 43 tests passed.

**BQC Fixes**:

* Accessibility and platform compliance: Timeline counts and no-history state are now available as text and ARIA, not only visual marks.

***

### Task T015 - Update PermissionModal decision context

**Started**: 2026-05-29 07:50 IDT **Completed**: 2026-05-29 07:51 IDT **Duration**: 1 minute

**Notes**:

* Added dialog semantics, title and description wiring, requester/action/boundary context, expiry state copy, bounded detail rendering, and pending button labels.
* Disabled approve and deny while a decision is submitting or the request has expired.
* Routed decisions through the hardened store action, which provides local result toasts and duplicate guards.

**Files Changed**:

* `apps/web/src/components/PermissionModal.tsx` - Added contextual, guarded permission decision UI.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded permission modal evidence.

**Verification**:

* `npm --workspace apps/web run typecheck` - Passed.

**BQC Fixes**:

* Duplicate action prevention: Approve and deny are disabled after the first local click and the store rejects duplicate resolves.
* State freshness on re-entry: Local submitting state resets when a new request id opens.
* Accessibility and platform compliance: Permission UI now has dialog semantics and explicit labels.
* Error information boundaries: Long permission details are bounded to the first 2000 characters.

***

### Task T016 - Update PlanWorkpad decision context

**Started**: 2026-05-29 07:51 IDT **Completed**: 2026-05-29 07:52 IDT **Duration**: 1 minute

**Notes**:

* Added dialog drawer semantics, local boundary copy, prompt context, budget and remaining-token context, task summary, and empty-plan copy.
* Added status chips for plan state and each task state through `planContext` and `planTaskStatus`.
* Disabled approve and reject while a local decision is submitting and routed decisions through the guarded store action.

**Files Changed**:

* `apps/web/src/components/PlanWorkpad.tsx` - Added contextual, guarded plan decision UI.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded plan workpad evidence.

**Verification**:

* `npm --workspace apps/web run typecheck` - Passed.

**BQC Fixes**:

* Duplicate action prevention: Approve and reject are disabled after the first local click and the store rejects duplicate resolves.
* State freshness on re-entry: Local submitting state resets when a new plan id opens.
* Accessibility and platform compliance: Workpad now has dialog semantics and status labels.
* Error information boundaries: Prompt preview is bounded to the first 1000 characters.

***

### Task T017 - Route Leaderboard hero drilldown through workflow action

**Started**: 2026-05-29 07:52 IDT **Completed**: 2026-05-29 07:53 IDT **Duration**: 1 minute

**Notes**:

* Replaced direct hero selection with `openHeroDetail` for leaderboard row drilldowns.
* Expanded row button accessible labels with rank, hero, metric, and formatted value.
* Updated the existing leaderboard test to assert the shared opener path.

**Files Changed**:

* `apps/web/src/components/Leaderboard.tsx` - Routed drilldown through shared workflow action and improved row labels.
* `apps/web/tests/Leaderboard.test.tsx` - Updated deferred opener assertion.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded leaderboard evidence.

**Verification**:

* `npm test -- apps/web/tests/Leaderboard.test.tsx` - 1 file passed, 16 tests passed.

**BQC Fixes**:

* State freshness on re-entry: Leaderboard opens heroes through the shared action, clearing mismatched mission detail state when needed.
* Accessibility and platform compliance: Row labels now include rank and metric context.

***

### Task T018 - Document completed workflow behavior

**Started**: 2026-05-29 07:53 IDT **Completed**: 2026-05-29 07:54 IDT **Duration**: 1 minute

**Notes**:

* Documented shipped hero, mission, permission, plan, filter, timeline, and local decision behavior.
* Documented deferred boundaries for orchestration, inbound commands, War Room federation, hosted services, public replay hosting, and hosted analytics.

**Files Changed**:

* `apps/web/README_web.md` - Added completed workflow behavior and deferred boundary sections.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded documentation evidence.

**BQC Fixes**:

* N/A - documentation only.

***

### Task T019 - Write hero-to-mission workflow component tests

**Started**: 2026-05-29 07:54 IDT **Completed**: 2026-05-29 07:55 IDT **Duration**: 1 minute

**Notes**:

* Added component coverage for roster selection, selected-scope clearing, mission row handoff, selected hero synchronization, and hero-detail active mission handoff into mission detail.
* Reused shared workflow fixtures for deterministic hero and mission state.

**Files Changed**:

* `apps/web/tests/HeroMissionWorkflow.test.tsx` - Added 4 focused workflow component tests.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded workflow test evidence.

**Verification**:

* `npm test -- apps/web/tests/HeroMissionWorkflow.test.tsx` - 1 file passed, 4 tests passed.

**BQC Fixes**:

* Contract alignment: Tests assert mission opening synchronizes `selectedMissionId` and `selectedHeroId`.
* Accessibility and platform compliance: Tests assert roster cards expose `aria-pressed` and role-based button labels.

***

### Task T020 - Write PermissionModal component tests

**Started**: 2026-05-29 07:55 IDT **Completed**: 2026-05-29 07:56 IDT **Duration**: 1 minute

**Notes**:

* Added component coverage for permission dialog semantics, requester/action/boundary context, expiry state, expired disabled actions, Escape preserving the pending request, and duplicate approve prevention while submitting.

**Files Changed**:

* `apps/web/tests/PermissionModal.test.tsx` - Added 4 focused permission modal tests.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded permission test evidence.

**Verification**:

* `npm test -- apps/web/tests/PermissionModal.test.tsx` - 1 file passed, 4 tests passed.

**BQC Fixes**:

* Duplicate action prevention: Tests assert repeated approve clicks call the resolver once and leave the button disabled.
* State freshness on re-entry: Tests use fixed request ids and fake timers to verify expiry behavior deterministically.
* Accessibility and platform compliance: Tests assert dialog semantics and accessible dialog naming.

***

### Task T021 - Write PlanWorkpad component tests

**Started**: 2026-05-29 07:56 IDT **Completed**: 2026-05-29 07:57 IDT **Duration**: 1 minute

**Notes**:

* Added component coverage for plan drawer semantics, local boundary copy, budget context, task state hierarchy, empty plan copy, Escape preserving the pending plan, and duplicate approve prevention while submitting.

**Files Changed**:

* `apps/web/tests/PlanWorkpad.test.tsx` - Added 4 focused plan workpad tests.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded plan test evidence.

**Verification**:

* `npm test -- apps/web/tests/PlanWorkpad.test.tsx` - 1 file passed, 4 tests passed.

**BQC Fixes**:

* Duplicate action prevention: Tests assert repeated approve clicks call the resolver once and leave the button disabled.
* Accessibility and platform compliance: Tests assert dialog naming and budget/status context.

***

### Task T022 - Run final workflow quality gates

**Started**: 2026-05-29 07:57 IDT **Completed**: 2026-05-29 08:00 IDT **Duration**: 3 minutes

**Notes**:

* Ran the full web test suite, which includes the focused workflow tests, existing hero/mission tests, shell tests, replay tests, and all other web coverage.
* Ran the web typecheck after the full test suite.
* Ran ASCII validation on session-created spec, helper, fixture, focused test, and README artifacts; no non-ASCII output was found in those files.
* Ran `git diff --check` across session files; no whitespace errors were found.
* Validation rerun normalized the remaining reviewed legacy UI glyphs to ASCII in touched component files and affected tests.
* Manual smoke coverage was recorded through deterministic component and replay tests: seeded/no-server workflow state in `HeroMissionWorkflow.test.tsx`, empty mission and empty plan states, expired permission state, and existing replay link/persist/share tests in the full web suite.

**Files Changed**:

* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/tasks.md` - Marked final quality gate complete.
* `.spec_system/specs/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.md` - Recorded final verification evidence.

**Verification**:

* `npm test -- apps/web/tests` - 65 files passed, 1462 tests passed.
* `npm --workspace apps/web run typecheck` - Passed.
* `grep -nP '[^\x00-\x7F]' ...session-created-files... || true` - No output for session-created/spec/helper/focused-test/README artifacts.
* `git diff --check -- ...session-files...` - Passed.

**BQC Fixes**:

* Contract alignment: Final suite covers workflow helper, component workflows, permission/plan decision guards, replay behavior, and existing hero/mission surfaces.
* Failure path completeness: Final suite includes empty, expired, no-server, missing-context, and replay coverage.

***

### Validation rerun - legacy UI glyph normalization

**Started**: 2026-05-29 08:08 IDT **Completed**: 2026-05-29 08:12 IDT **Duration**: 4 minutes

**Notes**:

* Normalized the remaining reviewed legacy UI glyphs to ASCII in `HeroDetailDrawer`, `MissionLog`, `MissionTimeline`, and `Leaderboard`.
* Updated affected component tests for ASCII separators, fallback hyphens, and `x` counters.
* Confirmed the session deliverables now report as ASCII text with LF line endings.
* Reran the Apex analyze script from the bundled skill path because this checkout does not include `.spec_system/scripts/analyze-project.sh`.

**Files Changed**:

* `apps/web/src/components/HeroDetailDrawer.tsx` - Replaced non-ASCII separators, close label, fallback dashes, joiners, and counters.
* `apps/web/src/components/MissionLog.tsx` - Replaced the tag glyph with a CSS dot and ASCII row separator.
* `apps/web/src/components/MissionTimeline.tsx` - Replaced label separators and fallback dash copy.
* `apps/web/src/components/Leaderboard.tsx` - Replaced metadata and footer separators.
* `apps/web/tests/MissionTimeline.test.tsx` - Updated ASCII separator expectations.
* `apps/web/tests/MissionLogTags.test.tsx` - Updated ASCII clear-tags naming.
* `apps/web/tests/HeroDetailDrawerEfficiency.test.tsx` - Updated ASCII fallback expectation.
* `apps/web/tests/HeroDetailDrawerToolUsage.test.tsx` - Updated ASCII counter, separator, and fallback expectations.
* `apps/web/tests/HeroDetailDrawerComplexity.test.tsx` - Updated ASCII counter and separator expectations.

**Verification**:

* `bash /home/aiwithapex/.codex/skills/apex-spec/scripts/analyze-project.sh --json` - Current session resolved to `phase02-session03-hero-and-mission-workflow-completion`; package resolved from `spec.md` as `apps/web`.
* `npm test -- apps/web/tests/MissionTimeline.test.tsx apps/web/tests/MissionLogTags.test.tsx apps/web/tests/HeroDetailDrawerEfficiency.test.tsx apps/web/tests/HeroDetailDrawerToolUsage.test.tsx apps/web/tests/HeroDetailDrawerComplexity.test.tsx apps/web/tests/Leaderboard.test.tsx apps/web/tests/HeroMissionWorkflow.test.tsx` - 7 files passed, 116 tests passed.
* `npm --workspace apps/web run typecheck` - Passed.
* `npm test -- apps/web/tests` - 65 files passed, 1462 tests passed.
* `npm test` - 102 files passed, 1 skipped; 1800 tests passed, 1 skipped.
* `file ...reviewed-deliverables...` - All reviewed deliverables reported ASCII text or JavaScript source, ASCII text.
* `rg -n --pcre2 '[^\x00-\x7F]' ...reviewed-deliverables...` - No output.
* `grep -l $'\r' ...reviewed-deliverables...` - No output.

**BQC Fixes**:

* Contract alignment: Component tests now assert the ASCII UI copy that users see.
* Accessibility and platform compliance: The decorative mission tag mark is now a styled element instead of a glyph character.

***


---

# 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/phase02-session03-hero-and-mission-workflow-completion/implementation-notes.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.
