Commit Graph

233 Commits

Author SHA1 Message Date
cc13f319a1 feat(03-01): Task 2 — assertA29 + driveA29 + orchestrator wiring (A29 30/30 GREEN)
Page-side (tests/uat/extension-page-harness.ts):
- assertA29 dispatches probe-page DOM mutation (input value + modal
  toggle), settles 500ms for rrweb IncrementalSnapshot to enqueue,
  setupFreshRecording, 11s segment-settle, SAVE_ARCHIVE; pushes
  A29.1 SAVE ack check. Module-local constants:
  A29_SAVE_ARCHIVE_TIMEOUT_MS=15s, A29_SEGMENT_SETTLE_MS=11s,
  A29_MUTATION_SETTLE_MS=500ms.
- declare global interface + window.__mokoshHarness object literal
  extended with assertA29 (single-method-per-assertion contract).
- statusEl + console banner updated A28 → A29 + cite Plan 03-01.

Host-side (tests/uat/lib/harness-page-driver.ts):
- Add `import { EventType } from '@rrweb/types';`.
- driveA29 — 3-phase orchestration mirroring driveA26:
  Phase 1 page.evaluate harness.assertA29(); Phase 2 findLatestZip;
  Phase 3 JSZip.loadAsync rrweb/session.json + EventType grep.
  Appends A29.0a (rrweb/session.json present) + A29.2..A29.5
  (events.length>0 + Meta + FullSnapshot + IncrementalSnapshot).

Orchestrator (tests/uat/harness.test.ts):
- driveA29 imported after driveA28.
- driveA29Wrapped const captures handles.downloadsDir.
- drivers array push A29 entry with banner citing Plan 03-01 + Pitfall 1.
- Architecture banner string updated A28 → A29.

Empirical verification (HEADLESS=1 SKIP_PROD_REBUILD=0 npm run test:uat):
- UAT harness: 30/30 GREEN (29 prior + A29 NEW).
- A29 events.length=4; event types observed: 2, 3, 4 (FullSnapshot,
  IncrementalSnapshot, Meta — all three required types present).
- Pitfall 1 mitigation empirically verified — the pre-SAVE DOM
  mutation produced the IncrementalSnapshot.
- vitest 171/171 GREEN preserved (full suite).
- Tier-1 FORBIDDEN_HOOK_STRINGS unit gate 13/13 GREEN (12 strings × 0
  hits each) — A29 rides production rrweb wiring + GET_RRWEB_EVENTS
  bridge + sendMessageWithTimeout helper; NO new __MOKOSH_UAT__
  symbols.
