From c1501e7a8154891aa987c264260890cace3f57b1 Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 22 May 2026 08:14:44 +0200 Subject: [PATCH] =?UTF-8?q?docs(04-04):=20amend=20SUMMARY=20post-debug=20s?= =?UTF-8?q?ession-2=20=E2=80=94=20REFUTED-architecture=20verdict?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../04-04-SUMMARY.md | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/.planning/phases/04-harden-clean-up-optional/04-04-SUMMARY.md b/.planning/phases/04-harden-clean-up-optional/04-04-SUMMARY.md index 82b3022..e7a15f0 100644 --- a/.planning/phases/04-harden-clean-up-optional/04-04-SUMMARY.md +++ b/.planning/phases/04-harden-clean-up-optional/04-04-SUMMARY.md @@ -230,8 +230,38 @@ Verifying claims before declaring plan complete (per executor protocol §self_ch All claims verified. Plan 04-04 closes at Task 1 (Wave 0 SPIKE FAILED) per the spike-first contract; Task 2 BLOCKED; ROADMAP SC #1 remains OPEN; plan-fix ceremony route documented. +--- + +## Post-Debug Amendment (2026-05-22) + +The above SPIKE FAILED interpretation ("architecture broken → IndexedDB plan-fix needed") is **empirically REFUTED** by the follow-on `/gsd-debug` ceremony at `.planning/debug/sw-offscreen-persistence-investigation-session-2.md` (commit `4ea1bbb`). Per user-authorized ceremony route, the SC#1 routing was held until disambiguation completed. + +**Session-2 verdict: REFUTED-architecture (canvas-captureStream issue).** The current `let segments: Blob[] = []` offscreen-RAM architecture (recorder.ts:91) is **NOT broken**. The spike's test methodology is invalid: + +- **Pre-kill probe:** `segments.length=3` → segments accumulated correctly during the 5-min idle. +- **Post-kill probe:** `segments.length=3` → segments **survive** SW kill structurally (offscreen-RAM persistence works). +- **Step C (no SW kill, just 5-min idle + SAVE_ARCHIVE):** identical 8505-byte failure → Puppeteer `worker.close()` is **not the cause**; 5-min idle alone is what breaks the recording. +- **Direct Remux logs (visible in Step C because SW respawn did not happen):** `Segment ts=1..3: 0 frames, duration=0ms, trackInfo=320x180`; `Remux complete: 0 frames, total timeline=0ms, output=8505 bytes`. + +**Root cause:** `installFakeDisplayMedia()` at `src/test-hooks/offscreen-hooks.ts:139-264` mints a `canvas.captureStream(30)` from a hidden -9999px-offset 320x180 canvas. Despite the `setInterval(drawFrame, 33ms)` belt-and-suspenders mitigation against RAF throttling, headless-Chromium aggressively throttles MediaRecorder on invisible-canvas sources (Chrome bug 653548; chromium auto-throttled-screen-capture design doc; sendrec.eu "Why Canvas Breaks Your Screen Recorder"). The MediaRecorder emits structurally-valid WebM with valid V_VP9 track metadata (320x180) but **zero VP9 frames per segment** over the 5-min idle window. The Remuxer correctly emits an 8505-byte header-only WebM from 3 × 0-frame segments. + +**Reproducibility:** 7/7 spike runs across both debug sessions converge on identical 8505 bytes (deterministic methodology failure). + +**Status correction (supersedes the above):** +- ROADMAP SC #1 remains **OPEN** but for a **TEST METHODOLOGY** reason — NOT for an architectural reason. +- The IndexedDB persistence plan-fix recommendation is **REJECTED**. It would not have closed SC#1 because the spike would still produce 8505 bytes after IDB lands; segments are not the problem, frames are. +- The correct fix: replace `canvas.captureStream(30)` in `installFakeDisplayMedia()` with an `HTMLVideoElement` playing a bundled WebM (Option 2 from session-2 recommendations). Bypasses canvas throttling entirely. + +**Routing decision (user-authorized 2026-05-22):** Insert new **Plan 04-08** — video-file-backed MediaStream methodology reframe (replaces canvas.captureStream + revives the A33 harness assertion under a valid methodology). Plan 04-08 lands between Plans 04-06 and 04-07 (Wave 5.5). + +**Persisting artifacts from this plan remain valid:** +- `stopServiceWorker(browser, extensionId)` at tests/uat/lib/harness-page-driver.ts — still required for the A33-equivalent verification gate that Plan 04-08 lands. +- `tests/uat/spike-a33-sw-persistence.ts` — kept as forensic evidence + future regression test (Plan 04-08 may reuse or supersede). +- Session-2 commit `9ac5808` — race-tolerant offscreen target attach fix at tests/uat/lib/launch.ts:225 (background_page → page, with full settle-and-retry). Permanent test-infra improvement; lives on past this plan. + --- *Phase: 04-harden-clean-up-optional* -*Plan: 04 (of 7)* +*Plan: 04 (of 7, plus inserted 04-08)* *Completed: 2026-05-21* -*Outcome: SPIKE FAILED → plan-fix ceremony required (architectural change to IndexedDB persistence)* +*Amended: 2026-05-22 — post-debug session-2 verdict REFUTED-architecture; SC#1 reframed to test-methodology issue; Plan 04-08 inserted* +*Outcome: SPIKE FAILED but root cause is test methodology (canvas throttling), not architecture; Plan 04-08 lands video-file MediaStream + A33 revival*