Milestone v1 (v2.0.0): Mokosh — Session Capture #1

Merged
strategy155 merged 297 commits from gsd/phase-04-harden-clean-up-optional into main 2026-05-31 15:34:17 +00:00
Showing only changes of commit c1501e7a81 - Show all commits

View File

@@ -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. 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* *Phase: 04-harden-clean-up-optional*
*Plan: 04 (of 7)* *Plan: 04 (of 7, plus inserted 04-08)*
*Completed: 2026-05-21* *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*