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>
This commit is contained in:
2026-05-22 13:02:58 +02:00
parent 0712c245a1
commit 28ebc1fe4e
3 changed files with 445 additions and 8 deletions

View File

@@ -3,8 +3,8 @@ gsd_state_version: 1.0
milestone: v2.0.0
milestone_name: milestone
status: executing
stopped_at: "Completed 04-08-PLAN.md (methodology reframe; A33 lands; ROADMAP SC #1 CLOSED via video-file MediaStream + SYNC install + LAZY first-frame; spike re-run 1.8MB vs 8505; UAT 34/34 + vitest 184/184 GREEN; architecture UNCHANGED per debug session-2)"
last_updated: "2026-05-22T09:07:54.692Z"
stopped_at: "Completed 04-05-PLAN.md (A34 fetch+XHR network_error empirical; ROADMAP SC #2 CLOSED; skip-mode UAT 34->35/35 GREEN; full-mode bailed at pre-existing Plan 04-08 A33 SAVE-ack flake — A34 SKIPPED-not-reached but verified by skip-mode)"
last_updated: "2026-05-22T10:43:22.622Z"
last_activity: 2026-05-22
progress:
total_phases: 4
@@ -28,13 +28,27 @@ no server, no password leaks.
## Current Position
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: 6 of 7
Phase 4 of 4 (Hardening — optional) — Plans 04-01..04-05 + 04-08 closed (6/8); 2 plans remain: 04-06 (visual polish; operator empirical) + 04-07 (closure aggregator). ROADMAP SC #1 + SC #2 both CLOSED.
Plan: 7 of 7 (04-06 NEXT)
Status: Ready to execute
Last activity: 2026-05-22
Progress: [█████████░] 90%
### Plan 04-05 closure (2026-05-22)
- A34 fetch + XHR network_error empirical assertion landed; ROADMAP SC #2 CLOSED.
- 2 atomic commits: `a20372a` (Task 1 — assertA34 page-side: cs-injection-world fetch(404)+XHR(404) injection) → `0712c24` (Task 2 — driveA34 host-side + 3-site orchestrator wiring).
- SUMMARY: `.planning/phases/04-harden-clean-up-optional/04-05-SUMMARY.md`.
- **A34 pattern**: `chrome.tabs.create('https://example.com/')` probe tab + `chrome.scripting.executeScript({world:'ISOLATED'})` injects TWO failing-request triggers — `fetch('https://example.com/404-fetch-a34-<stamp>')` + `new XMLHttpRequest(); open('GET','/404-xhr-a34-<stamp>'); send()` — into the content-script realm so BOTH production wrappers in `src/content/index.ts setupNetworkLogging` (window.fetch + XMLHttpRequest.prototype) intercept them. `-<stamp>` (Date.now()) uniqueness guard per T-04-05-02. The injected fetch is `.catch(noop)`'d so the network rejection does not surface as a separate js_error UserEvent.
- **driveA34 host-side**: JSZip-parses `logs/events.json`; filter-pipeline form (no `continue`) selects `network_error` entries whose `target` contains `404-fetch-a34` / `404-xhr-a34`; asserts ≥1 of each + `meta.status === 404`. `readMetaStatus` helper narrows `UserEvent.meta.status` (typed `Record<string,unknown>`) to `number` without an unchecked `any` cast.
- **Plan 04-01 P1 #11 validated end-to-end**: A34.4 confirmed the fetch `network_error` entry's `target` field carries the real URL (`https://example.com/404-fetch-a34-1779444293161`), NOT the literal `[object Request]` that pre-fix implicit coercion produced. This is the end-to-end proof — through the production bundle + SAVE→archive layer — that the Plan 04-01 Request-narrow unit-test fix works in a real Chrome page context.
- **Skip-mode UAT (`SKIP_LONG_UAT=1`): 34 → 35/35 GREEN** with A34 running for real (~25s); all 6 A34 checks PASS (A34.1 SAVE ack + A34.0a events.json present + A34.2 fetch entry + A34.3 XHR entry + A34.4 fetch status===404 + A34.5 XHR status===404). Diagnostics: `network_error count=2`, `fetch-entry count=1`, `xhr-entry count=1`.
- **vitest baseline 184/184 GREEN preserved** (Plan 04-05 added no unit tests — harness-only).
- **Tier-1 FORBIDDEN_HOOK_STRINGS unchanged at 12** in both gates (A34 rides production `window.fetch` + `XMLHttpRequest.prototype` + `chrome.scripting`/`tabs` — no new `__MOKOSH_UAT__`-gated symbol).
- **Pre-checkpoint bundle gates 6/6 PASS**: Tier-1 hook-string grep on dist/ (0 leaks); SW CSP-safety (`new Function`=0, `eval`=0); Node-globals + DOM-globals (`Buffer.`/`window.`/`document.` matches are third-party `typeof ...<"u"` guarded feature-detection; SW chunk byte-identical to baseline — Plan 04-05 touched zero `src/` files); manifest validation (mv3, 8 permissions); Tier-2 leak gate (`synthetic-display-source`=0).
- **Full-mode UAT (5-min A33 real) blocked at A33.1 — pre-existing Plan 04-08 flake, NOT Plan 04-05**: full-mode showed 33/35; `A33.1` (SAVE_ARCHIVE ack) returned `success=false` but `A33.2`/`A33.3` PASS (the 1.56 MB video buffer survived the `worker.close()` SW kill + event-driven wake). Suspected MV3 race — the original `sendMessage` channel bound to the killed SW instance closes before the restarted SW resolves the callback, despite the new instance completing the save + writing the archive. The orchestrator bails on first failure, so A34 was SKIPPED-not-reached in full-mode. A34 itself is unaffected and fully verified by the skip-mode 35/35. Per `feedback-gsd-ceremony-for-fixes.md`, the A33 flake is Plan 04-08's deliverable and out of scope for a Plan 04-05 hot-fix — logged as a Blocker and routed to /gsd-debug. Does NOT block ROADMAP SC #2 (closed via the skip-mode A34 verification).
### Plan 01-10 closure (2026-05-20)
- Welcome tab landed end-to-end across 4 waves (5 plan tasks: 4 autonomous + 1 operator empirical UAT cycle 2 + cycle-2 follow-up brand-rename ack)
@@ -151,6 +165,7 @@ Progress: [█████████░] 90%
| Phase 04 P02 | 41min | 2 tasks | 5 files |
| Phase 04 P03 | 46min | 2 tasks | 2 files |
| Phase 04 P04 | ~25min | - tasks | - files |
| Phase 04 P05 | ~45min | 2 tasks | 3 files |
## Accumulated Context
@@ -207,6 +222,7 @@ current work:
- [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.
- [Phase ?]: [Phase 04-08]: Methodology reframe — video-file MediaStream replaces canvas.captureStream throttling per debug session-2 verdict; A33 lands; UAT 33->34; ROADMAP SC #1 CLOSED 2026-05-22 (videoSize=1.8MB vs 8505 baseline); architecture UNCHANGED.
- [Phase ?]: [Phase 04-05]: A34 fetch+XHR network_error empirical lands (ROADMAP SC #2 CLOSED). cs-injection-world fetch(404)+XMLHttpRequest(404) from an example.com probe tab via chrome.scripting.executeScript ISOLATED; driveA34 host-side JSZip-parses logs/events.json + asserts 2 network_error entries (fetch+XHR) with meta.status===404. Plan 04-01 P1 #11 Request-narrow fix validated end-to-end — fetch entry target carries real URL not [object Request]. Skip-mode UAT 34->35/35 GREEN (A34 real, all 6 checks PASS). Tier-1 FORBIDDEN_HOOK_STRINGS unchanged at 12; bundle gates 6/6 PASS; vitest 184/184 preserved. Full-mode 35/35 gate observed a pre-existing Plan 04-08 A33 SAVE-ack flake (A33.1 false; 1.56MB video buffer survived) — A34 SKIPPED-not-reached in that run, unaffected; A33 flake routed to /gsd-debug.
### Pending Todos
@@ -219,6 +235,8 @@ None yet.
click handler; until Phase 3 lands, recording cannot start cleanly even if
Phase 1's pipeline is correct. Phases 13 should not be re-ordered.
- Plan 04-08 A33 full-mode SAVE-ack flake: in full-mode UAT (5-min idle real), A33.1 (SAVE_ARCHIVE ack) returned success=false even though A33.2/A33.3 PASS (1.56MB video buffer survived the SW worker.close() + event-driven wake). Suspected MV3 race: the original sendMessage channel bound to the killed SW instance closes before the restarted SW resolves the callback, despite the new instance completing the save + writing the archive. Orchestrator bails on first failure so A34 was SKIPPED-not-reached in full-mode. A34 itself is fully verified by skip-mode 35/35 GREEN. Route to /gsd-debug for A33 ack-channel hardening (out of scope for Plan 04-05 per feedback-gsd-ceremony-for-fixes.md — A33 is Plan 04-08's deliverable).
## Deferred Items
Items acknowledged and carried forward from previous milestone close:
@@ -229,8 +247,8 @@ Items acknowledged and carried forward from previous milestone close:
## Session Continuity
Last session: 2026-05-22T09:05:45.235Z
Stopped at: Completed 04-08-PLAN.md (methodology reframe; A33 lands; ROADMAP SC #1 CLOSED via video-file MediaStream + SYNC install + LAZY first-frame; spike re-run 1.8MB vs 8505; UAT 34/34 + vitest 184/184 GREEN; architecture UNCHANGED per debug session-2)
Last session: 2026-05-22T10:43:10.855Z
Stopped at: Completed 04-05-PLAN.md (A34 fetch+XHR network_error empirical; ROADMAP SC #2 CLOSED; skip-mode UAT 34->35/35 GREEN; full-mode bailed at pre-existing Plan 04-08 A33 SAVE-ack flake — A34 SKIPPED-not-reached but verified by skip-mode)
Resume file: None
Prior session: 2026-05-21T08:22:59.958Z — /gsd-pause-work saved Phase 4 execution-ready handoff (dbcf482); Phase 4 plans validated iter-2 PASSED + 3 cosmetic advisories fixed