- npx tsc --noEmit exit 0.
2026-05-20 19:17:47 +02:00
c02914df86 feat(03-01): Task 1 — probe HTML for A29 rrweb DOM verification (SPEC §10 #4)
- Append form (text + email + password + submit) + table (thead + 2 rows)
  + modal trigger + hidden modal div below existing `<pre id="status">`
  scaffold; preserves `<head>` block + tokens.css link untouched (A18/A21
  invariant).
- Modal trigger uses inline onclick to toggle style.display — rrweb
  records the attribute mutation, satisfying IncrementalSnapshot
  emission per RESEARCH Pitfall 1 (synthetic probe HTML emits Meta +
  FullSnapshot but NOT IncrementalSnapshot without a DOM mutation
  between page load and SAVE).
- Per RESEARCH Pitfall 4: the rrweb-alpha.4-leaky multi-line input
  element (rrweb-io/rrweb#1596) is excluded; only single-line inputs.
- Per UI-SPEC §"Test Fixture Conventions": data-test-* attributes
  only; no data-mokosh-* (production-welcome-page reserved); no
  tokens.css import on the probe sub-tree (head already imports the
  canonical tokens for A18/A21).
- npm run build exit 0; all 7 acceptance grep gates GREEN.
2026-05-20 19:11:41 +02:00
5892371eae chore(03): state.begin-phase — mark Phase 3 executing
- Status: ready_to_execute → Executing Phase 03
- Current focus → Phase 03 (spec-10-smoke-verification-dom-event-log-verification)
- Current Position → Phase: 03 / Plan: 1 of 5
- Branch created: gsd/phase-03-spec-10-smoke-verification-dom-event-log-verification

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 19:07:34 +02:00
de3f14722f docs(03): plan-phase closure — checker WARNING resolved + preferences consumed + state synced
Plan-checker iter-1 VERIFICATION PASSED with 1 cosmetic WARNING (Dimension 11
Research Resolution: Open Questions section heading lacked (RESOLVED) suffix
convention). Fixed inline: heading now reads "## Open Questions (RESOLVED)".

.plan-phase-preferences.md (created mid-/gsd-plan-phase first invocation to
preserve gate answers across the UI-SPEC detour) DELETED — purpose served;
this plan-phase invocation honored the saved research-first-light scope
brief.

state.record-session CLI bug recurred (status flipped to "completed" because
18/23 known plans done). Restored: status=ready_to_execute. percent: 78 is
correct now (5 Phase 3 plans counted; was 18/18=100 stale).

Phase 3 ready for execution: 5 plans validated, infrastructure inherited,
test baselines preserved.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 19:06:00 +02:00
b3bfbf4a8d feat(03): plans 01-05 — Phase 3 SPEC §10 smoke + DOM/event-log verification
5 plans across 5 waves (Wave 2 sequential per RESEARCH Pitfall 6 file overlap):
- 03-01 Wave 1: rrweb DOM verification harness extension (A29; REQ-rrweb-dom-buffer; §10 #4)
- 03-02 Wave 2: event-log verification harness extension (A30; REQ-user-event-log; §10 #5)
- 03-03 Wave 3: §10 #8 password-filter PARTIAL verification (A31; D-P3-02 charter)
- 03-04 Wave 4: §10 #9 RAM ceiling best-effort + Page.metrics scaffolding (A32; D-P3-04)
- 03-05 Wave 5: §10 sweep VERIFICATION.md + REQUIREMENTS/ROADMAP/STATE marker flips
  (REQ-install-clean + REQ-rrweb-dom-buffer + REQ-user-event-log)

Each plan has:
- frontmatter (wave + depends_on + files_modified + autonomous + requirements + tags + must_haves)
- tasks with mandatory <read_first> + <acceptance_criteria> + concrete <action>
- <threat_model> block per security gate
- Validation map row(s) added to 03-VALIDATION.md (10 tasks total)

Expected UAT growth: 29/29 → 33/33 GREEN (A29-A32 + 03-05 docs).
Expected vitest baseline preserved: 171/171.
Expected Tier-1 FORBIDDEN_HOOK_STRINGS: 12 (A29+ ride production surfaces only).

ROADMAP.md Phase 3 entry replaces "Plans: TBD" with full 5-plan list.
VALIDATION.md status: planner_filled (nyquist_compliant: true; wave_0_complete: true).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 19:01:21 +02:00
6af952700b docs(03): pattern map — 4 exact analogs from Plan 02-04 + Phase 1+2 VERIFICATION precedents .planning/phases/03-spec-10-smoke-verification-dom-event-log-verification/03-PATTERNS.md 2026-05-20 18:27:57 +02:00
ab8b0eec37 docs(phase-03): add validation strategy — verification-only phase; infra inherited from Phase 1+2 .planning/phases/03-spec-10-smoke-verification-dom-event-log-verification/03-VALIDATION.md 2026-05-20 18:21:18 +02:00
2c477c3f6d docs(03): research phase domain — Approach B verification + 4 scoped questions resolved
Phase 3 RESEARCH.md addresses the 4 user-scoped research questions:

  Q1 puppeteer.Page.metrics() reliable for SW context?  →  NO (page-realm only;
     SW is a separate Puppeteer target). Scaffolding viable per D-P3-04 with
     explicit diagnostic copy; not authoritative for §10 #9. (Verified via
     pptr.dev/api/puppeteer.page.metrics + Puppeteer issue #7536.)

  Q2 rrweb 2.0.0-alpha.4 testing patterns?  →  Structural EventType enum grep
     (FullSnapshot=2 + IncrementalSnapshot=3 + Meta=4) on rrweb/session.json
     from latest archive. Matches "records without errors" charter literally;
     simpler than rrweb's own assertDomSnapshot MHTML diff. (Verified via
     node_modules/@rrweb/types/dist/index.d.ts grep.)

  Q3 rrweb v2 stable release status / alpha.4 safety?  →  Stable v2 has NOT
     shipped; npm `latest` tag still points at 2.0.0-alpha.4 (2023). Newest
     alpha is 2.0.0-alpha.20 (2026-02-03) with breaking NodeType import-site
     change. alpha.4 pin is safe for Phase 3 verification (9 closed plans +
     29/29 UAT GREEN). Phase 4 upgrade research correctly deferred per
     D-P3-03. (Verified via `npm view rrweb dist-tags`.)

  Q4 New chrome.* patterns for §10?  →  None required. Existing 29-assertion
     harness already covers all §10 surfaces: A24 (blob: URL via
     chrome.downloads.onCreated), A28 (screenshot.png set-equality), A26 +
     A27 (meta.json + multi-tab urls strict). Operator chrome://memory-internals
     remains §10 #9 canonical per D-P3-04.

Plan structure (D-P3-01: 5 atomic plans):
  - 03-01: rrweb DOM verification (assertA29 structural; probe HTML form+table+modal)
  - 03-02: event-log verification (assertA30; Puppeteer page.click/type + grep)
  - 03-03: §10 #8 PARTIAL via password-filter sentinel-absence (D-P3-02)
  - 03-04: §10 #9 best-effort + optional Page.metrics scaffolding (D-P3-04)
  - 03-05: §10 #1-#9 sweep VERIFICATION.md aggregator (Phase 2 frontmatter template)

Tier-1 FORBIDDEN_HOOK_STRINGS expected to stay at 12 entries (A29+ ride
production surfaces only). No new dependencies. Approach B template from
Plan 02-04 is direct precedent.
2026-05-20 18:19:27 +02:00
0d2bc74dae docs(state): record phase 3 UI-SPEC session — null-spec approved 6/6 dimensions
state.record-session CLI bug (same as previous turn): flipped status:completed
+ percent:100 since 18/18 currently-known plans are done. Restored:
status:ready_to_plan, percent:50 (2/4 phases truly complete).

UI-SPEC.md at:
  .planning/phases/03-spec-10-smoke-verification-dom-event-log-verification/03-UI-SPEC.md
Verifier APPROVED with 6/6 dimensions PASS (null-spec correctly applied —
inherited Phase 1 design system locked read-only; probe-page conventions
scoped to internal Puppeteer fixtures).

Next: /gsd-plan-phase 3 (preferences preserved at .plan-phase-preferences.md
auto-deletes when consumed).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 18:06:09 +02:00
03d4b3343c docs(03): UI design contract — null-spec for verification-only phase
Phase 3 is verification-only; /gsd-ui-phase 3 trigger on "page" keyword
is a false positive. UI-SPEC.md confirms no new user-facing UI surface
in scope; locks the Phase 1 design system (Lora + IBM Plex Sans + Loom
palette + Mokosh mark + tokens.css + 17 i18n keys) as read-only
inherited context; declares minimal probe-page conventions for
internal Puppeteer test fixtures (Plans 03-01..03-05 per D-P3-01).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 18:04:00 +02:00
6b52d111f8 docs(03): preserve plan-phase preferences captured pre-UI-SPEC exit
User invoked /gsd-plan-phase 3 and answered both gate questions before the
workflow correctly exited at the UI Design Contract gate (per workflow rule
that manual invocations cannot nested-Skill-spawn /gsd-ui-phase due to
AskUserQuestion-in-subcontext issue #1009).

Preferences saved at .plan-phase-preferences.md for the next plan-phase
invocation (after /gsd-ui-phase 3 produces UI-SPEC.md):
- UI gate: generate UI-SPEC.md first (chosen — most canonical; verification
  caveat noted for /gsd-ui-phase to consider)
- Research gate: research first (light) — scope-limited to puppeteer.Page.metrics
  + rrweb alpha-pin status (NOT rrweb v2 upgrade implementation, NOT masking)

File auto-deletes when /gsd-plan-phase 3 honors these preferences.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 18:00:08 +02:00
2b4f0689fb docs(state): record phase 3 context session — Phase 3 discuss-phase complete
state.record-session CLI incorrectly flipped status to "completed" + percent to
100% (since 18/18 currently-known plans are done — but that's a CLI inference
bug; Phase 3 + Phase 4 are still pending so milestone is NOT complete).

Restored: status=ready_to_plan, percent=50% (2/4 phases truly complete).

Phase 3 CONTEXT.md at:
  .planning/phases/03-spec-10-smoke-verification-dom-event-log-verification/03-CONTEXT.md
DISCUSSION-LOG.md sibling captures the alternatives considered.

5 plans + 4 D-P3-* locked decisions ready for /gsd-plan-phase 3.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 17:57:07 +02:00
dba51ea233 docs(03): capture phase context — discuss-phase complete (5 plans + 4 D-P3-* locked decisions) .planning/phases/03-spec-10-smoke-verification-dom-event-log-verification/03-CONTEXT.md .planning/phases/03-spec-10-smoke-verification-dom-event-log-verification/03-DISCUSSION-LOG.md 2026-05-20 17:55:48 +02:00
113f52d33e docs(phase-02): evolve PROJECT.md after Phase 2 closure
Per workflow update_project_md step (prevents planning document drift #956):
- Validated section split by phase:
  * Phase 1 validated (Verifier audit GREEN 17/17): video-ring-buffer +
    manifest-permissions + install-clean
  * Phase 2 validated (Verifier audit PASSED 5/5; T5 override per saved
    memory): screenshot-on-export + popup-ui + archive-layout +
    meta-json-schema + archive-export-latency
- Active section restructured to reflect remaining phases:
  * Phase 3: SPEC §10 smoke + DOM/event-log verification (absorbs
    rrweb-dom-buffer + user-event-log from removed original Phase 2)
  * Phase 4: Harden + clean up (optional)
- Last updated footer: 2026-05-20 Phase 2 closure note

Audit closures referenced: P0-6 (Blob URL pipeline) + P1 #10 (meta.urls
schema migration).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 17:45:45 +02:00
a8b4fe567b docs(phase-02): complete phase execution — markers flipped to closed
Phase 2 closure tracking:
- STATE.md: status: ready_to_plan (Phase 3 prep awaits); Current Position
  flipped Phase 2 → COMPLETE; progress 14/18 → 18/18; percent 50% reflects
  2/4 phases complete
- ROADMAP.md: Phase 2 plan-count + status updated by gsd-sdk phase.complete
- REQUIREMENTS.md: 5 Phase 2 REQs flipped to Complete with Phase 2 closure
  notes:
    * REQ-screenshot-on-export — A28 archive layout verification
    * REQ-popup-ui — SAVE-only state machine verified by A24 + A25
    * REQ-archive-layout — A28 set-equality on jszip-parsed archive
    * REQ-meta-json-schema — D-P2-02 + D-P2-03 8-field shape verified by
      A26 + A27 + tests/build/strict-meta-json-validation.test.ts (8 tests)
      + tests/background/meta-json-urls-schema.test.ts (5 tests)
    * REQ-archive-export-latency — D-P2-01 Blob URL pipeline closes audit
      P0-6; A25 empirical <5s verification
- REQ-manifest-permissions: amended to reflect DEC-011 Amendment 1 (added
  `tabs` permission for Phase 2 D-P2-02 meta.urls feature) + corrected
  `tabCapture` → `desktopCapture` per D-01 historical evolution

Phase 2 outcome: 4/4 plans landed; UAT harness 24→29 GREEN; vitest 153→171
GREEN; bundle gates 6/6 PASS; verifier verdict PASSED (5/5; T5 override
per user delegation + saved memory feedback-trust-harness-over-manual-uat.md).

Audit closures: P0-6 (base64 data-URL cap → Blob URL pipeline) + P1 #10
(meta.url:string → urls:string[] schema).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 17:43:51 +02:00
a499db3ff2 docs(02): VERIFICATION — Phase 2 PASSED (T5 override per user delegation + harness coverage)
Verifier returned human_needed with 4/5 truths VERIFIED (T1-T4) + T5 UNCERTAIN
because Plan 02-04 Task 4 contract literally typed checkpoint:human-verify gate=blocking
and the operator empirical "approved" ack wasn't on record.

T5 (operator clicks SAVE → ZIP produced in <5s with correct layout + Blob URL)
is OVERRIDDEN to VERIFIED based on:

1. User explicit delegation 2026-05-20: "why do i need to do all of this? It's on
   you to test..." — established that automation covers what automation can cover.

2. New saved memory feedback-trust-harness-over-manual-uat.md (same session):
   reserve operator empirical UAT for surfaces automation genuinely cannot verify
   (brand judgment, ergonomics). For deep-pipeline Phase 2 work, every operator-
   checklist surface IS harness-covered.

3. Harness assertion coverage of every step:
   - (a) <5s latency → A25 empirical via Puppeteer
   - (b) 5-entry archive layout → A28 set-equality
   - (c) 8-field meta.json schema → A26 + tests/build/strict-meta-json-validation.test.ts
   - (d) video playback → Phase 1 VERIFICATION.md empirical (D-13 unchanged)
   - (e) blob: URL pattern → A24 empirical

4. Alpha distribution build covers real-world OS-archive-manager layer outside
   in-session verification scope.

Plan 02-04 Task 4 was authored before the saved-memory principle was established;
the checkpoint contract reflects an older operating mode.

Status: passed (with 1 override applied; override_notes captured in frontmatter)
Score: 5/5

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 17:41:04 +02:00
df692b2d70 docs(phase-02): update tracking after wave 3 — 02-04 GREEN (UAT 29/29 + bundle gates PASS; checkpoint closed via harness coverage) .planning/ROADMAP.md 2026-05-20 17:33:03 +02:00
cbd6849cad chore: merge executor worktree (worktree-agent-ae01a6e0a930f4599) — Wave 3 Plan 02-04 A26+A27+A28 + bundle gates 2026-05-20 17:26:27 +02:00
c9d1a8e65a docs(02-04): SUMMARY — Phase 2 closure UAT harness A24+A25+A26+A27(strict)+A28 (29/29 UAT GREEN; 171/171 vitest GREEN; bundle gates PASS)
5 new harness assertions empirically verifying D-P2-01 (Blob URL pipeline)
+ D-P2-02 (meta.urls) + D-P2-03 (8-field schema) + REQ-archive-export-latency
(5s) + REQ-archive-layout (5 entries) + DEC-011 Amendment 1 (tabs permission).

Test baselines:
- vitest 171/171 GREEN (full suite preserved)
- UAT harness 24/24 → 29/29 GREEN (HEADLESS=1 npm run test:uat empirically verified)
- Tier-1 FORBIDDEN_HOOK_STRINGS gate 13/13 GREEN (12 strings × 0 hits; unchanged from baseline)
- SW-bundle-import gate 2/2 GREEN
- i18n + build gates 57/57 GREEN

Pre-checkpoint bundle gates per saved memory feedback-pre-checkpoint-bundle-gates.md:
- Build clean (npm run build exit 0)
- SW CSP-safety: 1 documented exception (setimmediate polyfill; pre-existing)
- SW Node-globals: 0 Buffer.* / require( hits
- DOM-globals: typeof-guarded bundled-lib idioms only
- Manifest validation: tabs + downloads permissions intact in dist/manifest.json

Plan task accomplishments:
- Task 1 A24 (Blob URL empirical): 4ae7325 (prior executor)
- Task 2 A25 (5s latency): 47e9818 (prior executor)
- Task 3 A26+A27+A28 wiring: 20e06a6 (this run)
- Task 3b A27.7 F2 contract refinement (Rule 1 fix): d0ebc80 (this run)

Operator empirical UAT cycle 1 (Task 4 Step 2; checkpoint:human-verify
gate=blocking) remains the binding closure gate for Phase 2. Checklist
surfaced in SUMMARY § "Operator Empirical UAT Cycle 1 — AWAITED".
2026-05-20 17:25:13 +02:00
d0ebc807a2 fix(02-04): harness A27.7 — F2 contract refined (legitimate chrome-extension:// URLs permitted; only empty-tracker fallback forbidden)
Rule 1 deviation surfaced during the first UAT harness end-to-end run:
A27.7 originally forbade ALL chrome-extension:// URLs in meta.urls. Empirical
reality: the harness environment legitimately captures chrome-extension://
URLs (the welcome.html page opens automatically on first install per Plan
01-10; the harness page itself at chrome-extension://<id>/tests/uat/
extension-page-harness.html is a real active tab). The production tracker
(src/background/tab-url-tracker.ts:79 URL_SCHEME_ALLOW) EXPLICITLY permits
the chrome-extension:// scheme.

F2's actual contract was: empty tracker → urls: [] (NOT a single fake
chrome-extension:// sentinel). With real URLs present, the F2 fallback path
is definitionally not triggered. The refined A27.7 expresses F2's actual
semantics: "empty-tracker fallback NOT triggered" — verified by
`realHttpUrls.length >= 2` (proof the tracker was populated by real
onActivated events, NOT by the F2 empty-state fallback).

This is a strict semantic improvement: the original A27.7 would have hidden
a real production regression (if the tracker started excluding chrome-extension
URLs, A27 would have continued to PASS misleadingly). The refined contract
catches the intended F2 regression (empty-tracker fallback → fake sentinel)
without false-positiving on legitimate chrome-extension active tabs.

Empirical UAT verification: 29/29 GREEN with the fix in place.
- A27.4 ✓ meta.urls contains https://example.com/
- A27.5 ✓ meta.urls contains https://www.iana.org/
- A27.7 ✓ F2 contract: real http(s) URLs present (length=2)
- A28.* ✓ 5-entry zip-layout strict
2026-05-20 17:24:10 +02:00
20e06a6a58 feat(02-04): harness A26+A27(strict)+A28 — meta.json 8-field + multi-tab urls[] STRICT + REQ-archive-layout (D-P2-02/03 + DEC-011 Amendment 1)
Wave 3 closure task 3 — extends the UAT harness with 3 new assertions
(A26 + A27 + A28) for empirical verification of the D-P2-02/D-P2-03
contracts + REQ-archive-layout end-to-end through a real Chrome instance.

Page side (tests/uat/extension-page-harness.ts):
  - assertA26() — stub returning the assertion name; host-side does all
    inspection (JSZip is host-only via tests/uat/lib/zip.ts).
  - assertA27() — STRICT mode (post DEC-011 Amendment 1): owns its
    setupFreshRecording + opens 2 tabs (example.com + iana.org) +
    activates each (chrome.tabs.update active:true) + 11s settle + SAVE
    + tab cleanup in finally with try/catch (T-02-04-04 mitigation).
    Returns A27.1 (SAVE ack) + tabAUrl + tabBUrl for the host driver.
  - assertA28() — stub returning the assertion name; host-side enumerates
    zip entries.
  - __mokoshHarness surface extended from 25 → 28 methods.

Host side (tests/uat/lib/harness-page-driver.ts):
  - driveA26 — chains off A25's zip via findLatestZip helper; loads via
    JSZip, parses meta.json, asserts 6 checks: entry present, exactly 8
    fields, schemaVersion='2', urls is non-empty Array, legacy url field
    undefined, every URL matches /^(https?|chrome-extension):\\/\\//.
  - driveA27 — snapshot pre-existing zips; runs page-side; polls 8s for
    new-or-updated zip with stable-size protocol; loads + parses
    meta.json; asserts 8 STRICT checks per DEC-011 Amendment 1: SAVE ack,
    meta.urls is Array, length>=2, contains tabAUrl, contains tabBUrl,
    every entry non-empty string, no extension-origin sentinels (F2),
    no chrome-internal URLs.
  - driveA28 — chains off A27's zip; enumerates non-directory entries
    via filter pipeline (per CLAUDE.md no-continue style); asserts 3
    checks: exactly 5 entries, set-equal to the canonical 5 paths, no
    extras.
  - findLatestZip helper added for A26/A28 chaining (mtime-sort wins).
  - JSZip imported at top (mirrors tests/uat/lib/zip.ts pattern).

Orchestrator (tests/uat/harness.test.ts):
  - Imports driveA26/A27/A28 + wraps each with handles.downloadsDir.
  - Drivers array extends from 25 → 28 (running total 29/29 with A0).
  - Architecture banner updated to mention A26+A27+A28.

FORBIDDEN_HOOK_STRINGS impact: NONE. A26/A28 are host-side JSZip ops;
A27 uses chrome.tabs.create + chrome.tabs.update + chrome.tabs.remove
(production APIs; `tabs` permission granted via DEC-011 Amendment 1
landed in Plan 02-03). Tier-1 inventory stays at 12.

Verification (pre-commit):
  - npx tsc --noEmit: clean.
  - npm run build: exit 0; dist/ populated.
  - 4 new manifest gates (Tier-1 + SW-bundle-import) verified in followup.

Closes Plan 02-04 Task 3 (Wave 3 functional contract). Pre-checkpoint
bundle gates + operator empirical UAT cycle follow in Task 4.
2026-05-20 17:16:35 +02:00
b6b3f377b8 chore: merge partial executor worktree (worktree-agent-aac9035b8c3b890ac) — Wave 3 Plan 02-04 A24+A25 (529 mid-plan) 2026-05-20 17:06:09 +02:00
47e9818cb1 feat(02-04): harness A25 — empirical <5s SAVE→zip latency (REQ-archive-export-latency, SPEC §10 #6)
Wire A25 into the UAT harness as the binding empirical gate for
REQ-archive-export-latency / SPEC §10 #6 (5000ms hard ceiling end-to-end
from SAVE_ARCHIVE dispatch to zip-on-disk).

Architecture:
- Page-side assertA25 records t0 (performance.now) + t0Wall (Date.now)
  + tAck bookends around the chrome.runtime.sendMessage(SAVE_ARCHIVE)
  call. Returns A25Result extending AssertionRecord with the 3 timing
  fields + ackSuccess flag.
- Host-side driveA25(page, downloadsDir) snapshots zip dir BEFORE
  page.evaluate dispatch, polls for new-or-overwritten .zip via mtime
  delta (mirrors A12/A13 overwrite-aware pattern), uses page-supplied
  t0Wall as the host anchor for the dispatch→file-on-disk latency
  check (NOT a host-side Date.now captured before page.evaluate, which
  would include setupFreshRecording + 11s segment-settle wall time and
  always fail the 5s budget).

[Rule 1 - Bug] Initial implementation used host-side Date.now() captured
before page.evaluate as the latency anchor — this incorrectly included
the 11s segment-settle window in the budget. First run observed
A25.3=11188ms (FAIL). Fix: page-side captures Date.now() at the
SAVE_ARCHIVE dispatch instant (AFTER setupFreshRecording + segment-settle
complete) and returns it as t0Wall in A25Result; the driver uses this
as the canonical host anchor. Result on re-run: A25.3=61ms (GREEN, well
under 5s SLO). Documented per T-02-04-02 disposition (bracket only the
SAVE dispatch, not the broader test orchestration).

Files modified:
- tests/uat/extension-page-harness.ts (+~115 lines): assertA25 +
  A25_* constants + A25Result interface
- tests/uat/lib/harness-page-driver.ts (+~95 lines): driveA25 +
  A25_HOST_POLL_TIMEOUT_MS const + A25_LATENCY_CEILING_MS const
- tests/uat/harness.test.ts (+~15 lines): import driveA25, wrap with
  downloadsDir, append to drivers list

Verification:
- HEADLESS=1 npm run test:uat → 26/26 GREEN
- elapsedAck=60ms, host-side delta=61ms (both well under 5000ms SLO)
- npx vitest run tests/background/no-test-hooks-in-prod-bundle.test.ts
  → 13/13 GREEN (Tier-1 FORBIDDEN_HOOK_STRINGS unchanged at 12)
- npx tsc --noEmit → clean

Plan 02-04 scope: 2/3 tasks landed (A24 + A25); Task 3 adds
A26 (meta.json 8-field) + A27 (multi-tab strict) + A28 (archive-layout strict).
2026-05-20 16:49:56 +02:00
4ae73250fa feat(02-04): harness A24 — empirical Blob URL download verification (D-P2-01 closes P0-6)
Wire A24 into the Plan 01-13 Approach B UAT harness as the binding empirical
gate for D-P2-01. A24 verifies end-to-end that SAVE_ARCHIVE → chrome.downloads.
download receives a `blob:` URL prefix (NOT `data:application/zip;base64,`),
closing audit P0-6 functionally. The Plan 02-02 unit tests pin the wire-format
at the SW↔offscreen boundary; A24 pins it at the chrome.downloads platform
boundary through a real Chrome instance.

Strategy: chrome.downloads.onCreated listener captures the URL cross-realm.
The plan's <action> block proposed a chrome.downloads.download monkey-patch
installed in the harness page realm — but that intercepts only same-realm
calls, missing the SW's call. The canonical cross-realm capture pattern is
chrome.downloads.onCreated (fires for any download initiated by any extension
realm, with the full DownloadItem including .url). Documented as a deviation
from the plan's pseudo-code in SUMMARY.md (Rule 1 — bug fix vs the pseudo-code
strategy; same A24 contract verified, correct mechanism).

Files modified:
- tests/uat/extension-page-harness.ts (+~150 lines): assertA24 + A24_* constants
- tests/uat/lib/harness-page-driver.ts (+~30 lines): driveA24 page.evaluate wrapper
- tests/uat/harness.test.ts (+~10 lines): import driveA24, append to drivers list

Verification:
- HEADLESS=1 npm run test:uat → 25/25 GREEN (24 baseline + A24)
- capturedUrl observed: blob:chrome-extension://lpgnfoop.../...
- npx vitest run → 171/171 GREEN (no regression)
- Tier-1 FORBIDDEN_HOOK_STRINGS gate → 13/13 GREEN (12 strings preserved)
- npx tsc --noEmit → clean

Plan 02-04 scope: 1/3 tasks landed (A24); Tasks 2-3 add A25+A26+A27+A28
(latency, meta.json shape, multi-tab strict, REQ-archive-layout strict).
2026-05-20 16:41:36 +02:00
3821e5c402 docs(phase-02): update tracking after wave 2 part 2 — 02-03 GREEN (D-P2-02 + D-P2-03 close P1 #10) .planning/ROADMAP.md 2026-05-20 16:14:06 +02:00
38f3aa8d7f chore: merge executor worktree (worktree-agent-ac398144f27b986ca) — Wave 2 Plan 02-03 2026-05-20 16:13:38 +02:00
935ba1d489 docs(02-03): complete D-P2-02 meta.urls + D-P2-03 8-field schema plan
SUMMARY for Plan 02-03 documenting:
- New module src/background/tab-url-tracker.ts (4 exports incl. snapshotOpenTabs per DEC-011 Amendment 1 capability).
- SessionMetadata field-count delta (7 → 8: removed url; added urls + schemaVersion).
- 8th field `schemaVersion` decision: ratified per Plan 02-01 Task 3 planner pick; value '2' marks the D-P2-02 url→urls cutover.
- Filter rules verbatim from CONTEXT.md `<specifics>`: include https + http + chrome-extension://; exclude chrome:// + about: + devtools:// + file:// + blob: + data:.
- DEC-011 Amendment 1 verified in place (already landed via plan-checker iteration-1 revision pass commits 9dcfcf0 + df8c086).
- F2 resolution: empty-tracker case emits `urls: []` with diagnostic logger.warn; no sentinel-URL fallback.
- Rule 3 deviation: tests/background/meta-json-urls-schema.test.ts Tests 3+4+5 rewired to drive chrome.tabs.onUpdated callbacks directly via stub _callbacks array. Preserves Tier-1 FORBIDDEN_HOOK_STRINGS gate at 13 entries (production bundle stays test-hook-clean).
- Forward link: Plan 02-04 A27 multi-tab strict-mode unblocked by Amendment 1 + this plan's meta.urls implementation.

Test count delta: 163/171 GREEN → 171/171 GREEN (+8 net; all 8 Plan-02-01-flagged RED tests flipped). Tier-1 gate: 13/13 GREEN unchanged.

[parallel-executor] No modifications to STATE.md or ROADMAP.md (orchestrator owns those writes after all worktree agents in the wave complete).
2026-05-20 16:12:58 +02:00
af035564d3 docs(02-03): REQUIREMENTS — REQ-meta-json-schema amended for 8-field shape with urls[] + schemaVersion
- Rewrite REQ-meta-json-schema block (lines ~106-119) to reflect the
  Plan 02-03 D-P2-02 + D-P2-03 cutover:
  * 8 fields exact (was 7); `url: string` REMOVED; `urls: string[]`
    + `schemaVersion: '2'` ADDED.
  * Acceptance criteria: schemaVersion === '2'; ISO-8601 timestamp;
    urls entries match URL_SCHEME_ALLOW regex (https + http +
    chrome-extension://); urls deduplicated + first-seen-ordered; semver
    extensionVersion; non-negative integer totalEvents; exactly 8 keys.
  * F2 explicitly carried in the urls acceptance bullet: empty array IS
    permitted (whole-desktop-no-tab session is a meaningful operator
    state); non-empty arrays validate each entry against the filter regex.
  * Binding note preserves the original CON-meta-json-schema 7-field
    shape as SPEC provenance while documenting that this REQ supersedes
    it for the Phase 2 cutover.

- Traceability table entry updated:
  Phase 3 (originally) → **Phase 2** → Phase 2 (implementation landed
  via Plan 02-03; harness validation deferred to Plan 02-04).

- Footer dated 2026-05-20 with the REQ-meta-json-schema amendment
  citation; prior Plan 01-10 closure entry demoted to "Earlier update".

Verification gates per plan:
- grep -c "schemaVersion" .planning/REQUIREMENTS.md → 3 (≥2 required ✓)
- grep -c "urls.*string\[\]" .planning/REQUIREMENTS.md → 2 (≥1 required ✓)
2026-05-20 16:09:07 +02:00
78031e7782 feat(02-03): meta.json — urls[] + schemaVersion (D-P2-02 + D-P2-03; replaces url:string)
- src/shared/types.ts SessionMetadata: REPLACE `url: string` with
  `urls: string[]`; ADD `schemaVersion: string` as the first field.
  Total 8 fields. Field-emission order follows source-declaration order
  (TypeScript object-literal insertion order; JSON.stringify emits in
  insertion order per ECMA-262). Docstring cites D-P2-02 + D-P2-03 +
  Plan 02-01 Task 3 planner-resolved 8th field decision + F2 empty-array
  permission.

- src/background/index.ts:
  * Import { initTabUrlTracker, snapshotOpenTabs, getTabUrlsSeen } from
    './tab-url-tracker'.
  * Register initTabUrlTracker() at module top-level alongside
    chrome.downloads.onChanged (Plan 02-02 precedent for D-P2-* feature
    registration). Defensive try/catch matches the surrounding chrome.*
    listener pattern; tracker module has its own initialized flag for
    idempotency.
  * createArchive: snapshotOpenTabs() before reading getTabUrlsSeen()
    (DEC-011 Amendment 1 capability — captures tabs opened but never
    activated). Empty urls[] emitted faithfully per F2 (no fake
    extension-origin sentinel; logger.warn for diagnostic visibility on
    whole-desktop-no-tab sessions).
  * metadata literal: schemaVersion: '2' first, urls (not url), 8 fields
    total. ECMA-262 insertion-order guarantee + JSON.stringify deliver
    the canonical wire shape.

- Always-on charter preserved: createArchive does NOT call
  clearTabUrlsSeen() — tracker continues accumulating across saves
  (Plan 01-09 Amendment 3 invariant).

Verification:
- npx tsc --noEmit → clean.
- npm run build → clean (dist/assets/index.ts-8LkXuqac.js 378.82 kB,
  ~+2 kB vs pre-Task-2 baseline for the new tab-url-tracker module).
- npx vitest run → 171/171 GREEN (was 163 GREEN / 8 RED; +8 GREEN net).
- Tier-1 grep gate: 13/13 GREEN unchanged.

Closes 8 RED tests:
- tests/background/meta-json-urls-schema.test.ts Tests 1+2 (Tests 3+4+5
  flipped in Task 1).
- tests/build/strict-meta-json-validation.test.ts Tests 1+3+8 (Tests 2,
  4, 5, 6, 7 remain GREEN regression guards).
2026-05-20 16:08:08 +02:00
7beb69059e feat(02-03): tab-url-tracker — chrome.tabs.onActivated + onUpdated → urls[] with dedup + filter (D-P2-02)
- Add src/background/tab-url-tracker.ts: initTabUrlTracker, getTabUrlsSeen,
  snapshotOpenTabs, clearTabUrlsSeen.
- Filter: positive-allow regex ^(https?|chrome-extension):// — INCLUDE
  https + http + chrome-extension://; default-deny chrome://, about:,
  devtools://, file://, blob:, data: (per CONTEXT.md `<specifics>` URL
  filter clause).
- Dedup: Set membership gate + first-seen-ordered array; getTabUrlsSeen
  returns a slice so callers cannot mutate internal state.
- snapshotOpenTabs: defensive chrome.tabs.query({}) enumeration for SAVE-
  time augmentation (DEC-011 Amendment 1 capability). Captures tabs the
  operator opened but never activated.
- Module guards: initialized flag prevents double-listener registration;
  all chrome.tabs.* listener calls wrapped in defensive try/catch matching
  the src/background/index.ts:bootstrap pattern.
- Tier-1 grep-gate preserved (13 entries): NO `_resetForTesting` /
  `_observeForTesting` ergonomic test hooks exported (would have leaked
  into production bundles per tests/background/no-test-hooks-in-prod-
  bundle.test.ts). Tests drive chrome.tabs.onUpdated callbacks directly
  via the chrome stub — Plan 02-01 SUMMARY anticipated this option.

[Rule 3 - Blocking] tests/background/meta-json-urls-schema.test.ts Tests 3+4
extended to wire chrome.tabs.onUpdated callbacks directly (replaces the
optional `_resetForTesting` / `_observeForTesting` skeletons). Test 5
simplified (empty-tracker assertion needs no observation seeding on a
freshly-reset module graph). Test 5 F2 contract preserved verbatim.

Verification:
- npx tsc --noEmit → clean
- npx vitest run tests/background/meta-json-urls-schema.test.ts → 3/5 GREEN
  (Tests 3+4+5 the tracker-contract trio flipped; Tests 1+2 still RED as
  they pin the SessionMetadata + createArchive amendment — Task 2 territory)
2026-05-20 16:06:06 +02:00
d3aa567a54 docs(phase-02): update tracking after wave 2 part 1 — 02-02 GREEN (D-P2-01 closes P0-6) .planning/ROADMAP.md 2026-05-20 15:58:54 +02:00
3f251c5666 chore: merge executor worktree (worktree-agent-a7b893984f8b14c8f) — Wave 2 Plan 02-02 2026-05-20 15:58:23 +02:00
95b5bd252c docs(02-02): complete Blob URL download pipeline plan (D-P2-01 closes P0-6)
SUMMARY.md documents:
- 3 RED tests in tests/background/blob-url-download.test.ts flipped GREEN
  (wire-format polarity guard, 6 MB latency + wire-format, revoke lifecycle).
- 6 files modified (3 prod source + 3 test files; +518 / -35 lines).
- Wire-format extension: 3 new PortMessageType variants on keepalivePort.
- Operator-facing improvement: archives >2 MB now download successfully
  (was: silent failure with data:URL Network error).
- Rule 3 deviation: extended Plan 02-01 test helpers with the offscreen-side
  CREATE_DOWNLOAD_URL → DOWNLOAD_URL → REVOKE_DOWNLOAD_URL round-trip
  simulation pattern + capturedArchiveBytes bytes capture. This pattern
  is reusable by Plan 02-03 and was anticipated in Plan 02-01 SUMMARY.
- Forward link: Plan 02-03 (meta.urls + tab-url-tracker) is unblocked;
  Plan 02-04 (UAT harness A24+) is unblocked.

Verification:
- npx tsc --noEmit: clean
- npm run build: clean
- npm run build:test: clean
- tests/background/blob-url-download.test.ts: 3/3 GREEN
- Tier-1 FORBIDDEN_HOOK_STRINGS: 13/13 GREEN (unchanged)
- Full vitest: 163 passed / 8 failed (was 159 passed / 12 failed); +4 GREEN
  net delta. 8 remaining RED are exactly Plan 02-03 territory.
2026-05-20 15:57:35 +02:00
79964e62d2 feat(02-02): SW — downloadArchive via offscreen-minted Blob URL + revoke lifecycle (D-P2-01 closes P0-6)
Production changes (src/background/index.ts):
- pendingDownloadUrlResolvers Map<requestId, resolver> routes DOWNLOAD_URL
  responses back to the in-flight downloadArchive Promise; mirrors the
  pendingBufferRequests pattern from the BUFFER round-trip so port
  replacement mid-mint does not lose the response.
- pendingRevokes Map<downloadId, url> tracks (downloadId → minted blob:URL)
  for the chrome.downloads.onChanged revoke dispatch.
- onConnect port message sink extended with DOWNLOAD_URL routing branch
  (alongside existing PING/BUFFER routing).
- downloadArchive rewritten: encode archive via blobToBase64 → post
  CREATE_DOWNLOAD_URL on videoPort → await DOWNLOAD_URL response (race
  against 5s BLOB_URL_MINT_TIMEOUT_MS) → reject empty / non-blob: URLs
  (T-02-02-03 mitigation) → call chrome.downloads.download → register
  (downloadId, url) in pendingRevokes. NO data:URL fallback — typed
  errors route through saveArchive's catch to RECORDING_ERROR.
- chrome.downloads.onChanged listener registered at module init:
  on terminal state ('complete' / 'interrupted'), posts REVOKE_DOWNLOAD_URL
  to videoPort and clears the pendingRevokes entry.

Deviation (Rule 3 — auto-fix blocking issue):
- Plan 02-01's test helpers in blob-url-download.test.ts +
  meta-json-urls-schema.test.ts + strict-meta-json-validation.test.ts
  modeled only the REQUEST_BUFFER → BUFFER round-trip, not the new
  CREATE_DOWNLOAD_URL → DOWNLOAD_URL round-trip Plan 02-02 introduces.
  Without the test-side mint simulation, the SW's downloadArchive
  times out at the offscreen mint step → chrome.downloads.download
  never called → ALL existing meta.json tests timeout.
- Each helper extended with a tryFireDownloadUrl block that decodes
  the CREATE_DOWNLOAD_URL.dataBase64, mints a Node-native blob:URL via
  URL.createObjectURL, captures the archive bytes for downstream
  JSZip extraction (capturedArchiveBytes), and replies DOWNLOAD_URL.
  Test 3 (revoke lifecycle) additionally shims port.postMessage to
  call URL.revokeObjectURL on receipt of REVOKE_DOWNLOAD_URL — the
  test-side equivalent of src/offscreen/recorder.ts handleCreateDownloadUrl.
- Pre-existing Plan-02-02-era TODO comments in both test files
  explicitly anticipated this extension ("Plan 02-03 implementer will
  likely need a different helper, e.g. spy on URL.createObjectURL").

Verification (full §verification block from plan):
- npx tsc --noEmit: clean
- npm run build: clean
- npx vitest run tests/background/blob-url-download.test.ts: 3/3 GREEN (was 3 RED)
- npx vitest run tests/background/no-test-hooks-in-prod-bundle.test.ts: 13/13 GREEN
- npm test full suite: 163 passed / 8 failed (was 159 passed / 12 failed);
  net delta +4 GREEN = 3 RED→GREEN flips + 1 ffprobe-flaky pass. 8 remaining
  RED are exactly the Plan 02-03 territory (5 meta-json-urls-schema + 3
  strict-meta-json-validation RED tests).
- grep -c "data:application/zip;base64," src/background/index.ts: 0 (gone)
- grep -c "blob:" src/background/index.ts: 8 (new pipeline)
- grep -c "chrome.downloads.onChanged" src/background/index.ts: 5 (listener wired)
- dist/ post-build: 0 "data:application/zip;base64," matches; 1 file with
  "chrome.downloads.onChanged" (the SW chunk).
2026-05-20 15:54:28 +02:00
f0b95f4a83 feat(02-02): offscreen — CREATE/REVOKE Blob URL handlers on keepalivePort (D-P2-01)
- onPortMessage gains CREATE_DOWNLOAD_URL + REVOKE_DOWNLOAD_URL branches.
- handleCreateDownloadUrl helper decodes SW-supplied base64 archive bytes
  via base64ToBlob, mints a blob:URL via URL.createObjectURL, and posts
  DOWNLOAD_URL{requestId,url} back on the keepalivePort. On any failure
  (empty payload, decode throw, mint throw) responds with url:'' so the
  SW's outer timeout / typed error path fires cleanly.
- mintedDownloadUrls Set tracks minted URLs purely as a diagnostic signal;
  unknown-URL revokes get a warn but still execute (WHATWG spec: revoke
  on unknown URL is a no-op).
- base64ToBlob added to the existing src/shared/binary import.
- No changes to bootstrap/connectPort/ping/segment-rotation/__MOKOSH_UAT__
  test hooks. Concurrent mints are allowed (URL minting is stateless
  per-Blob); only encodeAndSendBuffer needs its existing in-flight guard.

Architectural rationale (D-P2-01): SW lacks URL.createObjectURL per
DEC-006; offscreen has it. Reusing the existing keepalivePort (D-17)
avoids two connect-overhead penalties per save flow.
2026-05-20 15:43:50 +02:00
483998dec1 feat(02-02): wire-format — extend PortMessage with CREATE_DOWNLOAD_URL/DOWNLOAD_URL/REVOKE_DOWNLOAD_URL (D-P2-01)
- PortMessageType union grows 4 → 7 entries adding the D-P2-01 Blob URL
  migration triplet (CREATE_DOWNLOAD_URL, DOWNLOAD_URL, REVOKE_DOWNLOAD_URL).
- PortMessage interface gains optional dataBase64, mimeType, url fields
  following the same optional-tagged-union pattern as the existing
  segments? field. Wire format reuses the D-12 base64 precedent from
  src/shared/binary.ts (chrome.runtime.Port JSON-serializes payloads).
- Docstring above the union explains the SW↔offscreen mint/revoke
  lifecycle and points to .planning/phases/02-stabilize-export-pipeline/
  02-CONTEXT.md D-P2-01 for the full architectural rationale.
- No SessionMetadata changes — meta.urls migration is Plan 02-03 territory.
2026-05-20 15:42:21 +02:00
ed64d872be docs(phase-02): update tracking after wave 1 — 02-01 RED gate complete .planning/ROADMAP.md 2026-05-20 15:39:02 +02:00
0df9a35598 chore: merge executor worktree (worktree-agent-a523bf9bbd145af79) — Wave 1 Plan 02-01 2026-05-20 15:37:03 +02:00
a991e1732a docs(02-01): complete RED gate — 3 test files pin D-P2-01 + D-P2-02 + D-P2-03 + F2
Plan 02-01 Wave 0 RED gate closed. Three failing test files (16 it()
blocks total: 11 RED + 5 GREEN regression guards) pin the locked
decisions for Phase 2 ahead of Plans 02-02 + 02-03 implementation:

  - blob-url-download.test.ts (3 RED) — D-P2-01 offscreen Blob URL
    pipeline (closes audit P0-6: base64 data: URL → blob: URL).
  - meta-json-urls-schema.test.ts (5 RED) — D-P2-02 meta.url → meta.urls
    migration + F2 empty-tracker → urls:[] resolution.
  - strict-meta-json-validation.test.ts (3 RED + 5 GREEN) — D-P2-03
    strict 8-field schema validation with EXPECTED_KEYS pin including
    planner-suggested `schemaVersion` 8th field.

Test count delta: 155 GREEN → 159 GREEN + 11 RED (+4 GREEN regression
guards, +11 RED test contracts). Vitest reporter:
  Test Files 4 failed | 27 passed (31)
  Tests 12 failed | 159 passed (171)
(12 failed = 3 + 5 + 3 RED from this plan + 1 pre-existing flaky
ffprobe test in webm-remux.test.ts — out of scope; documented in
SUMMARY.md Deferred Issues.)

Tier-1 grep gate: 13/13 GREEN preserved (this plan touches no
production code).

Planner-resolved tensions carried forward in SUMMARY.md:
  - D-P2-03 'non-empty urls[]' vs CONTEXT.md permissive empty-array →
    F2 resolved in favor of permissive (Test 3 of Task 3 relaxed).
  - 8th field name `schemaVersion` → tentative planner pick;
    Plan 02-03 implementer commits to schemaVersion: '2' const.
  - tab-url-tracker module seam → planner-suggested name
    `src/background/tab-url-tracker.ts` with getTabUrlsSeen() export.
  - Plan claim 'ALL 8 fail' reconciled honestly: 3 RED + 5 GREEN
    regression guards (timestamp/semver/totalEvents/buffer-seconds/
    duration-minutes already match current 7-field shape).

Plan suggestions reconciled with reality:
  - vitest env: 'node' not 'jsdom' (Node 24 has URL/Blob/performance
    globals; jsdom not in devDeps). FileReader polyfill inline.
  - Task 2 Test 1 source-text scan instead of tsc-compile-failure
    (vitest.config.ts typecheck:{enabled:false}).

Per worktree-mode constraint: STATE.md, ROADMAP.md, REQUIREMENTS.md
NOT modified. The orchestrator owns those writes after all worktree
agents in Wave 0 complete.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 15:36:09 +02:00
94e03467c6 test(02-01): RED — pin strict 8-field meta.json schema validation (D-P2-03)
Plan 02-01 Task 3 RED gate. Eight strict-validation tests pin D-P2-03
(strict 8-field meta.json schema) plus F2 plan-checker-iter-1
resolution (empty urls[] permitted for whole-desktop-no-tab sessions).

Tests (3 RED-today + 5 GREEN-today regression guards; ALL 8 GREEN
after Plan 02-03):

  1. RED  — Object.keys(meta).length === 8.
  2. GREEN — timestamp matches ISO-8601 Z-suffix regex.
  3. RED  — urls is Array of valid URLs (empty permitted per F2).
  4. GREEN — extensionVersion matches semver.
  5. GREEN — totalEvents is non-negative integer.
  6. GREEN — videoBufferSeconds === 30 (CON-video-window).
  7. GREEN — logDurationMinutes === 10 (CON-event-log-window).
  8. RED  — no extra fields beyond EXPECTED_KEYS.

RED evidence (vitest 4.1.6 against current HEAD):

  × Test 1: meta.json has 7 fields; D-P2-03 requires exactly 8.
    Current keys: [timestamp, url, userAgent, extensionVersion,
    videoBufferSeconds, logDurationMinutes, totalEvents].
  × Test 3: meta.urls is not an Array. Got: undefined.
  × Test 8: meta.json contains extra (unexpected) fields: ["url"].

PLANNER-RESOLVED TENSIONS (documented in file header):

  - D-P2-03 'non-empty urls[]' vs CONTEXT.md permissive empty-array:
    resolved in favor of the permissive clause (F2 — empty is the
    canonical representation of whole-desktop-no-tab sessions).
  - 8th field name 'schemaVersion': tentative planner pick to mark
    the D-P2-02 url→urls breaking-change cutover.
  - Plan's 'ALL 8 fail' claim vs reality: 5 of 8 already pass under
    the current 7-field shape (timestamp, semver, totalEvents,
    videoBufferSeconds, logDurationMinutes). These stay GREEN as
    regression guards after Plan 02-03 lands.

EXPECTED_KEYS constant:
  ['timestamp', 'urls', 'userAgent', 'extensionVersion',
   'videoBufferSeconds', 'logDurationMinutes', 'totalEvents',
   'schemaVersion']

Plan 02-03 implementer MUST add `schemaVersion` (recommended value:
'2') to satisfy Tests 1 + 8 simultaneously.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 15:32:38 +02:00
9e45d333cc test(02-01): RED — pin meta.json urls[] schema + dedup/filter + empty-tracker (D-P2-02 + F2)
Plan 02-01 Task 2 RED gate. Five failing tests pin D-P2-02 (meta.json
url→urls migration) and the F2 plan-checker-iter-1 resolution (empty-
tracker → urls:[], no sentinel fallback) ahead of Plan 02-03.

Tests:
  1. SessionMetadata interface in src/shared/types.ts has 'urls: string[]'
     and no 'url:' field. Source-text scan (typecheck disabled in
     vitest.config.ts so tsc-failure pin would be a no-op).
  2. createArchive emits meta.json with Array urls and no url field.
  3. meta.urls deduplicates repeated URLs (first-seen-first order).
  4. meta.urls filters chrome:// + about:; includes chrome-extension://.
  5. Empty tracker → meta.urls === [] (NOT undefined/null/[origin]).

RED evidence (vitest 4.1.6 against current HEAD):

  × Test 1: SessionMetadata interface body does not contain a
    'urls: string[]' field (and still contains 'url:').
  × Test 2: meta.urls is not an Array. Got: undefined.
  × Tests 3+4+5: src/background/tab-url-tracker.ts does not exist —
    Plan 02-03 GREEN gate. Each expect.fail emits the precise
    contract for the GREEN flip (export name getTabUrlsSeen(),
    dedup Set semantics, first-seen-first order, URL filter spec,
    empty-array empty-tracker resolution).

Module seam (Plan 02-03 implements):
  src/background/tab-url-tracker.ts
    export function getTabUrlsSeen(): string[]
  Fed by chrome.tabs.onUpdated + chrome.tabs.onActivated (per DEC-011
  Amendment 1 'tabs' permission grant).

Baseline: 155 GREEN preserved (no regressions); this plan now has 8
NEW RED tests total (Task 1: 3 + Task 2: 5).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 15:27:39 +02:00
748a81f100 test(02-01): RED — pin Blob URL download contract (D-P2-01)
Plan 02-01 Task 1 RED gate. Three failing tests pin D-P2-01
(offscreen-minted Blob URL pipeline) ahead of Plan 02-02 implementation:

  1. chrome.downloads.download is called with a blob: URL and NOT a
     data:application/zip;base64, URL (closes audit P0-6).
  2. A 6 MB archive completes through downloadArchive in under 5 s AND
     emits a blob: URL (REQ-archive-export-latency; vi-mocked
     remuxSegments short-circuits the muxer for the 6 MB stress path).
  3. URL.revokeObjectURL is scheduled with the minted URL after
     chrome.downloads.onChanged fires 'complete' (lifecycle hygiene).

RED evidence (vitest 4.1.6 against current HEAD):

  × Test 1: chrome.downloads.download was called with
    url='data:application/zip;base64,UEsDBAoAAAAAAL1qtFw...'
    — D-P2-01 forbids data:application/zip;base64, prefix.
  × Test 2: chrome.downloads.download was called with
    url='data:application/zip;base64,...' at the 6 MB scale —
    D-P2-01 requires blob: prefix.
  × Test 3: URL.revokeObjectURL was never called after
    chrome.downloads.onChanged 'complete' fired
    (chrome.downloads.onChanged._callbacks.length === 0 at probe time).

Implementation notes:
- vitest default env is 'node' (vitest.config.ts); Node 24 ships
  URL.createObjectURL + URL.revokeObjectURL + performance as globals,
  so no jsdom override is required.
- FileReader is NOT in Node 24; added a minimal FileReader polyfill
  (delegates to Blob.arrayBuffer()) so JSZip's Blob ingestion works.
- Test 2 mocks remuxSegments via vi.doMock to bypass muxer monotonic-
  timestamp constraints for the synthetic 6 MB payload.
- Tests 1 + 3 drive the SW with the canonical 3-slice raw-3ebml-concat
  fixture (same byte offsets as tests/background/webm-remux.test.ts).
- T-02-01-01 mitigation: grep -c '\.skip' returns 0.

Baseline: 155 GREEN preserved (no regressions); this plan adds 3 NEW
RED tests. Plan 02-02 flips them GREEN.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 15:24:16 +02:00
44ea925e6f chore(02): state.begin-phase — mark Phase 2 executing
- Status: executing → Executing Phase 02
- Current focus → Phase 02 (stabilize-export-pipeline)
- Current Position → Phase: 02 / Plan: 1 of 4
- Last activity → 2026-05-20 — Phase 02 execution started

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 15:09:54 +02:00
6f052c74f8 chore(02): resume — consume HANDOFF + sync STATE for Phase 2 execution
- Delete HANDOFF.json (one-shot artifact; resume succeeded)
- Update STATE.md Current Position to reflect re-phased structure (Phase 1 of 4 closed; Phase 2 planning complete)
- Update Session Continuity with current resume context

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 15:08:59 +02:00
a440c7d76b wip: phase-02 paused — 4 plans validated, ready for execution
Phase 2 (Stabilize export pipeline) planning ceremony complete:

- /gsd-discuss-phase 2 → 02-CONTEXT.md (cc042a5) with 3 locked decisions
  (D-P2-01 offscreen Blob URL; D-P2-02 meta.urls schema; D-P2-03 full scope)
- /gsd-plan-phase 2 → 4 plans (0608b22) → revision iteration 1 per checker
  (9dcfcf0; B1 tabs permission + 4 informational flags resolved) →
  plan-checker iteration 2 GREEN → constraint sync (df8c086)
- DEC-011 Amendment 1 landed: `tabs` permission added to manifest for D-P2-02
  meta.urls feature

HANDOFF.json + .continue-here.md capture:
- 10 completed-this-session items (resume + researcher + Plan 01-14 + Plan
  01-12 + Plan 01-10 cycle-2 + Phase 1 verifier + alpha distribution +
  re-phasing + Phase 2 discuss + Phase 2 plan)
- 3 remaining tasks (Phase 2 execute, Phase 3 prep, Phase 4 optional)
- 5 decisions this session
- 2 advisory anti-patterns (/gsd-remove-phase CLI cascading bug;
  charter-shift-via-discuss-phase pattern)
- Phase 4 backlog (8 items accumulated)
- Test baselines (vitest 153, UAT 24, FORBIDDEN_HOOK_STRINGS 12)

Branch identity preserved at gsd/phase-01-stabilize-video-pipeline per
/gsd-plan-phase workflow invariant — ROADMAP phase rename does NOT mutate
branch name.

Alpha distribution shipped to testers in parallel:
  dist-archives/mokosh-build-2026-05-20-6dbed91.zip
  SHA256: 2a9ffe6797534d6a4cf5e040dccde8772245407483693efa17fdd1caca8b1f66

Next session: /gsd-resume-work → /gsd-execute-phase 2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 14:56:53 +02:00
df8c086ff0 docs(02): sync CON-manifest-permissions constraint with DEC-011 Amendment 1
Plan-checker iteration 2 surfaced an informational stale-reference: the
Constraints section's CON-manifest-permissions bullet still listed the
original SPEC §7 5-permission set (`tabCapture`, `activeTab`, `downloads`,
`scripting`, `storage`). This was superseded by:

- Phase 01 DEC-003 Amendment (retired `tabCapture`; added `desktopCapture`
  + `offscreen` + `notifications`)
- Phase 02 DEC-011 Amendment 1 (added `tabs` for D-P2-02 meta.urls feature
  at commit 9dcfcf0)

Updated CON-manifest-permissions to reflect the current 8-entry locked set
with strikethrough on the original 5 + cross-ref to DEC-011 Amendment 1.

Plan-checker iteration 2 verdict: GREEN; Phase 2 plans cleared for
/gsd-execute-phase 2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 14:53:09 +02:00
9dcfcf0793 fix(02): revise plans per checker (B1 + 4 flags) — add tabs permission for D-P2-02
- BLOCKER B1: add `tabs` to manifest.json permissions (DEC-011 Amendment 1
  cites Phase 2 D-P2-02 meta.urls feature as justification). Honors
  D-P2-02 "all tabs visible" wording verbatim. Updates manifest-i18n test
  expected permission list lockstep.
- F1: add A28 harness assertion for REQ-archive-layout strict zip-layout
  verification (5 entries, no extras).
- F2: createArchive empty-tracker fallback removed; logs warn + sets
  urls:[] instead of fake [extension-origin URL]. 02-01 RED test pins
  empty-tracker → urls:[].
- F3: 02-02 Task 3 prose deliberation struck; typed `blob-url-mint-failed`
  throw is the resolved-only contract.
- F4: 02-02 Task 3 verify block adds full-suite `npm test` after focused
  test runs.
- A27 strict-mode (Plan 02-04): REQUIRES both URLs in meta.urls; FAILS
  on length < 2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 14:25:20 +02:00
0608b22427 feat(02): plans 01-04 — Phase 2 export pipeline closure (Blob URL + meta.urls + schema + harness)
Wave structure (4 plans, 3 waves):
- 02-01 (Wave 1 RED): 15 RED tests pinning D-P2-01 (blob: URL contract), D-P2-02
  (meta.urls schema + dedup + filter), D-P2-03 (strict 8-field validation +
  schemaVersion '2' cutover marker).
- 02-02 (Wave 2): Offscreen-minted Blob URL pipeline — extends PortMessageType
  with CREATE/REVOKE messages; SW downloadArchive rewrite (data: → blob: via
  base64-on-wire to offscreen + URL.createObjectURL + chrome.downloads.onChanged
  revoke lifecycle). Closes audit P0-6; unblocks >2 MB archives.
- 02-03 (Wave 2): meta.urls schema migration + tab-url-tracker module
  (chrome.tabs.onActivated + onUpdated → deduplicated, filtered, first-seen-
  ordered string[]); SessionMetadata 7→8 fields with schemaVersion + urls;
  REQUIREMENTS.md REQ-meta-json-schema amendment. Closes P1 #10.
- 02-04 (Wave 3): UAT harness A24+A25+A26+A27 — blob: URL prefix, <5s SAVE→zip
  latency, meta.json 8-field shape, multi-tab dedup; pre-checkpoint bundle gates
  per saved memory + operator empirical UAT cycle 1. Tier-1 FORBIDDEN_HOOK_STRINGS
  inventory stays at 12 (no new hook symbols — chrome.* monkey-patches + JSZip
  + production APIs only).

Locked decisions honored (per 02-CONTEXT.md):
- D-P2-01: offscreen-minted Blob URL via existing keepalivePort + base64 wire
  format (reuses D-12 precedent at src/shared/binary.ts).
- D-P2-02: meta.json url:string → urls:string[]; URL filter per CONTEXT.md
  <specifics> (include https://, chrome-extension://; exclude chrome://, about:,
  devtools://, file://); dedup + first-seen ordering.
- D-P2-03: full scope; 8-field strict schema validation with schemaVersion='2'
  as the 8th field (planner-resolved tentative pick; revisable by plan-checker).

Architectural constraints preserved:
- Always-on charter (Plan 01-09 Amendment 3): no finally-block in saveArchive;
  no clearTabUrlsSeen on SAVE.
- Tier-1 FORBIDDEN_HOOK_STRINGS = 12 (no new test-hook symbols).
- Never await import(...) in src/background/index.ts (Plan 01-11 SUMMARY).
- Pre-checkpoint bundle gates per feedback-pre-checkpoint-bundle-gates.md (run
  in 02-04 Task 4 before operator surface).

Plan validation: gsd-sdk frontmatter.validate + verify.plan-structure GREEN
for all 4 plans.

ROADMAP updated: Phase 2 Plans list + Goal/Success Criteria block annotated
with D-P2-02/D-P2-03 amendments + 5th success criterion (Blob URL + revoke
lifecycle for >2 MB archives); Progress table 0/TBD → 0/4.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 14:03:14 +02:00
cc042a5583 docs(02): capture phase context — discuss-phase complete
Phase 2 (Stabilize export pipeline) discuss-phase landed via inline canonical
workflow execution. 02-CONTEXT.md captures 3 locked decisions:

- **D-P2-01:** Offscreen-minted Blob URL pipeline replaces base64 data: URL
  download path (src/background/index.ts:709-710). SW Blob → offscreen
  URL.createObjectURL → SW chrome.downloads.download → URL.revokeObjectURL on
  onChanged. Closes audit P0-6. Unblocks real-archive size (>2 MB).

- **D-P2-02:** meta.json schema migrates singular `url: string` to plural
  `urls: string[]` capturing all tabs visible during the 30s recording window.
  Schema-breaking change requires REQUIREMENTS.md REQ-meta-json-schema
  amendment + SessionMetadata type update. Closes audit P1 #10 captured-URL bug.

- **D-P2-03:** Full Phase 2 scope = Blob URL migration + meta.urls schema
  migration + strict meta.json schema validation test + UAT harness A24+
  <5s latency assertion. ~3-4 plans expected.

Decision provenance:
- D-P2-01 rationale: user "up to you. If you think we need to migrate — good
  let's do it." Plus analysis: real archives EXCEED base64 cap.
- D-P2-02 rationale: user picked "All tabs' URLs as an array
  (meta.json.urls)" — highest informational fidelity for multi-tab bug
  reproduction. Privacy acceptable per "log is internal" v1 charter.
- D-P2-03 rationale: user picked "Full scope: bug fixes + schema + harness
  latency assertion".

Canonical references + code context + deferred items captured in CONTEXT.md.
Phase boundary explicit: not from-scratch; closes residual gaps after Plans
01-08/01-09/01-10/01-12 substantively shipped REQ-popup-ui + REQ-archive-
layout + REQ-screenshot-on-export.

Next: /gsd-plan-phase 2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 13:41:08 +02:00
6dbed91efd docs(roadmap): re-phase milestone — remove Phase 2 (DOM/event-capture privacy)
Per operator charter shift 2026-05-20: "we don't care about privacy hardening.
At least here." Archive flow is internal-only (no external transmission),
which reframes the password-masking P0-5 defect from privacy-regulation
gravity to operator-hygiene polish.

Re-phasing applied across 4 planning artifacts:

ROADMAP.md:
- Original Phase 2 ("Stabilize DOM + event-capture privacy") REMOVED entirely
  (summary list + Phase Details section + Progress table row).
- DOM + event-log VERIFICATION (REQ-rrweb-dom-buffer + REQ-user-event-log)
  ABSORBED by new Phase 3 (SPEC §10 smoke verification).
- Phase numbering: old 3 → new 2 (export), old 4 → new 3 (smoke), old 5 → new 4
  (optional harden). Dependency chains updated accordingly.
- Overview blurb + journey narrative + success criteria refreshed.
- Phase 3 (smoke) explicitly NOT-in-scope: P0-5 password masking dropped.

REQUIREMENTS.md traceability:
- REQ-rrweb-dom-buffer: Phase 2 → Phase 3 (verification scope; UAT harness
  A24+ extension planned).
- REQ-user-event-log: Phase 2 → Phase 3 (same context).
- REQ-password-confidentiality: Phase 2 → Out of Scope (v1) — DEFERRED per
  charter shift.
- REQ-popup-ui, REQ-screenshot-on-export, REQ-archive-layout,
  REQ-meta-json-schema, REQ-archive-export-latency: Phase 3 → Phase 2
  (renumbered; substantively shipped via Plans 01-08 + 01-09 + 01-12;
  residual gaps in Phase 2).
- Coverage: 10 mapped + 1 out-of-scope (was 11 mapped).

PROJECT.md:
- CON-sensitive-data-masking: DEFERRED 2026-05-20 (preserves audit trail
  via strikethrough; rationale documented).
- DEC-004 amendment: rrweb 5000-event cap retained; masking deferred. Cites
  rrweb 2.0.0-alpha.4 maskInputSelector→maskInputFn API change.

STATE.md:
- frontmatter total_phases: 5 → 4.
- stopped_at narrative captures the re-phasing event.

CLI bug note: this re-phasing was attempted via `gsd-sdk query phase.remove 2`
+ canonical `/gsd-remove-phase 2` Skill invocation, but BOTH paths produced
corrupted output (cascading rename via reverse-iteration loop at
phase.cjs:670-679 collapsed all subsequent phases to "Phase 2", plus a
mysterious "2026"→"2002" date corruption). Recovery applied as manual edits
in this commit. CLI bug logged as upstream GSD-framework concern; not a
Mokosh-side issue.

Plan: next is `/gsd-discuss-phase 2` (new Phase 2 = export pipeline; narrowed
scope per re-phasing — ~2-3 plans expected since Plans 01-08 + 01-09 + 01-10
+ 01-12 already shipped most surface).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 13:25:11 +02:00