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.
This commit is contained in:
@@ -4,14 +4,14 @@ milestone: v2.0.0
|
||||
milestone_name: milestone
|
||||
status: executing
|
||||
stopped_at: Completed 04-02-PLAN.md (setimmediate polyfill replaced via layered 4-mechanism mitigation; SW new Function polarity 1→0; UAT 33/33 GREEN preserved)
|
||||
last_updated: "2026-05-21T14:56:45.914Z"
|
||||
last_updated: "2026-05-21T17:24:14.969Z"
|
||||
last_activity: 2026-05-21
|
||||
progress:
|
||||
total_phases: 4
|
||||
completed_phases: 3
|
||||
total_plans: 30
|
||||
completed_plans: 26
|
||||
percent: 87
|
||||
completed_plans: 27
|
||||
percent: 90
|
||||
---
|
||||
|
||||
# Project State
|
||||
@@ -29,11 +29,11 @@ no server, no password leaks.
|
||||
|
||||
Phase: 04 (harden-clean-up-optional) — EXECUTING
|
||||
Phase 4 of 4 (Hardening — optional) — Plan 04-01 closed (audit P1 polish 3/3); 6 plans remain (04-02 build hygiene queued NEXT in Wave 1)
|
||||
Plan: 4 of 7
|
||||
Plan: 5 of 7
|
||||
Status: Ready to execute
|
||||
Last activity: 2026-05-21
|
||||
|
||||
Progress: [█████████░] 87%
|
||||
Progress: [█████████░] 90%
|
||||
|
||||
### Plan 01-10 closure (2026-05-20)
|
||||
|
||||
@@ -150,6 +150,7 @@ Progress: [█████████░] 87%
|
||||
| Phase 04 P01 | 30m | 2 tasks | 5 files |
|
||||
| Phase 04 P02 | 41min | 2 tasks | 5 files |
|
||||
| Phase 04 P03 | 46min | 2 tasks | 2 files |
|
||||
| Phase 04 P04 | ~25min | - tasks | - files |
|
||||
|
||||
## Accumulated Context
|
||||
|
||||
@@ -201,6 +202,10 @@ current work:
|
||||
- [Phase ?]: [Phase 04-02]: Layered 4-mechanism CSP-hardening for transitive-polyfill pre-bundled-distribution interception (runtime queueMicrotask polyfill prelude + nodePolyfills exclude + resolve.alias.setimmediate + stripSetimmediateNewFunction Rollup post-transform plugin). Option α (force JSZip unbundled lib/index.js) attempted + reverted because it broke readable-stream-browser browser-field propagation causing UAT A30+ regressions. Option β preserves JSZip pre-bundled distribution verbatim while excising the offending literal post-bundle.
|
||||
- [Phase ?]: [Phase 04-02]: ROADMAP SC #3 (generate-icons ESM/CJS) closed via git mv generate-icons.js generate-icons.cjs — Node 14+ treats .cjs as CJS regardless of package.json type:module per nodejs.org/api/packages.html#determining-module-system. No code change. ROADMAP SC #4 (dead-code grep permissions.request) GREEN regression-pinned via tests/build/dead-code-grep.test.ts. Plan 01-12 Wave 7 setimmediate deferred-items entry CLOSED end-to-end. SW chunk new Function count polarity flipped 1 → 0. UAT 33/33 GREEN preserved.
|
||||
- [Phase 04-03]: A29 rewrite — cs-injection-world pattern (verbatim port of Plan 03-02 assertA30 / 03-03 assertA31 skeleton) + strict-sentinel filter (RESEARCH Q3 Code Example Pattern 3) closes the documented iana.org-leftover flake. assertA29 page-side: chrome.tabs.create(https://example.com) + chrome.scripting.executeScript world:'ISOLATED' injects sentinel-bearing <div> into document.body. driveA29 host-side: filter events by EventType.IncrementalSnapshot + IncrementalSource.Mutation, then descend into data.adds[*].node.textContent for 'a29-mutation-sentinel'. A29.2 strict-sentinel is THE primary check; A29.3 + A29.4 (Meta + FullSnapshot) preserved as defense-in-depth; pre-rewrite A29.5 (loose IncrementalSnapshot >=1) retired (subsumed). Empirical: 5/5 PASS across consecutive UAT runs (was ~2/3 historical). vitest 183/183 GREEN preserved. Tier-1 FORBIDDEN_HOOK_STRINGS unchanged at 12 (rides production chrome.tabs.create + chrome.scripting.executeScript per DEC-011 Amendment 1 grant + manifest scripting permission).
|
||||
- [Phase ?]: [Phase 04-04]: Wave 0 SPIKE FAILED
|
||||
- [Phase 04]: test
|
||||
- [Phase 04-04]: Wave 0 SPIKE FAILED — empirically refutes RESEARCH Q2 MEDIUM-confidence A3 (offscreen-document independent lifecycle). videoSize=8505 bytes after 5min idle + Puppeteer CDP worker.close() (sanity floor 100KB; typical 1-3MB). 8505 bytes are corrupt WebM per ffprobe (End of file + Duplicate element; no valid clusters); rrweb/session.json=[]; logs/events.json=[]; meta.urls=chrome-extension://* only. Conclusion: src/offscreen/recorder.ts:91 'let segments: Blob[] = []' RAM-only architecture does NOT survive 5-min SW idle. ROADMAP SC #1 remains OPEN; Task 2 (A33 verification-only) BLOCKED by gating condition; plan-fix ceremony required to add IndexedDB persistence per RESEARCH Q2 sub-question b Option C. Spike-first contract honored — STOP at Task 1; do NOT improvise inline; route to plan-fix ceremony per saved-memory feedback-gsd-ceremony-for-fixes.md.
|
||||
- [Phase 04-04]: stopServiceWorker(browser, extensionId) helper landed at tests/uat/lib/harness-page-driver.ts (verbatim Chrome devrel canonical pattern — Puppeteer >=22.1.0 worker.close()). Persisting artifact retained even though Task 2 BLOCKED — helper is non-empty positive scaffolding for the eventual IndexedDB-persistence plan-fix verification harness (A33-equivalent reuse). Pattern: spike-FAILED forensic-evidence — commit the spike script (tests/uat/spike-a33-sw-persistence.ts; 202 lines) AND the persisting helpers (not delete) so future plan-fix can re-run the exact reproducible test that revealed the failure.
|
||||
|
||||
### Pending Todos
|
||||
|
||||
@@ -223,7 +228,7 @@ Items acknowledged and carried forward from previous milestone close:
|
||||
|
||||
## Session Continuity
|
||||
|
||||
Last session: 2026-05-21T14:56:45.870Z
|
||||
Last session: 2026-05-21T17:11:40.684Z
|
||||
Stopped at: Completed 04-02-PLAN.md (setimmediate polyfill replaced via layered 4-mechanism mitigation; SW new Function polarity 1→0; UAT 33/33 GREEN preserved)
|
||||
Resume file: None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user