Files
mokosh/.planning/phases/04-harden-clean-up-optional/04-06-PLAN.md
Mark b59bd24354 docs(04-06): re-plan — correct false jsdom premise + stale back-patch lines + baseline
Full re-plan via /gsd-plan-phase ceremony. The prior 04-06-PLAN.md hit a
blocking checkpoint (plan-assumption defect). Three defects corrected;
thesis preserved (dark-logo currentColor Option A + cursor verification-only
+ A17.8 + operator-empirical Task 4).

DEFECT 1 — false jsdom premise: prior Task 1 assumed vitest configures a
jsdom environment. FALSE — vitest.config.ts:18 sets environment:'node' and
no DOM-emulation library is in node_modules. Resolution: STRATEGY (a) —
reframe tests/welcome/inline-svg.test.ts as a node-env source-contract test
(the canonical tests/i18n/manifest-i18n.test.ts file-read + string-assert
pattern); delegate live-DOM injection + currentColor cascade verification to
the A17.8 harness sub-check in real Chrome. Rejected (b) jsdom devDependency
(deviates from a twice-reaffirmed no-DOM-library stance) and (c) manual
DOMParser stub (fragile for SVG-namespace fidelity).

DEFECT 2 — stale back-patch line numbers: verified the genuine stale
'deferred to Phase 5' lines in 01-07-SUMMARY.md are 22/47/82/135/205;
historical commit-description lines 40/89/109/110 left unchanged.

DEFECT 3 — wrong vitest baseline: real baseline is 183 GREEN / 1 pre-existing
RED (strict-meta-json-validation.test.ts, logged to deferred-items.md, routed
to /gsd-debug). Test-count target reframed to 187 GREEN / 1 pre-existing RED.

revision_history block added. files_modified updated (welcome.css dropped —
the bare class selector matches <svg> identically; no CSS edit needed).
must_haves truths/artifacts/key_links updated to match the corrected plan.
frontmatter.validate + verify.plan-structure both green.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 16:22:04 +02:00

477 lines
51 KiB
Markdown

