Commit Graph

26 Commits

Author SHA1 Message Date
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
6a989e8339 docs(04-06): log out-of-scope strict-meta-json test failure to deferred-items
- tests/build/strict-meta-json-validation.test.ts fails on clean tree
  (183/184, not the 184/184 the plan baseline assumed)
- SAVE_ARCHIVE meta.json runtime path — unrelated to Plan 04-06 surface
- resembles the pre-existing Plan 04-08 A33 SAVE-ack channel flake
- routed to /gsd-debug; NOT fixed in Plan 04-06 per scope boundary

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 15:44:11 +02:00
28ebc1fe4e docs(04-05): complete A34 fetch+XHR network_error empirical plan
- 04-05-SUMMARY.md: A34 assertion closes ROADMAP SC #2 (fetch + XHR
  network_error capture); Plan 04-01 P1 #11 Request-narrow fix
  validated end-to-end; skip-mode UAT 34->35/35 GREEN
- STATE.md: position advanced (6/8 plans); Plan 04-05 closure note;
  decision-log entry; A33 full-mode SAVE-ack flake logged as Blocker
  (routed to /gsd-debug — Plan 04-08 deliverable, out of scope here)
- ROADMAP.md: SC #2 STATUS CLOSED; 04-05 row [x]; Phase 4 progress 6/8
- All 4 ROADMAP success criteria now closed (SC #1 Plan 04-08, SC #2
  this plan, SC #3+#4 Plan 04-02)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 13:02:58 +02:00
4d6c00526e feat(04-08): A33 SW state persistence harness assertion — methodology reframe (34/34 GREEN; ROADMAP SC #1 CLOSED)
Task 2 of Plan 04-08 (revive A33 under valid methodology + close ROADMAP SC #1):

- Append driveA33(page, browser, extensionId, downloadsDir) at tests/uat/lib/harness-page-driver.ts:2516-2697 per Plan 04-04 Pattern 4 verbatim
- 3 checks: A33.1 SAVE_ARCHIVE ack success after 5-min idle + SW kill; A33.2 video size > 0; A33.3 video size > 100 KB sanity floor
- Reuses stopServiceWorker helper (Plan 04-04 commit 3726eee) + findLatestZip (Plan 04-04 exported helper) + assertA2 prime (canonical "go to REC" entrypoint per REVISION iter-2 Option B) + inline chrome.runtime.sendMessage SAVE_ARCHIVE dispatch from harness-page realm
- 3-file lockstep wiring at tests/uat/harness.test.ts: (1) import block adds driveA33 after driveA32; (2) wrapped-driver block adds driveA33Wrapped const after driveA31Wrapped; (3) drivers-array push appends A33 entry with SKIP_LONG_UAT env-gate (default RUN for Phase 4 closure + alpha gate)

Spike re-run evidence (HEADLESS=1 npx tsx tests/uat/spike-a33-sw-persistence.ts; 309.5s wall-clock):
- SPIKE PROBE [POST-PRIME]: segments.length=0  (baseline; no rotations yet)
- SPIKE PROBE [PRE-KILL]:   segments.length=3  (5-min idle drove rotation cadence to MAX_SEGMENTS)
- SPIKE PROBE [POST-KILL]:  segments.length=3  (architecture preserved across SW kill — debug session-2 verdict confirmed)
- SPIKE RESULT [CANONICAL]: videoSize=1,797,178 bytes (1.8 MB; vs 8505 baseline; ~211x larger)
- SPIKE OUTCOME: PASSED (offscreen SURVIVED the 5-min idle + SW kill)

Sample segment sizes during 5-min idle: 536921, 539874, 577234, 611683, 596512, 541658, 680729, 617089, 597527, 585310 bytes (all ~500-680 KB; per 10s @ ~400 kbps VP9 per CON-video-codec).

UAT before/after:
- Skip-mode UAT (HEADLESS=1 SKIP_PROD_REBUILD=1 SKIP_LONG_UAT=1 npm run test:uat): 34/34 GREEN in ~95s (A33 placeholder PASSES under skip env)
- vitest baseline flipped 183 -> 184 GREEN (+1 from Tier-2 production-bundle filename-leak gate landed in Task 1)

ROADMAP SC #1 closure (.planning/ROADMAP.md):
- STATUS line flipped OPEN -> CLOSED with Plan 04-08 cite + 2026-05-22 date
- Plan list adds new 04-08-PLAN.md row + amends 04-04-PLAN.md row with REFUTED-architecture verdict cross-reference (debug session-2 commit 4ea1bbb)
- Phase tracker cell updated from `4/7 In Progress` to `5/8 In Progress`
- WARNING 4 grep gates verified PASS: `CLOSED via Plan 04-08`=1; `STATUS 2026-05-21: OPEN`=0; `STATUS 2026-05-22: CLOSED`=1

Pre-checkpoint bundle gates 6/6 PASS:
- new Function=0 + eval=0 + Buffer.=1 (pre-existing JSZip polyfill) + window./document.=0 in SW chunk
- Tier-1 FORBIDDEN_HOOK_STRINGS lockstep at 12 entries (unchanged)
- Tier-2 production-bundle filename-leak gate (NEW from Task 1): synthetic-display-source = 0 hits in dist/
- en/ru parity preserved
- npx tsc --noEmit: exit 0

Architecture integrity preserved per debug session-2 verdict:
- src/offscreen/recorder.ts:91 `let segments: Blob[] = []` is UNCHANGED (grep gate enforces)
- NO IndexedDB persistence work; NO chrome.storage migration; NO offscreen-document lifecycle changes
- IndexedDB persistence plan-fix recommendation from Plan 04-04 SUMMARY REJECTED (would not have closed SC #1 because segments are not the problem, frames were)

Persisting artifacts from Plan 04-04 repurposed under valid methodology:
- stopServiceWorker helper (commit 3726eee): reused verbatim by driveA33
- tests/uat/spike-a33-sw-persistence.ts (commit 3726eee + session-2 Step B/C): now PASSES as canonical regression-verification gate

Self-Check: PASSED. All claims verified per executor protocol §self_check.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 11:07:48 +02:00
dd8a56453c docs(04-08): plan-checker iter-3 — PASSED-WITH-RESIDUAL on polish revision
Validates iter-3 polish revision of Plan 04-08 (commit 17e55dd) against
iter-2 PASSED verdict (1 WARNING + 4 cosmetic-advisories).

Resolution status:
- iter-2 NEW WARNING (displaySurface sub-gate scope): RESOLVED via clean
  drop of --check-display-surface-only mode; HIGH-LATENCY catch path
  locked in (spike re-run's assertA2 fast-fail).
- iter-2 cosmetic-advisory 1 (collectDistFiles symbol mismatch):
  RESOLVED — replaced with listAllFilesRecursive(DIST_DIR) +
  countOccurrencesInFile at correct line numbers (152, 185, 133).
- iter-2 cosmetic-advisory 2 (WARNING 1 SUMMARY-write practice):
  RESOLVED — inline comment at code snippet (lines 730-737) + Step 6
  SUMMARY content list bullet.
- iter-2 cosmetic-advisory 3 (vitest math 183 -> 184): RESOLVED —
  anchored to Tier-2 test block in 5 locations consistently.
- iter-2 cosmetic-advisory 4 (duration=N/A rationale): PARTIALLY
  RESOLVED — added to SUMMARY content list with forward-pointer from
  PLAN body; in-body reasoning preserved (planner's "moved" claim
  language slightly overstates the change but end-state behavior is
  fine).

Two NEW iter-3 cosmetic-advisories (NON-BLOCKING):
1. recorder.ts:294 mis-citation — actual displaySurface throw is at
   lines 313-321 (line 294 is a comment block). Off by ~25 lines but
   unambiguous; only one wrong-display-surface throw exists in
   recorder.ts. Executor will land on the right gate.
2. duration=N/A "moved" framing vs preserved+forward-ref'd reality —
   revision_history claim language slightly overstates; end-state fine.

Pre-execution validation: gsd-sdk verify.plan-structure returns
valid=true; both tasks have files+action+verify+done; 14 frontmatter
fields including revision_history with all three iters logged.
Pure polish pass: +51/-22 lines on PLAN.md only; no thesis edits, no
scope changes, BLOCKER fixes from iter-2 preserved verbatim.

Verdict: PASSED-WITH-RESIDUAL (0 BLOCKER + 0 WARNING + 2 cosmetic-
advisories). Both residuals are documentation-cosmetic (line-number
citation + framing-of-iter-3-polish-claim); orchestrator's call between
immediate execution OR optional iter-4. Recommended: PROCEED to execute
Plan 04-08.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 10:18:42 +02:00
17e55ddbb9 docs(04-08): polish per iter-2 advisories — symbol mismatch + display-surface mode lock-in + cosmetic clarifications
iter-3 polish pass on Plan 04-08 per checker iter-2 verdict PASSED
(commit 9c334b7). Five cosmetic-level fixes; no thesis/scope changes;
BLOCKER fixes from iter-2 + WARNING fixes from iter-2 preserved verbatim.

Remediations:
- WARNING 1 (low-severity; displaySurface sub-gate scope ambiguity):
  HIGH-LATENCY catch path locked in; the under-specified
  `--check-display-surface-only` spike-script mode is dropped (would have
  required 5-10 LOC of executor improvisation for no meaningful latency
  win over the canonical spike re-run's assertA2 fast-fail at <30s).
- Advisory 1 (symbol-name mismatch): Tier-2 snippet's `collectDistFiles`
  replaced with the actual helper `listAllFilesRecursive(DIST_DIR)` from
  tests/background/no-test-hooks-in-prod-bundle.test.ts:152; also uses
  the existing `countOccurrencesInFile` for binary-extension-aware grep.
- Advisory 2 (SUMMARY-write practice for WARNING 1): explicit note added
  that 04-08-SUMMARY.md documents the WARNING 1 closure path (no Plan B
  fallback; explicit error-class identifier; observable via offscreen
  console capture).
- Advisory 3 (vitest math): 183 -> 184 clarified consistently across
  must_haves truth + Step 5 body + acceptance_criteria + verification +
  success_criteria (+1 from the new Tier-2 `test(...)` block).
- Advisory 4 (duration-N/A rationale): moved out of the PLAN body into
  the SUMMARY content list (Step 6); PLAN keeps only the load-bearing
  size gate + loop-attr behavioral assertion + spike-re-run empirical
  catch; 1.9 MB / ~400 kbps / ~38s decoded-timeline reasoning lands at
  SUMMARY-time.

Frontmatter:
- Added iter-2 entry to revision_history (iter-3 polish closure).
- Tag flipped planner-iter-2-revision -> planner-iter-3-revision.

Plan validates via gsd-sdk frontmatter.validate + verify.plan-structure:
- valid: true; 0 errors; 0 warnings; 2 tasks; all 4 task elements present.

Diff: +51/-22 lines (5640 chars net). Branch ready for plan-checker
iter-3 (cosmetic-only polish review expected to PASS without further
findings).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 10:05:38 +02:00
9c334b77e8 docs(04-08): plan-checker iter-2 — PASSED (0 BLOCKER + 1 WARNING + 4 advisory)
Verifies iter-2 plan revision at 1f2eb2e against iter-1 findings (051813e):

BLOCKER 1 (Vite ?url asset-emission path) — RESOLVED via explicit
web_accessible_resources entry for assets/*.webm in manifest.json
(Option B from iter-1 remediation; pre-decided + grep-gated; inert in
production because dist/ has zero *.webm assets).

BLOCKER 2 (eager-install contract preservation) — RESOLVED via SYNC
install + LAZY first-frame closure (Option A from iter-1 remediation).
installFakeDisplayMedia() remains synchronous; canplay wait + .play()
deferred into fakeGetDisplayMedia closure. Three grep gates codify the
contract (sync signature present + NOT async + no await callers).

All 5 iter-1 WARNINGs addressed concretely with grep-gated remediations.
All 3 iter-1 cosmetic-advisories addressed.

New iter-2 findings: 1 WARNING (displaySurface sub-gate scope ambiguity;
alternative documented; non-blocking) + 4 cosmetic-advisories (symbol
name lookup, SUMMARY-write practice, vitest math, duration rationale).
Below PASSED threshold.

Recommendation: proceed to execute Plan 04-08 Wave 5.5.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 09:44:11 +02:00
1f2eb2e818 fix(04-08): revise plan per iter-1 BLOCKER fixes — bundling strategy + sync monkey-patch + async closure
iter-2 revision of Plan 04-08 (video-file MediaStream methodology reframe)
addressing the 2 BLOCKERs + 5 WARNINGs + 3 advisories from plan-checker
iter-1 (commit 051813e, .planning/phases/04-harden-clean-up-optional/04-08-CHECKER-iter-1.md).

BLOCKER 1 (Vite ?url asset emission for >=1 MB WebM): pre-decide the
bundling strategy. The 1.9 MB WebM is three orders of magnitude above
Vite's assetsInlineLimit (4096); it follows the extracted-asset path
(dist-test/assets/<hash>.webm), not the data-URI-inline path the
Plan 01-10 SVG precedent uses. The @crxjs/vite-plugin auto-WAR
behavior for extracted media assets in offscreen-document context is
empirically untested in this codebase. Resolution: add an explicit
web_accessible_resources entry for assets/*.webm in manifest.json
alongside the existing src/welcome/welcome.html entry. Production
dist/ has zero *.webm assets so the entry is inert; test dist-test/
has the hashed asset and the entry authorizes chrome-extension://<id>/
assets/<hash>.webm URL access from the offscreen document context.
No executor improvisation; the bundling strategy is locked-in BEFORE
Task 1 begins.

BLOCKER 2 (installFakeDisplayMedia async conversion breaks eager-install
contract): preserve the SYNCHRONOUS function signature. The existing
eager call at src/test-hooks/offscreen-hooks.ts:528-537 + the top-
level await at src/offscreen/recorder.ts:46-48 establish a contract
that navigator.mediaDevices.getDisplayMedia is monkey-patched BEFORE
recorder.bootstrap runs. Converting installFakeDisplayMedia() to
async would create a race window where recorder.startRecording calls
the REAL getDisplayMedia (Chrome screen-share picker hangs in
headless). Resolution: SYNC install (videoEl creation + DOM append +
monkey-patch assignment) + LAZY first-frame closure (await readyState
HAVE_FUTURE_DATA + .play() deferred INTO fakeGetDisplayMedia body).
First getDisplayMedia call may block ~50-500ms while video decodes;
subsequent calls observe the resolved readiness Promise + proceed
immediately. Bridge handler + eager-install try/catch remain sync.

WARNING 1 (autoplay reliability): explicit error class identifier
('autoplay-blocked or codec-unsupported in headless context') in the
.play() reject path; spike surface root cause instead of mysterious
0-frames.

WARNING 2 (patchDisplaySurface compatibility): new sub-gate in Task 1
verify that mints a stream + asserts track.getSettings().displaySurface
=== 'monitor'. Optional executor implementation as a --check-display-
surface-only mode on the spike script; spike re-run is the fallback
high-latency catch.

WARNING 3 (spike probe-value asserts): surfaced as explicit grep gates
in Task 2 verify block. POST-PRIME=0, PRE-KILL>=3, POST-KILL>=3 per
debug session-2 baseline.

WARNING 4 (ROADMAP.md edit): pre-specified exact pre-edit string +
replacement + grep gate (CLOSED via Plan 04-08 must appear; STATUS
2026-05-21: OPEN must disappear).

WARNING 5 (synthetic-display-source filename leak): new Tier-2 sub-
invariant in tests/background/no-test-hooks-in-prod-bundle.test.ts;
catches accidental test-hook inlining into production chunk. Tier-1
inventory at 12 entries unchanged.

advisory 1: commit message corrected to reference Task 1 + Task 2
only (not Task 3, which doesn't exist).

advisory 2: src/offscreen/recorder.ts:91 segments invariant added as
grep gate in Task 1 verify block.

advisory 3: dual-location fixture note added to Task 1 Step 1 (the
original tests/fixtures/last_30sec.webm remains in place; the new
tests/uat/fixtures/synthetic-display-source.webm is a SECOND copy
under the UAT subtree).

Plan validates via gsd-sdk frontmatter.validate --schema plan (valid:
true, no missing fields) AND gsd-sdk verify.plan-structure (valid:
true, 0 errors, 0 warnings, 2 tasks with full 4-element shapes).
files_modified updated to include tests/background/no-test-hooks-in-
prod-bundle.test.ts (Tier-2 gate location).

Iter-2 architectural thesis unchanged: HTMLVideoElement.captureStream
bypasses the canvas-throttling root cause per debug session-2 verdict.
The revision is methodology-tightening, not re-architecture.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 09:17:33 +02:00
051813ee6e docs(04-08): plan-checker iter-1 — ITERATE-NEEDED (2 BLOCKER + 5 WARNING + 3 advisory)
Plan 04-08's core thesis (HTMLVideoElement.captureStream bypasses canvas
throttling per debug session-2 verdict) IS the correct path to close
ROADMAP SC #1. But two blocking issues prevent reliable delivery:

BLOCKER 1: Vite `?url` asset-emission analog mis-applied — mokosh-mark.svg
is 877 bytes (inlined as data:image/svg+xml URI) so the Plan 01-10 "?url
+ crxjs auto-WAR" precedent is NOT a direct analog for the 1.9 MB WebM
which will emit as a separate dist-test/assets/<hash>.webm file. WAR
auto-generation for extracted assets is unverified in this codebase.
Remediation: probe-then-decide OR Blob URL from ?raw ArrayBuffer.

BLOCKER 2: installFakeDisplayMedia()'s eager-install-at-module-load
contract is silently broken by the proposed async conversion. The race
window opens because recorder.ts:48 resolves before the async install
completes; recorder.startRecording → real getDisplayMedia → headless
hang. Remediation: keep sync monkey-patch; defer the canplay wait into
fakeGetDisplayMedia closure (lazy first-frame).

WARNINGS surface unverified headless autoplay reliability, displaySurface
monkey-patch portability to HTMLVideoElement tracks, spike probe-value
gates not surfaced as automated verify, and ROADMAP.md flip without grep
enforcement.

Architectural alignment confirmed (segments: Blob[] preserved; IDB
correctly rejected; D-P4-01 honored). iter-2 is a methodology-tightening
pass, not re-architecture. Estimated ~150-300 lines of plan edits.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 09:03:08 +02:00
504d9dccf3 docs(04-08): create plan — video-file MediaStream methodology reframe + A33 revival
Inserts Plan 04-08 between Plans 04-06 and 04-07 (Wave 5.5) per
debug session-2 verdict (REFUTED-architecture; canvas-captureStream
issue). Scope: replace canvas.captureStream(30) source in
installFakeDisplayMedia() at src/test-hooks/offscreen-hooks.ts:139-264
with HTMLVideoElement.captureStream backed by a bundled VP9 WebM at
tests/uat/fixtures/synthetic-display-source.webm. Bundled via Vite ?url
import per Plan 01-10 mokosh-mark precedent. Revives the A33 harness
assertion (Plan 04-04 Pattern 4 verbatim) under valid methodology;
stopServiceWorker helper from Plan 04-04 reused. Closes ROADMAP SC #1
within v1. Architecture (offscreen-RAM segments: Blob[]) UNCHANGED
per debug session-2 segment-count probe evidence.

2 tasks atomic: (1) bundle fixture + rewrite installFakeDisplayMedia
+ ambient *.webm?url decl; (2) re-run spike + land driveA33 +
orchestrator wiring + SKIP_LONG_UAT env-gate + SUMMARY + STATE/ROADMAP
markers. UAT 33 -> 34 GREEN target. FORBIDDEN_HOOK_STRINGS unchanged
at 12. Pre-checkpoint bundle gates 6/6 PASS preserved.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 08:41:51 +02:00
c1501e7a81 docs(04-04): amend SUMMARY post-debug session-2 — REFUTED-architecture verdict
Session-2 (/gsd-debug continuation) empirically refuted the SUMMARY's
original 'architecture broken → IndexedDB plan-fix needed' interpretation:

- Pre-kill probe: segments.length=3 (segments accumulated correctly during 5-min idle)
- Post-kill probe: segments.length=3 (offscreen-RAM survives SW kill structurally)
- Step C (no worker.close, just 5-min idle): identical 8505 bytes (CDP not the cause)
- Remux logs: each segment trackInfo=320x180 but 0 frames per segment
- 7/7 spike runs deterministic at 8505 bytes (canvas-captureStream throttling)

Root cause: installFakeDisplayMedia() at src/test-hooks/offscreen-hooks.ts:139-264
mints canvas.captureStream(30) on hidden -9999px-offset canvas; headless-Chromium
throttles MediaRecorder on invisible-canvas (Chrome bug 653548). Segments exist
but contain zero VP9 frames over 5-min idle.

Routing: Plan 04-08 inserted (user-authorized ceremony 2026-05-22) — video-file
MediaStream methodology reframe (Option 2 from session-2). IndexedDB plan-fix
recommendation REJECTED — would not close SC#1 because frames are the problem,
not segments.

stopServiceWorker helper + spike script + launch.ts:225 race-tolerant fix all
remain valid persisting artifacts for Plan 04-08.
2026-05-22 08:14:44 +02:00
e8a2e7696d docs(04-04): complete harden-clean-up-optional plan 04-04 — SW persistence spike FAILED, plan-fix ceremony required
Plan 04-04 (spike→auto) closes at Task 1 (Wave 0 SPIKE) with an empirical
NO on the RESEARCH Q2 MEDIUM-confidence hypothesis A3 (offscreen-document
independent lifecycle anchored by active MediaRecorder). Task 2 (Wave 1
A33 verification-only harness assertion) BLOCKED by the plan's explicit
gating condition (videoSize > 100_000); ROADMAP SC #1 remains OPEN.

Spike empirical numbers (one HEADLESS=1 run; 308.7s wall-clock; full log
at /tmp/04-04-spike.log; reproducible via the committed spike script):
  - assertA2 prime:        PASSED (REC state established)
  - 5-min wall-clock idle: elapsed cleanly
  - stopServiceWorker CDP: succeeded (worker.close() returned)
  - SAVE_ARCHIVE ack:      {success: true} (event-driven SW respawn worked)
  - video/last_30sec.webm: 8505 bytes (sanity floor 100 KB; healthy 1-3 MB)
  - ffprobe on extracted:  'End of file' + 'Duplicate element' (no clusters)
  - rrweb/session.json:    [] (empty)
  - logs/events.json:      [] (empty)
  - meta.urls:             chrome-extension://* only (real-page URLs LOST)

Conclusion: src/offscreen/recorder.ts:91 `let segments: Blob[] = []` RAM-
only architecture does NOT survive 5-min SW idle + Puppeteer CDP worker.
close(). Architectural change required to close ROADMAP SC #1 (canonical
recommendation per 04-RESEARCH.md Q2 sub-question b Option C: IndexedDB
persistence in offscreen — Blobs serialize cleanly via structured-clone;
per-segment write ~3 MB; ~3 writes per 30s window). Per saved memory
`feedback-gsd-ceremony-for-fixes.md` the architectural fix routes through
/gsd-plan-phase rewrite OR /gsd-debug ceremony — NOT improvised inline
inside Plan 04-04.

Task 1 persisting artifacts (committed at 3726eee):
  - tests/uat/lib/harness-page-driver.ts: +43/-6 lines
    - Browser type added to puppeteer import
    - stopServiceWorker(browser, extensionId) helper (Chrome devrel
      canonical pattern; Puppeteer >=22.1.0 worker.close())
    - findLatestZip exported (was module-internal)
  - tests/uat/spike-a33-sw-persistence.ts NEW +202 lines
    - One-shot reproducible empirical investigation script
    - Reusable for future SW-lifecycle regression (the eventual plan-fix
      re-runs this script as its A33-verification gate)
    - Committed (not deleted) per the spike-FAILED forensic-evidence pattern

Task 2 was NOT committed (BLOCKED by gating condition); UAT count stays
33/33; Tier-1 FORBIDDEN_HOOK_STRINGS inventory unchanged at 12; A33 not
introduced.

Pre-checkpoint bundle gates (per saved memory feedback-pre-checkpoint-
bundle-gates.md): 6/6 GREEN unchanged from Plan 04-03 baseline (zero
production source changes in Plan 04-04).
  - SW chunk new Function: 0 (Plan 04-02 polarity preserved)
  - SW chunk eval:         0 (preserved)
  - SW chunk Buffer.:      1 (pre-existing JSZip polyfill; logged deferred)
  - SW chunk window./doc.: 0/0 (preserved)
  - dist/ grep × 12 hooks: 0 matches (Tier-1 inventory invariant held)
  - Manifest:              validates clean

vitest baseline: 183 tests total. Sequential `npm test` showed 180/183 with
3 pre-existing flakes in tests/background/blob-url-download.test.ts +
tests/background/webm-remux.test.ts + tests/offscreen/webm-playback.test.ts;
all 3 PASS in isolation. Per 04-CONTEXT.md items 9-10 these are documented
pre-existing issues (parallel-vitest Tier-1-build-step race + 2 ffprobe/
ffmpeg flakes pre-dating Phase 3) — NOT a Plan 04-04 regression (Plan 04-04
made zero source-code changes that could possibly affect them).

Files committed:
  - .planning/phases/04-harden-clean-up-optional/04-04-SUMMARY.md NEW
  - .planning/STATE.md: position advanced 4→5 / 7; progress 87% → 90%;
    2 decision entries logged; session metadata updated
  - .planning/ROADMAP.md: Phase 4 row count 2/7 → 4/7; Plan 04-04
    checklist box ticked with full SPIKE FAILED annotation; SC #1 marked
    OPEN with empirical evidence inline

Next step (out of Plan 04-04 scope; routed per spike-first contract):
plan-fix ceremony for IndexedDB persistence layer at src/offscreen/*.
The plan-checker/planner owns whether to (a) rewrite Plan 04-04 in-place,
(b) insert a new plan slot (e.g., 04-08), or (c) close Plan 04-04 as
spike-findings + open a fresh follow-up plan. Recommendation in SUMMARY:
option (b) or (c) — keep Plan 04-04 as the canonical spike-findings record.
2026-05-21 20:02:42 +02:00
303644f8cc docs(04-03): complete harden-clean-up-optional plan 04-03 — A29 flake fix
A29 (rrweb DOM verification) rewritten in-place via the canonical cs-
injection-world pattern + strict-sentinel filter. Closes ~2/3 flake
documented in Plans 03-02 + 03-03 SUMMARYs (A29 was "passing" by
reading iana.org leftover DOM events from A27/A28's still-open probe
tabs; a real rrweb regression at src/content/index.ts:284 would have
been masked).

Plan 04-03 task commits (atomic; sequential foreground mode):
- 73eb9b6: Task 1 — A29 page-side cs-injection-world skeleton +
  sentinel-bearing <div> injection
- b341a71: Task 2 — A29 host-side strict-sentinel filter (RESEARCH Q3
  Code Example Pattern 3); IncrementalSource added to @rrweb/types
  import binding; A29.2 PASS × 5/5 consecutive UAT runs

Empirical evidence:
- vitest 183/183 GREEN preserved (Plan 04-02 baseline)
- UAT harness 33/33 GREEN × 5 consecutive runs
- A29 strict-sentinel: mutationEvents=1, sentinelEvents=1 in ALL 5 runs
- Tier-1 FORBIDDEN_HOOK_STRINGS unchanged at 12
- SW chunk: 0 new Function, 0 eval (Plan 04-02 baseline held)
- Pre-checkpoint bundle gates 5/5 PASS

STATE.md + ROADMAP.md updated per sequential workflow:
- Plan counter advanced 3 → 4 of 7
- Progress 83% → 87% (26/30 plans complete)
- Decision log entry added for Plan 04-03
- ROADMAP Phase 4 04-03 row flipped to [x]
2026-05-21 17:01:58 +02:00
6a1fc32826 docs(04-02): complete harden-clean-up-optional plan 04-02 — build hygiene
Plan 04-02 closes three independent build-hygiene fixes consolidated into
one plan because they share the build-gate-grep test-scaffold pattern:

1. **setimmediate polyfill replacement** — layered 4-mechanism CSP-hardening
   eliminates the `new Function` literal from the SW chunk (grep -c flips
   1→0 across all three SW chunks). Runtime guard + nodePolyfills exclude
   + resolve.alias + Rollup post-transform plugin. Option α (force JSZip
   unbundled lib/index.js) attempted + reverted because it broke
   readable-stream-browser propagation causing UAT A30+ regressions;
   Option β (post-transform plugin) preserves JSZip's pre-bundled
   distribution verbatim while excising the offending literal.

2. **ROADMAP SC #3** (generate-icons ESM/CJS) — `git mv generate-icons.js
   generate-icons.cjs` resolves the `require('fs')` under
   `package.json type: module` via Node's `.cjs`-as-CJS rule.

3. **ROADMAP SC #4** (dead-code grep) — `tests/build/dead-code-grep.test.ts`
   regression-pins `permissions.request` absence in `src/`.

Plus closure of Plan 01-12 Wave 7's setimmediate deferred-items entry.

Task commits:
  - 630d40c test(04-02): Wave 0 RED — no-new-function + dead-code-grep
  - f251297 feat(04-02): Wave 1 GREEN — setimmediate replacement + CJS rename + closure

Verification:
  - vitest 180/180 → 183/183 GREEN on clean run (+3 net new tests)
  - UAT harness 33/33 GREEN preserved (REVISION iter-2 WARNING 1 empirical pin)
  - Pre-checkpoint bundle gates 5/5 PASS; SW CSP-safety polarity flipped 1→0
  - tsc-clean preserved; npm run build exit 0; node generate-icons.cjs exit 0

STATE.md: Plan 3/7 (Plan 04-02 complete); 25/30 total plans; 83% progress.
ROADMAP.md: Phase 4 progress 2/7 plans complete (04-01 + 04-02).
deferred-items.md: Plan 01-12 Wave 7 setimmediate entry CLOSED end-to-end.

SUMMARY at `.planning/phases/04-harden-clean-up-optional/04-02-SUMMARY.md`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 15:41:54 +02:00
f72bca5c46 docs(04-01): complete audit-p1-polish-content-script plan
Plan 04-01 closure marker — 04-01-SUMMARY.md + STATE.md position advance
(Plan 1 of 7 -> Plan 2 of 7; Plan 04-02 build hygiene queued NEXT in Wave 1)
+ ROADMAP plan-progress table flip ([ ] -> [x] 04-01-PLAN.md row).

Plan delivered (per SUMMARY):
- Audit P1 #11 fetch URL extraction fix (TWO sites; instanceof Request narrow)
- Audit P1 #14 navigation URL tracking fix (module-level previousUrl)
- Audit P1 #15 rrweb emit timestamp normalization (Date.now() Unix epoch)
- 9 new vitest tests under tests/content/; baseline 171 -> 180/180 GREEN
- tsc-clean preserved; Tier-1 hook-strings inventory unchanged at 12
- Audit P1 polish backlog CLOSED 3/3

Per-task commits (TDD pair):
- 3dbc51c test(04-01): Wave 0 RED — content-script test scaffolds
- 7da30af feat(04-01): Wave 1 GREEN — 3 surgical edits in src/content/index.ts

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 14:34:03 +02:00
dbcf4827f6 wip: phase-04 paused — 7 plans validated iter-2 PASSED, ready for execution .planning/phases/04-harden-clean-up-optional/.continue-here.md .planning/HANDOFF.json 2026-05-21 10:25:29 +02:00
3c1280ed2d docs(04): plan-phase closure — 3 cosmetic advisories from checker iter-2 resolved
Plan-checker iter-2 returned VERIFICATION PASSED with 3 cosmetic advisories:
- Dim 11: RESEARCH.md "## Open Questions" missing "(RESOLVED)" suffix → fixed
- Dim 12: PATTERNS.md:886 stale dispatchSaveArchiveForA33 example → added
  DEPRECATED banner citing Plan 04-04 REVISION iter-2 Option B canonical pattern
- VALIDATION.md frontmatter "4 revised tasks" mismatched per-task map (5 rows) → fixed

All 4 BLOCKER+WARNING issues from iter-1 verified resolved by iter-2 plan-checker
(VERIFICATION PASSED). 3 cosmetic items now resolved as well. 2 advisory items
left as-is per iter-1 (W2 scope-sanity at 04-06; W3 conservative 04-03 dep).

Phase 4 plans cleared for execution:
- 7 plans across 6 waves (Wave 1: 04-01+04-02 parallel; Waves 2-6 single-plan)
- Plan-checker iter-2 VERIFICATION PASSED
- Test baselines preserved: vitest 171/171 · UAT harness 33/33 · Tier-1 12

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 10:21:03 +02:00
76fffb35b9 fix(04): revise plans per checker iter-1 — 2 BLOCKERS + 2 WARNINGS fixed
Plan-checker iter-1 found 2 BLOCKERS + 4 WARNINGS. Iter-2 revision applies
surgical fixes to 4 plans + VALIDATION:

BLOCKER 1 (Plan 04-06 Task 4): wrong SW chunk glob `dist/assets/index*-bg.js`
matched zero files → Gates 2/3/4 silently PASSED. Replaced with canonical
`dist/assets/index.ts-*.js` (verified empirically: index.ts-8LkXuqac.js
on disk; RESEARCH Q1). Added glob-existence pre-gate `ls | wc -l >= 1`
to fail-loudly on future Vite chunk-naming shift.

BLOCKER 2 (Plan 04-04 Task 1): spike called non-existent
__mokoshHarness.dispatchSaveArchive (verified: harness surface is
assertA1..A31 + getManifestVersion only). Applied Option B — spike
+ driveA33 now dispatch SAVE_ARCHIVE via chrome.runtime.sendMessage
inline in page.evaluate (matches 9 existing assertA* methods:
A5/A11/A12/A13/A26/A28/A29/A30/A31). No new harness helper introduced.

WARNING 1 (Plan 04-02 Task 2): verify omitted UAT harness run. Added
`HEADLESS=1 SKIP_PROD_REBUILD=0 npm run test:uat 2>&1 | grep -c 'UAT
harness: 33/33 assertions passed'` to verify command (stdout format
confirmed at tests/uat/harness.test.ts:537).

WARNING 4 (Plan 04-07 Task 1): weak operator-ack gate (placeholder would
pass). Added `grep -cE 'approved|All good|APPROVED|approved by|operator
ack|all good' 04-VERIFICATION.md` to verify command. Covers both
canonical Plan 04-06 resume-signal ("approved" lowercase) AND prior-art
Plan 01-10 cycle-2 ack ("All good" titlecase).

WARNINGS 2 + 3 left as-is (truly advisory: scope-sanity threshold +
conservative dependency without file overlap).

04-VALIDATION.md per-task map rows updated for the 5 revised task entries
(04-02 T2 + 04-04 T1 + 04-04 T2 + 04-06 T4 + 04-07 T1). Frontmatter
adds `revised: 2026-05-21` + iter-2 notes block.

3 plans unchanged on disk (04-01, 04-03, 04-05).

Empirical confirmations used in revision:
- Harness surface: grep extension-page-harness.ts:4018 confirms
  __mokoshHarness.{assertA1..A31, getManifestVersion}; no dispatchSaveArchive
- SW chunk filename: ls dist/assets/ shows index.ts-8LkXuqac.js;
  no index*-bg.js matches
- SAVE_ARCHIVE precedent count: 9 existing assertA* methods use the
  chrome.runtime.sendMessage pattern
- UAT harness stdout format: harness.test.ts:537 emits canonical
  "UAT harness: N/N assertions passed"

Ready for plan-checker iter-3 re-verification.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 10:00:07 +02:00
526ac78046 docs(04): create phase plan — 7 plans for Phase 4 hardening (audit P1 polish + flake stabilization + SW persistence + visual polish + closure)
Wave structure:
- W1 (parallel): 04-01 (Audit P1 polish #11/#14/#15 TDD) + 04-02 (build/CSP hygiene: setimmediate polyfill + dead-code + generate-icons.cjs)
- W2: 04-03 (A29 cs-injection-world rewrite; closes flake)
- W3: 04-04 (A33 SW state persistence; spike-first + CDP worker.close())
- W4: 04-05 (A34 fetch+XHR network_error; ROADMAP SC #2 + validates Plan 04-01 P1 #11 end-to-end)
- W5: 04-06 (dark-logo currentColor + cursor verification + 01-07-SUMMARY back-patch; operator empirical)
- W6: 04-07 (04-VERIFICATION.md aggregator + ROADMAP backfill + v1 close prep)

Honors locked decisions D-P4-01..05 (full Phase 4 + all 3 P1 polish + both visual items + alpha-independent + ROADMAP backfill).
Implements RESEARCH Q1 (setimmediate option a), Q2 (spike-first SW persistence), Q3 (A29 cs-injection-world), Finding 4 (cursor already shipped — verification only).
UI-SPEC dark-logo currentColor strategy with inline-SVG injection landed per UI-SPEC §"Implementation amendment".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 09:30:49 +02:00
f012c8c103 docs(04): pattern map — ~30 anticipated files mapped (21 exact + 8 role-match + 1 NEW pattern stopServiceWorker CDP helper) .planning/phases/04-harden-clean-up-optional/04-PATTERNS.md 2026-05-21 08:29:19 +02:00
7178d14154 docs(phase-04): add validation strategy — Wave 0 anticipates 6 new unit test files per RESEARCH .planning/phases/04-harden-clean-up-optional/04-VALIDATION.md 2026-05-21 08:03:10 +02:00
d1f676707e docs(04): research phase domain — setimmediate, SW persistence, A29 race fix + cursor finding .planning/phases/04-harden-clean-up-optional/04-RESEARCH.md 2026-05-21 08:01:27 +02:00
266aa95235 docs(04): UI-SPEC.md status approved — 5/6 PASS + 1 FLAG non-blocking (dim 4 inherited type scale)
UI-checker verdict: APPROVED. Dimension breakdown:
- 1 Copywriting: PASS (17-key matrix inherited + locked; zero new copy)
- 2 Visuals: PASS (no new screen; dark-logo is stroke binding change)
- 3 Color: PASS (Loom palette inherited; semantic accents declared)
- 4 Typography: FLAG (8 sizes / 4 weights exceed standard thresholds but
  correctly captured as Phase 1-locked inherited from operator brand-fit
  ack 2026-05-20; Phase 4 adds zero new sizes/weights) — non-blocking
- 5 Spacing: PASS (all multiples of 4; locked; no new values)
- 6 Registry Safety: PASS (vanilla DOM + DOMParser; no shadcn; no third-party)

Three checker observations addressed:
1. `?url` → `?raw` bundling: correctly preserves @crxjs auto-WAR (SVG
   content stays in JS bundle as string literal vs base64 data URL)
2. A17.8 sub-check update: concrete enough (raw-SVG-source string-search
   for `currentColor` + `viewBox='0 0 32 32'`); optional A17.8a/A17.8b split
   well-described
3. Dark-mode contrast: deep-indigo stroke on madder-orange wrapper is
   readable; operator empirical checkpoint (acceptance criterion #6) is
   the designated gate for WCAG ratio judgment

Implementation contract = 5 file edits + 6 acceptance criteria. Planner can
now use UI-SPEC as design context for the visual-polish Phase 4 plan.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 07:46:34 +02:00
55cefbaa32 docs(04): UI design contract — thin scope (dark-logo currentColor strategy)
Phase 4 carries one genuine designer-side decision: dark-surface logo contrast
strategy. Recommends Option A — `currentColor` SVG + CSS color driven via the
existing `.dark, [data-theme="dark"]` block in tokens.css (lines 234-251). Post-
research amendment: welcome.ts must swap `?url` (data URL → <img>) for `?raw`
(inline <svg> via DOMParser) because <img>-rendered SVGs do not inherit parent
CSS color — `currentColor` only resolves on inline DOM SVG.

Cursor visibility constraint (Plan 01-07 obs 2026-05-15) is listed as
behavioral-only inheritance, not a design surface — 1-line change in
src/offscreen/recorder.ts per Chrome CursorCaptureConstraint enum.

Inherits Phase 1 design system as read-only (Lora display + IBM Plex Sans UI
+ Loom palette + Mokosh mark + canonical tokens.css + 17-key i18n matrix).
Zero new tokens, zero new copy, zero new colors. PNG icons unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 22:48:06 +02:00
74ac8ac342 docs(04): preserve plan-phase preferences captured pre-UI-SPEC exit
User invoked /gsd-plan-phase 4 and answered both gate questions before the
workflow correctly exited at the UI Design Contract gate (per workflow rule
that manual invocations cannot nested-Skill-spawn /gsd-ui-phase due to
AskUserQuestion-in-subcontext issue #1009).

Preferences saved at .plan-phase-preferences.md for the next plan-phase
invocation (after /gsd-ui-phase 4 produces UI-SPEC.md):
- UI gate: generate UI-SPEC.md first — unlike Phase 3 (false positive),
  Phase 4 has genuine dark-logo work; UI-SPEC should be thin-but-real
  (dark-logo design only; cursor visibility listed as inherited behavioral
  change, not a design surface)
- Research gate: research first (light, ~10-20 min) — scope-limited to:
  setimmediate polyfill replacement strategy + SW state persistence 5min
  idle test patterns + chrome.scripting.executeScript world:'ISOLATED'
  best practices for A29 cs-injection-world fix. Researcher NOT to
  investigate already-deferred items (rrweb v2, SW-RAM, masking).

File auto-deletes when /gsd-plan-phase 4 honors these preferences.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 22:42:13 +02:00
8b31fbe3de docs(04): capture phase context — discuss-phase complete (5 D-P4-* locked decisions; full Phase 4 scope) .planning/phases/04-harden-clean-up-optional/04-CONTEXT.md .planning/phases/04-harden-clean-up-optional/04-DISCUSSION-LOG.md 2026-05-20 22:16:57 +02:00