Mark
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.