---
phase: 04
slug: harden-clean-up-optional
plan: 06
type: execute
wave: 5
depends_on:
- 01
- 02
- 03
- 04
- 05
files_modified:
- src/shared/brand/mokosh-mark.svg
- src/welcome/welcome.ts
- globals.d.ts
- tests/uat/extension-page-harness.ts
- tests/welcome/inline-svg.test.ts
- tests/build/cursor-visibility.test.ts
- .planning/phases/01-stabilize-video-pipeline/01-07-SUMMARY.md
autonomous: false
requirements: []
tags:
- visual-polish
- dark-logo-contrast
- ui-spec
- currentColor
- inline-svg
- cursor-visibility-verification
- charter-d-p4-03
- operator-empirical
user_setup: []
revision_history:
- revised: 2026-05-22
reason: "Full re-plan via /gsd-plan-phase ceremony. The prior 04-06-PLAN.md hit a blocking checkpoint (plan-assumption defect). Three defects corrected; thesis preserved (dark-logo currentColor Option A + cursor verification-only + A17.8 + operator-empirical Task 4)."
defects_resolved:
- id: "DEFECT 1 — false jsdom premise"
was: "Prior Task 1 stated 'vitest jsdom environment (vitest.config.ts already configures this; verify by grep environment.*jsdom vitest.config.ts)'. FALSE — vitest.config.ts line 18 sets environment:'node'; no DOM-emulation library (jsdom/happy-dom/linkedom/@happy-dom/global-registrator) is in node_modules; no vitest unit test has ever used DOMParser. The prior plan required tests/welcome/inline-svg.test.ts to exercise populateMark()'s live DOMParser + document.querySelector path inside a jsdom that does not exist."
now: "Test strategy decided — STRATEGY (a): reframe inline-svg.test.ts for node-env. The test reads src/shared/brand/mokosh-mark.svg + src/welcome/welcome.ts + globals.d.ts from disk (the canonical tests/i18n/manifest-i18n.test.ts file-read + string-assert pattern) and pins the SOURCE-LEVEL contract that populateMark's ?raw import + DOMParser injection depends on. Full live-DOM injection + currentColor CSS cascade verification is delegated to the A17.8 harness sub-check in real Chrome (Task 3). Rationale: the project DELIBERATELY ships no DOM library (UI-SPEC scope_kind:thin-design-surface; vitest.config.ts environment:'node' is a deliberate Plan 01-11 choice); two precedents (tests/background/toolbar-action.test.ts:279, tests/offscreen/display-surface-constraint.test.ts:41) explicitly 'manually stub' rather than install jsdom; CLAUDE.md mandates 'consistency with existing patterns > brevity'; feedback-trust-harness-over-manual-uat reserves real-browser behavior for the Puppeteer harness. Strategy (b) jsdom devDependency rejected — deviates from a twice-reaffirmed no-DOM-library stance to faithfully test what the harness already covers in real Chrome. Strategy (c) manual DOMParser stub rejected — the executor correctly assessed a faithful SVG-namespace + currentColor DOMParser stub as substantial + fragile; toolbar-action.test.ts only stubs simple element-getter surfaces, never DOMParser."
- id: "DEFECT 2 — stale back-patch line numbers"
was: "Prior Task 3 + PATTERNS.md cited 01-07-SUMMARY.md back-patch lines 47/82/109/135/205."
now: "Verified against the live file (grep 2026-05-22): the genuine stale 'deferred to Phase 5' framing — the cursor-visibility deferral that is FALSE because cursor:'always' actually shipped in Plan 01-09 — is at lines 22, 47, 82, 135, 205. Lines 40, 89, 109, 110 are historical descriptions of what the Plan 01-07-closure ROADMAP/STATE commits DID (they record commit content + the [Phase 01-07-deferred-to-5] decision-log tag) and are LEFT unchanged. Task 3 flips 22/47/82/135/205 only."
- id: "DEFECT 3 — wrong vitest baseline"
was: "Prior plan assumed a 184/184 GREEN vitest baseline and targeted '184 -> ~188 GREEN'."
now: "Verified real baseline: 183 passed / 1 failed (184 total). tests/build/strict-meta-json-validation.test.ts fails on a clean tree (getMetaOrFail line 491 — meta.json not parsed from the SAVE_ARCHIVE flow). This is a pre-existing red, NOT caused by Plan 04-06 (whose surface is SVG recolor + welcome.ts + globals.d.ts + A17.8 + docs); logged to .planning/phases/04-harden-clean-up-optional/deferred-items.md at commit 6a989e8 and routed to /gsd-debug separately (consolidates with the A33 SAVE-ack flake). The test-count target is reframed below as '+4 new tests on top of the 183-GREEN/1-pre-existing-RED baseline' = 187 GREEN / 1 pre-existing RED."
must_haves:
truths:
- "src/shared/brand/mokosh-mark.svg root <svg> element carries `stroke=\"currentColor\"` (was `stroke=\"#181b2a\"`); the 12 <line> + 1 <rect> children are unchanged"
- "src/welcome/welcome.ts imports the mark via `import markSvg from '../shared/brand/mokosh-mark.svg?raw';` (was `?url`); populateMark uses DOMParser to inject an inline <svg> into the slot (NOT <img>, NEVER innerHTML)"
- "Injected inline <svg> inherits color from the parent .welcome-hero__mark wrapper (color: var(--mks-fg-inverse)) so the stroke resolves via the CSS currentColor cascade — verified in real Chrome by the A17.8 harness sub-check"
- "globals.d.ts contains a `declare module '*.svg?raw'` ambient module declaration alongside the existing `*.svg?url` and `*.webm?url`"
- "tests/welcome/inline-svg.test.ts (node-env, source-level) pins the contract: mokosh-mark.svg source carries stroke='currentColor' + canonical viewBox; welcome.ts source uses the ?raw import + DOMParser + replaceChildren + aria attributes and does NOT use innerHTML; globals.d.ts carries the *.svg?raw ambient decl"
- "A17.8 harness sub-check updated to assert the welcome chunk JS bundles the raw SVG source (stroke='currentColor' + canonical viewBox) AND, in real Chrome, populateMark injects an inline <svg> whose stroke resolves to currentColor via parent CSS color"
- "Cursor visibility verified ALREADY SHIPPED at src/offscreen/recorder.ts:285 (`cursor: 'always'`) per RESEARCH Finding 4; tests/build/cursor-visibility.test.ts (node-env file-grep) regression-pins the literal"
- ".planning/phases/01-stabilize-video-pipeline/01-07-SUMMARY.md back-patched: the stale 'deferred to Phase 5' lines 22, 47, 82, 135, 205 flipped to 'shipped opportunistically Plan 01-09; verified Phase 4 Plan 04-06'; the historical commit-description lines 40, 89, 109, 110 left unchanged"
- "Operator empirical checkpoint: dark-mode visual aesthetic judgment on welcome-hero from dark + light Puppeteer screenshots (the ONE genuine operator-empirical case in Phase 4 per UI-SPEC §'Acceptance Criteria #6')"
- "PNG toolbar icons untouched (Chrome auto-inverts on dark toolbars; icons/icon{16,48,128}.png byte-identical)"
artifacts:
- path: "src/shared/brand/mokosh-mark.svg"
provides: "Single-attribute change on root <svg>: stroke='#181b2a' -> stroke='currentColor'. 13 child elements unchanged."
contains: "stroke=\"currentColor\""
- path: "src/welcome/welcome.ts"
provides: "?raw import + DOMParser-based inline SVG injection in populateMark (replaces <img> injection)"
contains: "mokosh-mark.svg?raw"
- path: "globals.d.ts"
provides: "Ambient module declaration for *.svg?raw imports (mirror of the existing *.svg?url block)"
contains: "*.svg?raw"
- path: "tests/welcome/inline-svg.test.ts"
provides: "Wave 0 RED -> GREEN — node-env source-level contract: SVG source recolor + welcome.ts ?raw/DOMParser/no-innerHTML + globals.d.ts ambient decl"
contains: "currentColor"
min_lines: 50
- path: "tests/build/cursor-visibility.test.ts"
provides: "Wave 0 GREEN-on-arrival — node-env file-grep defensive pin for src/offscreen/recorder.ts:285 cursor: 'always' literal"
contains: "cursor: 'always'"
min_lines: 15
- path: "tests/uat/extension-page-harness.ts"
provides: "A17.8 sub-check updated to assert raw SVG source bundling + inline <svg> injection in real Chrome (NOT data URL)"
contains: "A17.8"
- path: ".planning/phases/01-stabilize-video-pipeline/01-07-SUMMARY.md"
provides: "Surgical back-patch — stale 'deferred to Phase 5' lines 22/47/82/135/205 flipped; historical commit-description lines 40/89/109/110 left"
contains: "Phase 4 Plan 04-06"
key_links:
- from: "src/welcome/welcome.ts populateMark"
to: "src/shared/brand/mokosh-mark.svg?raw"
via: "Vite ?raw import returns SVG source as a string; DOMParser parses; replaceChildren injects"
pattern: "DOMParser"
- from: "Injected inline <svg> stroke='currentColor'"
to: ".welcome-hero__mark wrapper color: var(--mks-fg-inverse)"
via: "CSS color cascade (W3C SVG2 §13.3) — verified in real Chrome by A17.8"
pattern: "stroke=\"currentColor\""
- from: "tests/uat/extension-page-harness.ts A17.8"
to: "welcome chunk JS bundle string-grep + real-Chrome DOM query"
via: "post-build grep for raw SVG source + querySelector inline <svg> after populateMark"
pattern: "A17"
---
<objective>
Land the UI-SPEC dark-surface logo contrast strategy (Option A — `currentColor` SVG + CSS `color` via the existing `.dark` block in `src/shared/tokens.css`). Per the UI-SPEC §"Implementation amendment", this requires a 2-part technique:
1. **SVG attribute change:** `stroke="#181b2a"` to `stroke="currentColor"` on the root `<svg>` of `src/shared/brand/mokosh-mark.svg`.
2. **Inline-SVG injection in welcome.ts:** an `<img>`-rendered SVG runs in an isolated SVG document context where `currentColor` resolves to the SVG's own root color (defaults to `canvastext`, near-black). To get the desired CSS cascade, the SVG must be inlined into the welcome page's DOM. Switch the `import markUrl from '.../*.svg?url'` to `import markSvg from '.../*.svg?raw'` plus rewrite `populateMark` to use DOMParser + `replaceChildren`.
Two additional polish items co-land:
3. **Cursor visibility verification** (RESEARCH Finding 4): `cursor: 'always'` is ALREADY SHIPPED at `src/offscreen/recorder.ts:285` (Plan 01-09 opportunistically lifted the original Phase 5 deferral). Plan 04-06 confirms via a defensive grep test (`tests/build/cursor-visibility.test.ts`) and back-patches the stale "deferred to Phase 5" lines in `.planning/phases/01-stabilize-video-pipeline/01-07-SUMMARY.md`.
4. **Operator empirical checkpoint** (UI-SPEC Acceptance Criterion #6): the ONE Phase 4 genuine operator-empirical gate — dark-mode visual aesthetic judgment of the welcome hero. The harness covers `currentColor` resolution + inline-SVG injection automatically (Tasks 1-3); only the dark-OS aesthetic judgment is non-automatable. Per `feedback-trust-harness-over-manual-uat.md`, the operator judges from dark + light Puppeteer screenshots produced as the verification artifact, NOT a manual Chrome session.
Purpose: Closes the UI-SPEC dark-logo contrast strategy, RESEARCH Finding 4 cursor verification, the ROADMAP cursor visibility item, and the Plan 01-10 cycle-2 operator observation "also on dark surfaces probably either we need to place the logo on the light background or dunno".
Output: 3 source/test/spec file edits (SVG recolor + welcome.ts ?raw/DOMParser + globals.d.ts ambient decl) + 1 harness sub-check update (A17.8) + 2 new test files (`tests/welcome/inline-svg.test.ts` + `tests/build/cursor-visibility.test.ts`) + 1 docs back-patch + 1 operator empirical UAT cycle. The plan is `autonomous: false` because of the operator-empirical checkpoint (the ONLY autonomous: false plan in Phase 4).
**Test-strategy note (re-plan DEFECT 1 resolution):** `tests/welcome/inline-svg.test.ts` runs in vitest's `environment: 'node'` (the deliberate project default — `vitest.config.ts:18`). It pins the SOURCE-LEVEL contract — the SVG source carries `currentColor`, `populateMark` is rewritten correctly with a `?raw` import + DOMParser, and no `innerHTML` is used. It does NOT exercise `populateMark`'s live DOMParser + `document.querySelector` path, because the project deliberately ships no DOM-emulation library. Full live-DOM injection + `currentColor` CSS cascade verification is delegated to the **A17.8 harness sub-check (Task 3) in real Chrome** — the canonical home for real-browser behavior per `feedback-trust-harness-over-manual-uat.md`.
**Baseline note (re-plan DEFECT 3 resolution):** the vitest baseline is **183 passed / 1 failed (184 total)**. The 1 failure — `tests/build/strict-meta-json-validation.test.ts` — is a pre-existing red on a clean tree (NOT caused by this plan), logged to `deferred-items.md` and routed to `/gsd-debug` separately. Plan 04-06 adds 2 new test files (4 new tests: 3 in `inline-svg.test.ts` + 1 in `cursor-visibility.test.ts`). After this plan the expected state is **187 passed / 1 pre-existing fail (188 total)**. `strict-meta-json-validation.test.ts` is OUT OF SCOPE for Plan 04-06 — Task 2's vitest gate and Task 3's UAT gate explicitly tolerate that one pre-existing red and FAIL ONLY if a different test breaks.
</objective>
<execution_context>
@$HOME/.claude/get-shit-done/workflows/execute-plan.md
@$HOME/.claude/get-shit-done/templates/summary.md
</execution_context>
<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md
@.planning/phases/04-harden-clean-up-optional/04-CONTEXT.md
@.planning/phases/04-harden-clean-up-optional/04-RESEARCH.md
@.planning/phases/04-harden-clean-up-optional/04-PATTERNS.md
@.planning/phases/04-harden-clean-up-optional/04-UI-SPEC.md
@.planning/phases/04-harden-clean-up-optional/deferred-items.md
@.planning/phases/01-stabilize-video-pipeline/01-07-SUMMARY.md
# Source files — locus of the visual polish edits
@src/shared/brand/mokosh-mark.svg
@src/welcome/welcome.ts
@src/welcome/welcome.css
@globals.d.ts
@src/offscreen/recorder.ts
@tests/uat/extension-page-harness.ts
# Analog test scaffolds — node-env file-read + string-assertion (NO DOM library)
@tests/i18n/manifest-i18n.test.ts
@tests/build/no-remote-fonts.test.ts
@vitest.config.ts
<interfaces>
<!-- Key shapes the executor consumes directly. Extracted from codebase 2026-05-22. -->
PROJECT TEST ENVIRONMENT (re-plan DEFECT 1 — verified, NON-NEGOTIABLE):
- vitest.config.ts line 18 sets environment:'node'. There is NO jsdom / happy-dom / linkedom / @happy-dom/global-registrator in node_modules. No vitest unit test uses DOMParser. Do NOT grep for environment.*jsdom and do NOT assume a jsdom environment — there is none.
- When a vitest test needs DOM surfaces, the project pattern is to MANUALLY STUB the minimal surface touched (precedent: tests/background/toolbar-action.test.ts:279 "jsdom is not installed; instead we manually stub"; tests/offscreen/display-surface-constraint.test.ts:41). Those precedents stub only simple element-getter surfaces (getElementById / querySelector returning plain-object stubs) — they do NOT stub DOMParser.
- tests/welcome/inline-svg.test.ts therefore uses the file-read + string-assert pattern (precedent: tests/i18n/manifest-i18n.test.ts). It does NOT instantiate a DOM, does NOT call populateMark, does NOT use DOMParser at runtime.
Canonical node-env file-read + string-assert scaffold (from tests/i18n/manifest-i18n.test.ts:29-46):
- import { describe, expect, it } from 'vitest';
- import { existsSync, readFileSync } from 'node:fs';
- import { resolve as resolvePath } from 'node:path';
- const SOME_PATH = resolvePath(process.cwd(), 'relative/path');
- inside it(): const text = readFileSync(SOME_PATH, 'utf8'); expect(text).toContain('...');
From src/shared/brand/mokosh-mark.svg (current — root <svg> + 13 children; line 2 is the root element):
- root <svg> line 2: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="none" stroke="#181b2a" stroke-width="2.25" stroke-linecap="square" stroke-linejoin="miter">
- children: 1 <rect> + 12 <line> elements; they inherit stroke from the root.
After Plan 04-06 (1 attribute changed on the root <svg>; 13 children UNCHANGED):
- root <svg> line 2: stroke="#181b2a" becomes stroke="currentColor". Nothing else changes.
From src/welcome/welcome.ts:46 (current ?url import):
import markUrl from '../shared/brand/mokosh-mark.svg?url';
After Plan 04-06 (swap to ?raw):
import markSvg from '../shared/brand/mokosh-mark.svg?raw';
From src/welcome/welcome.ts:159-179 (current populateMark — <img> injection): builds an HTMLImageElement, sets img.src = markUrl, img.alt, img.width/height = 64, img.className = 'welcome-hero__mark-img', img.setAttribute('aria-hidden','true'), then slot.replaceChildren(img). Filter-pipeline form; empty-slot logger.warn fallback at the end.
After Plan 04-06 (DOMParser inline-SVG injection — the populateMark body becomes):
- const parser = new DOMParser();
- for each slot: const doc = parser.parseFromString(markSvg, 'image/svg+xml'); const svg = doc.documentElement;
- svg.classList.add('welcome-hero__mark-img'); svg.setAttribute('aria-hidden','true'); svg.setAttribute('role','img'); svg.setAttribute('aria-label', altText);
- slot.replaceChildren(svg);
- preserve the function signature, the slots query, altText = COPY['welcome.hero.mark.alt'] ?? 'Знак Mokosh', the filter-pipeline form, and the empty-slot logger.warn fallback.
NEVER use innerHTML — DOMParser + replaceChildren ONLY (MV3 CSP discipline; T-04-06-01 mitigation). The DOMParser parse is safe because the input is a Vite-bundled compile-time literal (no runtime untrusted input).
From globals.d.ts (current — *.svg?url block at lines 34-37; a *.webm?url block follows at 47-50):
declare module '*.svg?url' { const url: string; export default url; }
After Plan 04-06 (append a *.svg?raw block immediately after the *.svg?url block):
declare module '*.svg?raw' { const raw: string; export default raw; }
(with an explanatory comment block per project docstring convention; cite the UI-SPEC dark-logo strategy + Vite ?raw asset-as-string semantics).
From src/offscreen/recorder.ts:284-291 (verification target — ALREADY shipped; do NOT modify): the getDisplayMedia constraints object carries video: { displaySurface: 'monitor', cursor: 'always' }. The cursor: 'always' literal is at line 285.
From src/welcome/welcome.css:91-95 (existing rule — bare class selector matches both <img> and <svg>; NO change required): .welcome-hero__mark-img { width: 60%; height: 60%; display: block; }. welcome.css is NOT in files_modified — the bare class selector .welcome-hero__mark-img matches <svg class="welcome-hero__mark-img"> identically to <img class="welcome-hero__mark-img">. The inline <svg> inherits color: var(--mks-fg-inverse) from the .welcome-hero__mark wrapper automatically (CSS color is an inherited property). No CSS edit is needed; the prior plan's "optional welcome.css broadening" is dropped.
From tests/uat/extension-page-harness.ts:2249-2298 (current A17.8 — Plan 01-10 mark-bundling invariant): the A17 driver locates the welcome JS chunk via the parsed <script src>, fetches jsText, then computes hasInlineDataUrl = jsText.includes('data:image/svg+xml'), hasSvgFileUrl from a .svg-filename regex, and hasCanonicalViewBox from viewBox='0 0 32 32' / URL-percent-encoded variants. The A17.8 check is pushed via result.checks.push({ name: 'A17.8: ...', expected, actual, passed }). After Plan 04-06 the ?raw import inlines the SVG SOURCE as a string literal (no data URL): assert jsText contains the raw source signature stroke="currentColor" AND viewBox="0 0 32 32"; drop the data:image/svg+xml check.
SW chunk canonical glob (inherited from Phase 4 REVISION iter-2): the Vite SW chunk is dist/assets/index.ts-<hash>.js (verified empirically; pinned by RESEARCH Q1). All Phase 4 bundle gates use the dist/assets/index.ts-*.js glob, NOT dist/assets/index*-bg.js (which matches no files and would silently 0-grep). Task 4 pre-checkpoint gates use this canonical glob.
</interfaces>
</context>
<tasks>
<task type="auto" tdd="true">
<name>Task 1: Wave 0 RED — inline-SVG source-contract unit test + cursor-visibility defensive pin</name>
<files>tests/welcome/inline-svg.test.ts, tests/build/cursor-visibility.test.ts</files>
<read_first>tests/i18n/manifest-i18n.test.ts (node-env file-read + string-assert scaffold — THE canonical analog), tests/build/no-remote-fonts.test.ts (single-file grep scaffold), vitest.config.ts (CONFIRM environment:'node' at line 18 — there is NO jsdom), src/shared/brand/mokosh-mark.svg (current state — stroke='#181b2a'), src/welcome/welcome.ts (current state — ?url import + <img> populateMark), globals.d.ts (current state — no ?raw decl), .planning/phases/04-harden-clean-up-optional/04-PATTERNS.md sections "tests/welcome/inline-svg.test.ts" and "tests/build/cursor-visibility.test.ts"</read_first>
<behavior>
tests/welcome/inline-svg.test.ts — node-env, source-level, 3 tests in describe('UI-SPEC dark-logo currentColor strategy — source-level contract'):
- Test A (mokosh-mark.svg recolor): the SVG source contains stroke="currentColor" AND viewBox="0 0 32 32" AND does NOT contain stroke="#181b2a". RED today (SVG still has #181b2a).
- Test B (welcome.ts ?raw import + DOMParser injection): the welcome.ts source contains mokosh-mark.svg?raw AND DOMParser AND replaceChildren AND does NOT contain mokosh-mark.svg?url AND does NOT contain innerHTML. RED today (welcome.ts still uses ?url + <img>).
- Test C (globals.d.ts ambient decl): the globals.d.ts source contains the *.svg?raw ambient module declaration. RED today (only *.svg?url + *.webm?url declared).
tests/build/cursor-visibility.test.ts — node-env, 1 test: the src/offscreen/recorder.ts source contains cursor: 'always'. GREEN today (already shipped at recorder.ts:285).
</behavior>
<action>
1. Create the tests/welcome/ directory (NEW — mirrors src/welcome/ per the source-tree convention used by tests/background/, tests/i18n/).
2. Create tests/welcome/inline-svg.test.ts as a node-env source-contract test (NO DOM, NO runtime DOMParser, NO jsdom — this is the re-plan DEFECT 1 resolution). Mirror the tests/i18n/manifest-i18n.test.ts scaffold:
- import { describe, expect, it } from 'vitest';
- import { readFileSync } from 'node:fs'; and import { resolve as resolvePath } from 'node:path';
- Define path constants via resolvePath(process.cwd(), ...): MARK_SVG_PATH for src/shared/brand/mokosh-mark.svg, WELCOME_TS_PATH for src/welcome/welcome.ts, GLOBALS_DTS_PATH for globals.d.ts.
- describe('UI-SPEC dark-logo currentColor strategy — source-level contract', ...) with 3 it() blocks:
- Test A: read MARK_SVG_PATH; assert the text contains stroke="currentColor"; assert it contains viewBox="0 0 32 32"; assert it does NOT contain stroke="#181b2a".
- Test B: read WELCOME_TS_PATH; assert the text contains the substring mokosh-mark.svg?raw; assert it contains DOMParser; assert it contains replaceChildren; assert it does NOT contain mokosh-mark.svg?url; assert it does NOT contain innerHTML (the MV3-CSP discipline pin and the T-04-06-01 mitigation).
- Test C: read GLOBALS_DTS_PATH; assert the text contains the *.svg?raw ambient module declaration string.
- Add a header comment block (per the project docstring convention) explaining: this is a node-env source-contract test; live-DOM injection + currentColor cascade is delegated to the A17.8 harness sub-check in real Chrome; cite the re-plan DEFECT 1 resolution and the deliberate no-DOM-library project stance.
3. Create tests/build/cursor-visibility.test.ts per the PATTERNS.md cursor-visibility scaffold (node-env, single-it, file-grep):
- import { describe, expect, it } from 'vitest'; import { readFileSync } from 'node:fs'; import { resolve as resolvePath } from 'node:path';
- Define RECORDER_PATH via resolvePath(process.cwd(), 'src/offscreen/recorder.ts').
- describe('cursor visibility constraint shipped (Plan 01-09 -> verified Plan 04-06)', ...).
- One it() block: read RECORDER_PATH; assert the text contains the cursor: 'always' literal.
Filter-pipeline form where loops appear. Absolute imports per project rule. TypeScript-strict.
RED gate: run npm test against tests/welcome/ and tests/build/cursor-visibility.test.ts. inline-svg.test.ts shows 3 RED (SVG still #181b2a; welcome.ts still ?url/<img>; globals.d.ts has no ?raw decl). cursor-visibility.test.ts shows 1 GREEN (the literal already exists at recorder.ts:285).
</action>
<verify>
<automated>npm test -- tests/welcome/ tests/build/cursor-visibility.test.ts --run 2>&1 | tail -25</automated>
</verify>
<acceptance_criteria>
- File tests/welcome/inline-svg.test.ts exists with 3 it() blocks in a describe('UI-SPEC dark-logo currentColor strategy ...') block.
- File tests/build/cursor-visibility.test.ts exists with 1 it() block.
- Inline-SVG tests: 3 RED today (SVG still #181b2a; welcome.ts still ?url/<img>; globals.d.ts no ?raw).
- Cursor-visibility test: 1 GREEN today (regression pin for the already-shipped literal).
- grep -c 'currentColor' tests/welcome/inline-svg.test.ts returns at least 2.
- grep -c "cursor: 'always'" tests/build/cursor-visibility.test.ts returns at least 1.
- grep -c 'jsdom' tests/welcome/inline-svg.test.ts returns 0 (no jsdom dependency — DEFECT 1 resolution).
</acceptance_criteria>
<done>2 test files committed; 3 RED + 1 GREEN-on-arrival. Atomic commit: test(04-06): Wave 0 — inline-SVG source-contract RED + cursor-visibility regression pin.</done>
</task>
<task type="auto" tdd="true">
<name>Task 2: Wave 1 GREEN — SVG stroke recolor + welcome.ts ?raw import + populateMark inline injection + globals.d.ts ambient decl</name>
<files>src/shared/brand/mokosh-mark.svg, src/welcome/welcome.ts, globals.d.ts</files>
<read_first>src/shared/brand/mokosh-mark.svg, src/welcome/welcome.ts (full; ~199 lines), globals.d.ts (full; ~51 lines), .planning/phases/04-harden-clean-up-optional/04-UI-SPEC.md section "Implementation amendment", .planning/phases/04-harden-clean-up-optional/04-PATTERNS.md section "src/welcome/welcome.ts:46 + 159-179"</read_first>
<action>
Edit 1 — src/shared/brand/mokosh-mark.svg (1-attribute change on the root <svg>):
- Use the Edit tool to replace stroke="#181b2a" with stroke="currentColor" on the root <svg> element (line 2). The 12 <line> + 1 <rect> children inherit stroke from the root and are UNCHANGED — do not touch them.
- Verify: grep -c 'stroke="#181b2a"' src/shared/brand/mokosh-mark.svg returns 0 (was 1); grep -c 'stroke="currentColor"' src/shared/brand/mokosh-mark.svg returns 1.
Edit 2 — src/welcome/welcome.ts (?raw import + populateMark rewrite):
- Use the Edit tool to replace the line-46 import (import markUrl from '../shared/brand/mokosh-mark.svg?url';) with import markSvg from '../shared/brand/mokosh-mark.svg?raw';. Update the surrounding comment block (lines 36-45) to describe the ?raw strategy — cite the UI-SPEC implementation amendment and the currentColor cascade requirement (inline <svg> inherits parent CSS color; <img> does not) — instead of the ?url asset-URL strategy.
- Use the Edit tool to replace the populateMark function body (lines 159-179) with the DOMParser-based inline injection per the <interfaces> block. Preserve the function signature, the slots query, the altText resolution (COPY['welcome.hero.mark.alt'] ?? 'Знак Mokosh'), the filter-pipeline form, and the empty-slot logger.warn fallback. The new body parses markSvg via parser.parseFromString(markSvg, 'image/svg+xml'), takes doc.documentElement, applies classList.add('welcome-hero__mark-img') + setAttribute('aria-hidden','true') + setAttribute('role','img') + setAttribute('aria-label', altText), then slot.replaceChildren(svg).
- Update the populateMark docstring (lines 134-158) to describe inline-<svg> injection (was <img> injection). NEVER use innerHTML.
Edit 3 — globals.d.ts (append ambient decl):
- Use the Edit tool to APPEND the declare module '*.svg?raw' block immediately after the existing *.svg?url block (lines 34-37), with the explanatory comment per the <interfaces> block. The existing *.webm?url block (lines 47-50) is unrelated and stays.
Run gates:
- npx tsc --noEmit exits 0 (the ?raw ambient decl makes welcome.ts tsc-clean).
- npm test against tests/welcome/inline-svg.test.ts — Wave 0 RED flips to 3/3 GREEN.
- npm test against tests/build/cursor-visibility.test.ts — stays 1/1 GREEN.
- Full vitest (npm test --run). Expected: 187 passed / 1 failed (188 total). The 1 failure is the pre-existing tests/build/strict-meta-json-validation.test.ts red (re-plan DEFECT 3 — logged to deferred-items.md, routed to /gsd-debug, OUT OF SCOPE for Plan 04-06). Verify the failure set is EXACTLY {strict-meta-json-validation.test.ts}. If any OTHER test fails, Plan 04-06 caused a regression and must be fixed before commit.
- npm run build exits 0; verify the welcome chunk JS bundles the raw SVG source — at least one file under dist/assets/*.js contains the currentColor signature from the inlined SVG source.
</action>
<verify>
<automated>npx tsc --noEmit && npm test -- tests/welcome/inline-svg.test.ts tests/build/cursor-visibility.test.ts --run 2>&1 | tail -20</automated>
</verify>
<acceptance_criteria>
- npx tsc --noEmit exits 0.
- grep -c 'stroke="currentColor"' src/shared/brand/mokosh-mark.svg returns 1.
- grep -c 'stroke="#181b2a"' src/shared/brand/mokosh-mark.svg returns 0.
- grep -c 'svg?raw' src/welcome/welcome.ts returns at least 1.
- grep -c 'svg?url' src/welcome/welcome.ts returns 0 (the old import is gone).
- grep -c 'DOMParser' src/welcome/welcome.ts returns at least 1.
- grep -c 'innerHTML' src/welcome/welcome.ts returns 0 (MV3 CSP discipline; T-04-06-01).
- The *.svg?raw ambient module declaration is present in globals.d.ts.
- npm test against tests/welcome/inline-svg.test.ts exits 0 with 3/3 GREEN (was 3-RED).
- npm test against tests/build/cursor-visibility.test.ts exits 0 with 1/1 GREEN (preserved).
- Full vitest: 187 passed / 1 failed; the single failure is exactly tests/build/strict-meta-json-validation.test.ts (pre-existing; out of scope).
</acceptance_criteria>
<done>SVG + welcome.ts + globals.d.ts edits landed; inline-SVG tests flip 3-RED to 3-GREEN; only the pre-existing strict-meta-json red remains. Atomic commit: feat(04-06): Wave 1 — dark-logo currentColor strategy + inline-SVG injection.</done>
</task>
<task type="auto">
<name>Task 3: A17.8 harness sub-check update + 01-07-SUMMARY.md back-patch (corrected line set)</name>
<files>tests/uat/extension-page-harness.ts, .planning/phases/01-stabilize-video-pipeline/01-07-SUMMARY.md</files>
<read_first>tests/uat/extension-page-harness.ts:2244-2310 (existing A17.8 region — the A17 driver's Step 7 block), .planning/phases/01-stabilize-video-pipeline/01-07-SUMMARY.md (full; ~244 lines), .planning/phases/04-harden-clean-up-optional/04-PATTERNS.md section "tests/uat/extension-page-harness.ts A17.8 sub-check update" and section "01-07-SUMMARY.md back-patch"</read_first>
<action>
Edit 1 — A17.8 sub-check (tests/uat/extension-page-harness.ts, the A17 driver Step 7 block at lines 2249-2298):
- Read the existing A17.8 block.
- The ?raw import bundles the SVG SOURCE as a string literal into the welcome chunk (no more data:image/svg+xml data URL). Update the sub-check:
(a) Replace the hasInlineDataUrl computation (jsText.includes('data:image/svg+xml')) and the svgFileUrl regex with a raw-source check: assert jsText contains the canonical mark signature stroke="currentColor" AND viewBox="0 0 32 32" (the inlined raw SVG source). Keep the hasCanonicalViewBox check; it remains valid (the raw source carries the literal viewBox="0 0 32 32"). Update the diag() line and the result.checks.push({ name, expected, actual, passed }) object so the A17.8 name + expected describe the raw-source bundling.
(b) RECOMMENDED defense-in-depth (pick this unless the harness page cannot reach the welcome DOM in this driver): add an A17.8b check that, in the already-loaded welcome page DOM, document.querySelector('.welcome-hero__mark svg') is non-null AND that element's getAttribute('stroke') === 'currentColor' AND document.querySelector('.welcome-hero__mark img') is null. This is the real-Chrome verification of the inline-SVG injection + the currentColor attribute that the node-env unit test deliberately cannot cover (re-plan DEFECT 1 — the unit test pins source; the harness pins real DOM). If A17.8b is added, push it as a second result.checks entry; if the driver structure makes a second DOM query infeasible, document why in a code comment and ship A17.8a only — A17.8a alone still satisfies UI-SPEC Acceptance Criterion #3.
- Note the line range: A17.8 is at ~line 2294 — disjoint from the Plan 04-04/04-05 harness appends at ~line 3970+, which is what lets Plan 04-06 land parallel-safe.
Edit 2 — 01-07-SUMMARY.md back-patch (CORRECTED line set per re-plan DEFECT 2):
- Read .planning/phases/01-stabilize-video-pipeline/01-07-SUMMARY.md (full).
- Re-confirm the line set with: grep -nE 'Phase 5|deferred to Phase 5' .planning/phases/01-stabilize-video-pipeline/01-07-SUMMARY.md (the executor MUST verify the live file rather than trusting cited numbers).
- FLIP these 5 lines — the genuine stale "deferred to Phase 5" framing (cursor:'always' actually shipped opportunistically in Plan 01-09, so the deferral framing is false):
- Line 22 (the affects: dependency-graph entry: "Phase 5 (P1/P2 hardening) — new entry: getDisplayMedia cursor visibility constraint"). Flip to note the constraint shipped in Plan 01-09 and was verified in Phase 4 Plan 04-06.
- Line 47 (key-decisions: "Cursor visibility ... deferred to Phase 5, not back-patched into Phase 1 ..."). Flip to "Cursor visibility (cursor: 'always') was opportunistically shipped in Plan 01-09 at recorder.ts:285 and verified in Phase 4 Plan 04-06; the Phase 1 closure correctly did not back-patch it into Phase 1."
- Line 82 (accomplishments: "Cursor-visibility refinement deferred to Phase 5 ..."). Flip per the PATTERNS.md back-patch text: "Cursor-visibility refinement opportunistically shipped in Plan 01-09 (recorder.ts:285 cursor: 'always'); verified in Phase 4 Plan 04-06 via tests/build/cursor-visibility.test.ts + operator-empirical SAVE flow showing the pointer visible in last_30sec.webm."
- Line 135 (Decisions Made #5: "Cursor visibility refinement deferred to Phase 5 ..."). Flip the framing to reflect the Plan 01-09 opportunistic shipping while keeping the historical point that Phase 1 closure did not widen its own diff.
- Line 205 (User Setup Required: "The cursor visibility refinement (Phase 5) will, when activated, add a cursor: 'always' constraint ..."). Flip to past tense: the constraint was added in Plan 01-09; no user action was required; Phase 4 Plan 04-06 verified it.
- LEAVE these 4 lines UNCHANGED — they are historical descriptions of what specific Plan 01-07-closure commits DID, not forward-looking deferrals:
- Line 40 (key-files modified: describes the ROADMAP.md commit content "cursor-visibility refinement appended to Phase 5").
- Line 89 (Task Commits: describes the 7df72aa commit "Phase 5 cursor-visibility appended").
- Line 109 (Files Created/Modified: describes the ROADMAP.md modification "Phase 5 P1/P2 list appended ...").
- Line 110 (Files Created/Modified: describes the STATE.md modification, including the [Phase 01-07-deferred-to-5] decision-log tag — a historical commit record).
- Each flip is surgical (single line or single bullet, with surrounding context). Do NOT rewrite the whole SUMMARY. After the flips, the SUMMARY narrative is internally consistent: the 5 flipped lines acknowledge Plan 01-09 + Phase 4; the 4 historical lines still accurately describe what the Phase-1-closure commits recorded at the time.
Verify gates:
- npm run build:test exits 0.
- Run the UAT harness (HEADLESS=1 SKIP_PROD_REBUILD=0 SKIP_LONG_UAT=1 npm run test:uat). Expected: the full harness driver set GREEN with the updated A17.8. The dark-logo strategy land must not regress any other assertion. (npm run test:uat performs its own build:test internally; SKIP_PROD_REBUILD/SKIP_LONG_UAT are consumed inside the harness.)
- grep -c 'Phase 4 Plan 04-06' .planning/phases/01-stabilize-video-pipeline/01-07-SUMMARY.md returns at least 1 (the new back-patch citation appears in the flipped lines).
- The 5 flipped lines no longer carry "deferred to Phase 5" framing; the 4 historical lines still mention Phase 5 as a record of what the closure commits did — that is correct and expected.
</action>
<verify>
<automated>npm run build:test 2>&1 | tail -5 && HEADLESS=1 SKIP_PROD_REBUILD=1 SKIP_LONG_UAT=1 npm run test:uat 2>&1 | tail -15</automated>
</verify>
<acceptance_criteria>
- npm run build:test exits 0.
- The UAT harness driver set is GREEN with the updated A17.8 (no harness regression from the dark-logo land).
- grep -c 'stroke="currentColor"' tests/uat/extension-page-harness.ts returns at least 1 (the new A17.8 raw-source grep target).
- The data:image/svg+xml grep target is removed from the A17.8 block (the ?raw import no longer produces a data URL).
- 01-07-SUMMARY.md lines 22, 47, 82, 135, 205 no longer carry the stale "deferred to Phase 5" framing.
- 01-07-SUMMARY.md lines 40, 89, 109, 110 are unchanged (historical commit-description lines).
- grep -c 'Phase 4 Plan 04-06' .planning/phases/01-stabilize-video-pipeline/01-07-SUMMARY.md returns at least 1.
</acceptance_criteria>
<done>A17.8 updated to assert raw-source bundling (+ optional real-Chrome A17.8b); 01-07-SUMMARY.md back-patched with the corrected 22/47/82/135/205 line set. Atomic commit: feat(04-06): A17.8 inline-SVG check + back-patch 01-07-SUMMARY stale Phase-5 lines.</done>
</task>
<task type="checkpoint:human-verify" gate="blocking">
<name>Task 4: Operator empirical UAT — dark-mode aesthetic judgment on welcome hero (from screenshots)</name>
<files>(no source files modified — verification-only checkpoint; gates against the existing dist/ + Puppeteer screenshots)</files>
<action>
Step 1 — Pre-checkpoint bundle gates (orchestrator-driven; per saved memory feedback-pre-checkpoint-bundle-gates.md; ALL MUST PASS before surfacing Step 3 to the operator):
Glob-existence pre-gate (run FIRST — guards against silent 0-hit passes on a mis-glob): ls dist/assets/index.ts-*.js must list at least one file. If 0, the build is broken (SW chunk missing) OR the canonical filename pattern shifted — fail loudly rather than 0-grep silently.
1. npm run build exits 0; dist/ populated.
2. SW CSP-safety grep (canonical SW chunk glob): grep for new Function( and eval( in dist/assets/index.ts-*.js returns 0 hits (Plan 04-02 effect preserved).
3. SW Node-globals grep (canonical SW chunk glob): grep for Buffer.from / Buffer.alloc / process. / require( in dist/assets/index.ts-*.js returns 0 hits.
4. DOM-globals grep (canonical SW chunk glob): grep for window. / document. in dist/assets/index.ts-*.js, excluding comment lines and globalThis idioms, returns 0 hits.
5. Tier-1 SW-bundle-import gate: vitest run tests/background/sw-bundle-import.test.ts is GREEN.
6. Tier-1 FORBIDDEN_HOOK_STRINGS gate: vitest run tests/background/no-test-hooks-in-prod-bundle.test.ts is GREEN (12 strings, 0 hits each — Plan 04-06 adds no new __MOKOSH_UAT__-gated symbols, so the inventory stays at 12).
Also confirm the vitest baseline: full vitest is 187 passed / 1 failed, where the single failure is exactly tests/build/strict-meta-json-validation.test.ts (pre-existing; re-plan DEFECT 3; out of scope). And the UAT harness driver set is GREEN.
Step 2 — Produce the verification artifact (light + dark Puppeteer screenshots; per feedback-trust-harness-over-manual-uat.md the operator judges from screenshots, NOT a manual Chrome session):
- Load dist/ as an unpacked extension and open the welcome page in a Puppeteer-driven Chrome.
- Capture a LIGHT-surface screenshot of the welcome hero (default OS appearance — the regression-baseline shot).
- Capture a DARK-surface screenshot of the welcome hero. Force dark via Puppeteer's emulateMediaFeatures([{ name: 'prefers-color-scheme', value: 'dark' }]) (or the equivalent CDP Emulation.setEmulatedMedia) so the .dark / [data-theme="dark"] token overrides in src/shared/tokens.css lines 234-251 apply, then re-screenshot the welcome hero.
- Save both screenshots to a stable path (e.g. /tmp/04-06-welcome-hero-light.png and /tmp/04-06-welcome-hero-dark.png) and surface both paths to the operator in the checkpoint message.
Step 3 — Operator-driven empirical judgment: see the <how-to-verify> block below.
Step 4 — Resume signal handling: the orchestrator waits for the operator response per the <resume-signal> block below.
</action>
<verify>
<automated>npm run build 2>&1 | tail -3 && ls dist/assets/index.ts-*.js</automated>
</verify>
<what-built>
UI-SPEC dark-logo contrast strategy: SVG stroke recolor (stroke="currentColor") + inline-SVG injection in welcome.ts (DOMParser + replaceChildren; no <img>, no innerHTML, no eval) + globals.d.ts *.svg?raw ambient decl + A17.8 harness raw-source assertion + cursor-visibility node-env regression pin + 01-07-SUMMARY.md back-patch (5 stale Phase-5 lines flipped). Pre-checkpoint bundle gates 6/6 PASS:
- Gate 1: npm run build exit 0.
- Gate 2: new Function / eval count in dist/assets/index.ts-*.js returns 0 (Plan 04-02 effect preserved; canonical SW chunk glob).
- Gate 3: SW Node-globals grep clean against dist/assets/index.ts-*.js.
- Gate 4: DOM-globals grep clean against dist/assets/index.ts-*.js.
- Gate 5: Tier-1 SW-bundle-import unit gate GREEN.
- Gate 6: FORBIDDEN_HOOK_STRINGS at 12 (no change — Plan 04-06 adds no test-mode symbols).
- Glob-existence pre-gate: ls dist/assets/index.ts-*.js lists at least one file (prevents silent 0-hit pass on a mis-glob).
- Plus: vitest 187 passed / 1 pre-existing fail (strict-meta-json-validation.test.ts, out of scope); UAT harness driver set GREEN.
Auto-confirmed (no operator action needed):
- mokosh-mark.svg now uses stroke="currentColor" (1-attribute semantic change; 13 children unchanged).
- welcome.ts inline-injects the SVG via DOMParser + replaceChildren (no <img>, no innerHTML, no eval).
- On the LIGHT surface the mark appears identical to the Plan 01-10 cycle-2 ack — color: var(--mks-fg-inverse) at .welcome-hero__mark cascades to the inline SVG's currentColor, resolving to linen-50 (off-white) stroke on the madder-orange wrapper background.
- PNG toolbar icons unchanged (Chrome auto-inverts dark icons on dark toolbars).
- cursor: 'always' already at recorder.ts:285 (Plan 01-09 opportunistic); pinned by tests/build/cursor-visibility.test.ts.
</what-built>
<how-to-verify>
The orchestrator has produced two screenshots of the welcome hero:
- /tmp/04-06-welcome-hero-light.png — LIGHT surface (default OS appearance).
- /tmp/04-06-welcome-hero-dark.png — DARK surface (prefers-color-scheme: dark emulated).
1. Open /tmp/04-06-welcome-hero-light.png. LIGHT-surface regression check: the welcome hero mark renders inside the madder-600 circle with a linen-50 (off-white) stroke — visually identical to the Plan 01-10 cycle-2 operator ack 2026-05-20 "All good". Expected appearance unchanged.
2. Open /tmp/04-06-welcome-hero-dark.png. DARK-surface aesthetic judgment (the operator-empirical decision): on dark mode the .dark token block in src/shared/tokens.css lines 234-251 overrides --mks-fg-inverse to --mks-ink-900 (deep indigo); the wrapper background stays madder; the inline SVG's currentColor therefore resolves to deep indigo.
3. Judge the visual contrast: does the mark remain legible and aesthetically acceptable on the dark surface? The strategy aims to keep the mark crisp on EITHER a light or a dark surface by inverting the stroke when the surface flips.
4. (Optional, only if you want to also exercise the cursor path) Load dist/ as an unpacked extension, start a recording, click around, SAVE, then open video/last_30sec.webm and confirm the operator cursor is visible in playback (the cursor: 'always' verification for the ROADMAP cursor visibility item — this is already pinned automatically by tests/build/cursor-visibility.test.ts, so it is optional here).
Resume signals:
- "approved" — the dark-mode aesthetic is acceptable; the Phase 4 dark-logo strategy is closed.
- Otherwise describe the issue specifically (e.g. "stroke too thin on dark; needs heavier stroke-width", or "wrapper madder clashes with the dark BG; want a different accent"). Plan execution routes the issue via /gsd-debug per feedback-gsd-ceremony-for-fixes.md — no hot-edits to the UI-SPEC or the canonical design system.
</how-to-verify>
<resume-signal>Type "approved" or describe the issue (e.g. "stroke too thin", "need heavier weight on dark", "want a different accent").</resume-signal>
<done>Operator returns "approved" verbatim OR describes a specific issue; if an issue, route via /gsd-debug per feedback-gsd-ceremony-for-fixes.md.</done>
</task>
</tasks>
<threat_model>
## Trust Boundaries
| Boundary | Description |
|----------|-------------|
| Vite ?raw import to compile-time string literal | SVG source is bundled as a compile-time string; NO runtime untrusted input flows into DOMParser; the parser input is statically known at build time |
| DOMParser parse to live DOM | parseFromString('image/svg+xml') is a CSP-safe operation per MDN — it does NOT execute scripts in the parsed SVG and runs in a sandboxed parser context; no innerHTML; no eval |
| Inline <svg> CSS color inheritance | inline SVG (parsed + appended via DOMParser + replaceChildren) inherits parent CSS color per W3C SVG2 §13.3; currentColor on stroke resolves to the wrapper's color: var(--mks-fg-inverse) cascade |
## STRIDE Threat Register
| Threat ID | Category | Component | Disposition | Mitigation Plan |
|-----------|----------|-----------|-------------|-----------------|
| T-04-06-01 | Tampering | a future developer might switch DOMParser to innerHTML for "simplicity" — innerHTML in an extension-page context is unsafe (CSP risk + script-execution surface) | mitigate | Inline code comment in populateMark + the executor instruction "NEVER use innerHTML — DOMParser + replaceChildren only (MV3 CSP discipline)"; tests/welcome/inline-svg.test.ts Test B asserts the welcome.ts source does NOT contain innerHTML; the A17.8 harness check verifies the inline-SVG DOM shape in real Chrome (defense in depth) |
| T-04-06-02 | Information Disclosure | the inline SVG carries no PII or secret — it is the canonical Mokosh brand mark | accept | Static brand asset; out-of-tree threat surface |
| T-04-06-03 | Spoofing | cursor visibility in captured frames could leak transient UI overlay state (e.g. a 2FA OTP digit the operator was about to type) — but this is a known and intended diagnostic feature per the Plan 01-07 observation; password masking is out of scope per the D-P3-02 charter | accept | Operator-side responsibility per the CONTEXT charter; v2 candidate per CONTEXT Deferred Ideas |
| T-04-06-04 | Repudiation | a mis-globbed dist/assets/index*-bg.js matches no files; grep -c new Function returns 0; Gate 2 spuriously PASSES even if a CSP regression slipped in | mitigate | Canonical SW chunk glob dist/assets/index.ts-*.js (verified empirically; pinned by RESEARCH Q1); the Task 4 glob-existence pre-gate (ls dist/assets/index.ts-*.js lists at least one file) runs BEFORE the grep gates and fails loudly if the glob matches nothing |
| T-04-06-SC | Tampering | npm/pip/cargo installs introducing a supply-chain risk | accept | Plan 04-06 introduces NO new package-manager installs — files_modified contains only existing source/test/spec/docs files; no devDependency is added (the DEFECT 1 resolution explicitly rejected adding jsdom). Package legitimacy gate is therefore not triggered. |
</threat_model>
<verification>
- npx tsc --noEmit exits 0.
- npm run build exits 0.
- Full vitest: 187 passed / 1 failed (188 total); the single failure is exactly tests/build/strict-meta-json-validation.test.ts (pre-existing; re-plan DEFECT 3; out of scope, routed to /gsd-debug). +4 new tests over the 183-GREEN baseline (Task 1's 3 RED inline-svg tests flip GREEN in Task 2; Task 1's 1 cursor-visibility test is GREEN throughout).
- grep -c 'stroke="currentColor"' src/shared/brand/mokosh-mark.svg returns 1.
- grep -c 'svg?raw' src/welcome/welcome.ts returns at least 1; grep -c 'svg?url' src/welcome/welcome.ts returns 0.
- grep -c 'innerHTML' src/welcome/welcome.ts returns 0.
- The *.svg?raw ambient module declaration is present in globals.d.ts.
- UAT harness driver set GREEN with the updated A17.8 (assertion quality changes; driver count unchanged).
- 01-07-SUMMARY.md back-patched: lines 22/47/82/135/205 flipped; lines 40/89/109/110 unchanged.
- Operator empirical ack received (Task 4 resume signal "approved") from the dark + light screenshot artifact.
- Pre-checkpoint bundle gates 6/6 PASS (canonical SW chunk glob dist/assets/index.ts-*.js across Gates 2/3/4; glob-existence pre-gate validates the glob first).
- PNG toolbar icons byte-identical (no change to scripts/rasterize-icons.sh or icons/*.png).
</verification>
<success_criteria>
- UI-SPEC dark-logo strategy landed end-to-end (Tasks 1-3 automation + Task 4 operator ack).
- Cursor visibility VERIFIED at recorder.ts:285 via the node-env regression-pin test + the 01-07-SUMMARY back-patch (RESEARCH Finding 4 closure).
- Inline-SVG injection contract pinned by 3 node-env source-level unit tests (DEFECT 1 strategy) + the A17.8 real-Chrome harness assertion.
- ROADMAP cursor visibility item GREEN.
- ROADMAP dark-surface logo contrast item GREEN.
- Operator empirical ack received on the dark-mode visual aesthetic, judged from the Puppeteer screenshot artifact.
- Pre-checkpoint bundle gates 6/6 PASS preserved (canonical glob).
- UAT harness driver set GREEN preserved.
- Vitest: 187 GREEN / 1 pre-existing RED (strict-meta-json-validation.test.ts is out of scope and explicitly tolerated).
</success_criteria>
<output>
After completion, create .planning/phases/04-harden-clean-up-optional/04-06-SUMMARY.md capturing:
- mokosh-mark.svg diff (1-attribute change documented).
- welcome.ts diff (?raw import + DOMParser + populateMark rewrite).
- globals.d.ts diff (*.svg?raw ambient decl append).
- A17.8 harness sub-check diff (old data-URL grep to new raw-source grep; note whether A17.8b real-Chrome DOM check was added).
- 01-07-SUMMARY.md back-patch (5 stale Phase-5 lines flipped — 22/47/82/135/205; 4 historical lines left — 40/89/109/110).
- 2 new test files (inline-svg source-contract + cursor-visibility) with the RED-to-GREEN cycle commits.
- The DEFECT 1 test-strategy decision recorded (node-env source-contract, no jsdom) so future plans understand why inline-svg.test.ts does not exercise live DOM.
- Operator empirical UAT verbatim ack (e.g. "approved", or the specific issue raised).
- Pre-checkpoint bundle gates 6/6 PASS evidence (grep outputs against the canonical dist/assets/index.ts-*.js glob).
- vitest before/after (183 GREEN + 1 pre-existing RED to 187 GREEN + 1 pre-existing RED).
- UAT harness driver-set GREEN preservation.
- Note that tests/build/strict-meta-json-validation.test.ts remains a pre-existing RED out of Plan 04-06 scope (routed to /gsd-debug per deferred-items.md).
- Commit refs (Tasks 1 + 2 + 3 + 4 ack).
</output>