Commit Graph

181 Commits

Author SHA1 Message Date
408aa3354c test(01-02): add RED handshake + port tests
Three RED tests pin Pattern 4 (handshake) and Pattern 5 / Pitfall 4
(port reconnect on disconnect) contracts:

handshake.test.ts:
- 'sends OFFSCREEN_READY after listener registration' — exactly one
  OFFSCREEN_READY emitted at module load, AFTER onMessage.addListener

port.test.ts:
- 'connects on module load' — chrome.runtime.connect called once
- 'reconnects when port disconnects' — firing onDisconnect triggers
  immediate re-connect (Pitfall 4 idle-timer reset)

chrome.runtime is stubbed locally (no vitest-chrome dependency added).
No 'as any' / no '@ts-ignore'; casts are 'as unknown as T'.

Plan 04 must wire OFFSCREEN_READY send + port.connect({ name:
'video-keepalive' }) + onDisconnect-driven reconnect at the import-side
effect layer of src/offscreen/recorder.ts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 17:25:03 +02:00
d7840a811c test(01-02): add RED codec-check tests
Two RED tests pin D-20 (codec strict-mode, no silent fallback):
- 'throws on unsupported vp9 and emits RECORDING_ERROR'
- 'does not throw when vp9 IS supported'

vi.resetModules() between tests is critical: module-load side-effects
(handshake + port connect) happen once per import, so isolation across
the four test files depends on it.

chrome.runtime is stubbed locally (no vitest-chrome dependency added,
per threat T-1-NEW-02-01 — minimize supply chain for four test files).
No 'as any' / no '@ts-ignore'; the cast is 'as unknown as T'.

Plan 03 must export assertCodecSupported() from src/offscreen/recorder.ts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 17:24:18 +02:00
2e73a21151 test(01-02): add RED ring-buffer tests
Four RED tests pin D-10 (header pinning) and D-11 (30s trim) contracts:
- 'first chunk is header' — isFirst marker on first addChunk
- 'second chunk is NOT header' — only the first is pinned
- 'trim 30s — keeps header, evicts aged tail' — header survives indefinitely
- 'trim with empty buffer does not throw' — defensive edge case

Plan 03 must export {addChunk, trimAged, getBuffer, resetBuffer} from
src/offscreen/recorder.ts to flip these to GREEN.

Also stages tests/fixtures/.gitkeep so the fixture dir survives clean
checkouts (Plan 07 drops a known-good last_30sec.webm into it after the
manual smoke test).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 17:23:50 +02:00
57fa29e36b test(01-02): add vitest.config.ts
- Node-environment test runner (Blob shimmed via undici in Vitest 4+)
- Scoped include: tests/**/*.test.ts (production code never picked up)
- typecheck disabled — tsc --noEmit runs separately via npm run build
- No path aliases (tsconfig.json defines none; relative imports used)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 17:23:14 +02:00
ebf015aa0d test(01-02): wave-0 setup — install vitest
- Add vitest@^4 to devDependencies (4.1.6 latest stable; 5.x still beta)
- Add "test": "vitest run" npm script
- Run npm install to refresh node_modules and lock file

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 17:22:51 +02:00
13b67f5136 docs(01-01): complete doc-cascade plan
Plan 01-01 (Wave-0 doc cascade) complete. Six tasks landed atomically
in commits 125c032, fb88830, b1ed2cb, 597d967, 32bc996, 4a5194e. Every
code-touching plan in Phase 1 (01-02..01-07) now reads a consistent
baseline: getDisplayMedia replaces tabCapture in DEC-003; long-lived
port replaces alarms in DEC-010; manifest.json carries the final
Phase-1 permissions set (desktopCapture, activeTab, downloads,
scripting, storage, offscreen).

SUMMARY: .planning/phases/01-stabilize-video-pipeline/01-01-SUMMARY.md
2026-05-15 17:19:48 +02:00
4a5194e15f docs(01-01): swap manifest permissions tabCapture->desktopCapture, drop alarms (D-A6/D-05)
Replace 'tabCapture' with 'desktopCapture' to match the new
getDisplayMedia capture path (D-A6). Remove 'alarms' because the
Phase 01 SW keepalive moves to a long-lived chrome.runtime.connect
port and the alarms code is deleted in Plan 05; declaring an unused
permission expands attack surface and is mitigated here per T-1-02.
activeTab is retained for chrome.tabs.captureVisibleTab in Phase 3,
and offscreen is retained for chrome.offscreen.createDocument.
2026-05-15 17:16:28 +02:00
32bc99642e docs(01-01): amend Phase 1 description + Success Criterion #2 per D-A5
Rewrite the Phase 1 one-liner in the Phases list to call out the
chrome.tabCapture -> getDisplayMedia swap, and rewrite Success
Criterion #2 to describe the new operator-selected screen/window
capture and the absence of tab-reattach logic. Phases 2-5 sections are
untouched. The verbatim phrase 'no tab re-attach logic' is preserved
as written in the plan to document the amendment in-place; the
original 'recorder re-attaches to the new active tab' wording is gone.
2026-05-15 17:16:07 +02:00
597d967ccf docs(01-01): amend REQ-video-ring-buffer per D-A4
Replace the REQ-video-ring-buffer bullet to bind the new
getDisplayMedia + offscreen-document acquisition path and drop the
'active-tab' wording (the new API is screen/window-scoped, not
tab-scoped, so there is nothing to re-attach on tab switch). Encoding,
buffer window, and SPEC §10 acceptance citations are unchanged. Adds
CON-display-capture-binding alongside the existing constraint bindings.
2026-05-15 17:15:24 +02:00
b1ed2cbf49 docs(01-01): amend PROJECT.md DEC-003/DEC-010 + Constraints per D-A3
Rewrite DEC-003 and DEC-010 rows in the Key Decisions table to reflect
the Phase 01 amendments (getDisplayMedia + long-lived port keepalive),
each citing the .planning/intel/decisions.md amendment block as the
canonical source. Swap the two Constraints bullets that cited
chrome.alarms keepalive and tabCapture binding for replacement
bullets bound to CON-display-capture-binding.
2026-05-15 17:14:59 +02:00
fb88830d29 docs(01-01): retire 2 constraints + add CON-display-capture-binding per D-A2
Append RETIRED blocks to CON-tab-capture-binding and
CON-service-worker-keepalive (the two SPEC-derived constraints that are
no longer valid under getDisplayMedia + port-keepalive). Add new
CON-display-capture-binding consolidating the replacement contract.
Originals stay intact for provenance; RETIRED is appended below each.
2026-05-15 17:14:15 +02:00
125c032656 docs(01-01): amend decisions.md DEC-003/DEC-010 per D-A1
Append Amendment blocks to DEC-003 (getDisplayMedia replaces tabCapture)
and DEC-010 (long-lived port replaces alarms keepalive) so downstream
phases see the new API contract. Original text intact; amendments are
appended, not replacements. Maintains intel/* provenance for the
Phase 01 doc cascade.
2026-05-15 17:13:39 +02:00
acb9033293 docs(01): record Phase 1 planning complete (7 plans, 7 waves)
After gsd-plan-phase 1: 7 plans across 7 waves. All gates pass:
- Plan-checker (sonnet) VERIFICATION PASSED on iteration 1
- Decision coverage gate (gsd-sdk): 19/19 decisions covered
- Requirements coverage: REQ-video-ring-buffer in all plans
- Security threat model: T-1-01/02/04 mitigated; T-1-03 accepted residual

Known non-blocking gaps:
- gsd-sdk roadmap.annotate-dependencies failed (t.trim is not a function);
  ROADMAP plan-list annotations skipped. Phase 1 plan-list in ROADMAP.md
  remains accurate; this is a cosmetic nice-to-have for cross-cutting
  constraint visibility.
- 1 plan-checker warning (stale wave prose in Plan 03/04 objectives) was
  fixed during decision-coverage revision.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 17:09:09 +02:00
0811c6a292 docs(01-01): cite D-05 in must_haves per coverage gate .planning/phases/01-stabilize-video-pipeline/01-01-PLAN.md 2026-05-15 17:07:49 +02:00
576280f6aa docs(01): mark Open Questions RESOLVED in research per checker iteration 1
Renames "## Open Questions" header to "## Open Questions (RESOLVED)" and
adds inline RESOLVED markers to each of the three questions:
- Q1 (MediaRecorder timeslice cluster alignment) → D-12 ffprobe gate
  (Plan 03 Task 2 + Plan 07 Task 1) + D-13 fallback (pre-staged skeleton
  in src/offscreen/recorder.ts per Plan 03)
- Q2 (5-minute port lifetime cap) → Plan 04's 290 s pre-emptive reconnect
  plus synchronous onDisconnect → connectPort reconnect path
- Q3 (crxjs path-emit behavior) → Plan 06 Task 2 runtime verification +
  conditional src/background/index.ts edit

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 16:50:40 +02:00
519a0d8a99 docs(01): revise plan 07 wave + ffprobe verify guard per checker iteration 1
Two changes:
1. wave: 3 → 6 (cascade: max(wave(05)=4, wave(06)=5)+1 = 6).
2. Task 1 <automated> verify now prefixes the ffprobe invocation with
   test -f tests/fixtures/last_30sec.webm && which ffprobe so the gate
   fails fast with a clear signal if the human checkpoint never produced
   the fixture (instead of ffprobe blowing up with a cryptic file-not-found).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 16:50:32 +02:00
61c3e03069 docs(01): revise plan 06 depends_on per checker iteration 1
Three changes to resolve the blocker:
1. depends_on: ["03"] → ["03", "05"] — Plan 06 Task 2 conditionally edits
   src/background/index.ts which Plan 05 writes; the original wave 2
   collocation with Plan 05 was a same-wave file conflict.
2. wave: 2 → 5 (cascade: max(wave(03)=2, wave(05)=4)+1 = 5).
3. files_modified gains src/background/index.ts (Task 2 path-adjustment
   edit is now declared in frontmatter so the executor sees the contract).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 16:50:26 +02:00
51890b0bc4 docs(01): revise plan 05 wave per checker iteration 1 cascade
Plan 05 depends_on: ["03", "04"], so wave must be max(2, 3)+1 = 4, not 2
(cascade from Plan 04 wave change).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 16:50:19 +02:00
e55c1ae5d6 docs(01): revise plan 04 wave per checker iteration 1
Plan 04 depends_on: ["02", "03"], so wave must be max(1, 2)+1 = 3, not 1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 16:50:10 +02:00
b8219af5b9 docs(01): revise plan 03 wave + OffscreenLogger strict-mode per checker iteration 1
Two changes:
1. wave: 1 → 2 (cascade after Plan 02 wave fix)
2. OffscreenLogger: ...args: any[] → ...args: unknown[] for strict-mode
   hygiene. Existing Logger / ContentLogger are left on the legacy any[]
   pattern (refactoring is out of Phase 1 scope) — divergence documented
   via style_divergence_note frontmatter field.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 16:50:05 +02:00
c24fcda818 docs(01): revise plan 02 wave per checker iteration 1
Plan 02 depends_on: ["01"], so wave must be max(wave(01)=0)+1 = 1, not 0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 16:49:59 +02:00
74ff472811 docs(01): add scope_exception to plan 01 per checker iteration 1
Documents that all 6 tasks are doc-text-only edits with no TypeScript
compilation — cognitive load is substantially lower than code plans of
equal task count. Avoids fragmenting the atomic doc-cascade by splitting
into 01-01a / 01-01b.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 16:49:54 +02:00
178fdd5b77 docs(01): create phase 1 plans for video pipeline stabilization .planning/phases/01-stabilize-video-pipeline/01-01-PLAN.md .planning/phases/01-stabilize-video-pipeline/01-02-PLAN.md .planning/phases/01-stabilize-video-pipeline/01-03-PLAN.md .planning/phases/01-stabilize-video-pipeline/01-04-PLAN.md .planning/phases/01-stabilize-video-pipeline/01-05-PLAN.md .planning/phases/01-stabilize-video-pipeline/01-06-PLAN.md .planning/phases/01-stabilize-video-pipeline/01-07-PLAN.md .planning/ROADMAP.md 2026-05-15 16:37:45 +02:00
094eef0307 docs(01): add validation strategy .planning/phases/01-stabilize-video-pipeline/01-VALIDATION.md 2026-05-15 16:10:12 +02:00
36a323718c docs(01): research phase 1 domain — getDisplayMedia + offscreen + ring buffer
Researched Chrome MV3 offscreen + DISPLAY_MEDIA, MediaRecorder cluster
alignment, SW port keepalive, crxjs offscreen entry, ffprobe verification.
Identified the D-12/D-13 fallback hinge: timeslice=2000ms does NOT force
keyframe alignment (Chrome kf_max_dist=100); Pattern 2 (age-trim) may need
to escalate to Pattern 3 (restart-segments) if ffprobe rejects.

Architecture verified against two in-the-wild production extensions
(Proscreen-S3, meeting_mate) using the exact CONTEXT.md D-01..D-05 path.
The OFFSCREEN_READY handshake (audit P1 #12) and long-lived port keepalive
(audit P1 #8) are wired together. .planning/phases/01-stabilize-video-pipeline/01-RESEARCH.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 16:08:04 +02:00
4909f3155a docs(state): record phase 1 context session .planning/STATE.md 2026-05-15 15:40:51 +02:00
05f7d1bf64 docs(01): capture phase 1 context — desktopCapture pivot + offscreen consolidation .planning/phases/01-stabilize-video-pipeline/01-CONTEXT.md .planning/phases/01-stabilize-video-pipeline/01-DISCUSSION-LOG.md 2026-05-15 15:40:44 +02:00
4ba318876b chore: configure GSD for maximum-rigor remediation
Settings chosen for the Mokosh stabilization work:
- model_profile: quality (Opus everywhere except verification)
- git.branching_strategy: phase (gsd/phase-{N}-{slug} per phase)
- workflow.code_review: true with depth=deep (cross-file analysis with
  import graphs — appropriate given the SW ↔ offscreen ↔ content-script
  messaging interplay)
- workflow.tdd_mode: true (RED/GREEN/REFACTOR gates for eligible tasks,
  retrofits regression coverage as we touch each file)

All other settings inherit gsd-sdk defaults (research/plan-check/verifier
on, balanced commit_docs, no Intel/Graphify indexing yet).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 15:23:53 +02:00
c0cb02a24f chore: track .ingest-manifest.yaml used by /gsd-ingest-docs
Preserves the explicit-manifest input used to bootstrap .planning/ so the
ingest is reproducible. Two docs were classified: Тз расширение фаза1.md
(SPEC, precedence 0) and README.md (DOC, precedence 1).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 15:17:18 +02:00
89ca09ccec docs: bootstrap .planning/ via /gsd-ingest-docs (2 docs) /home/parf/projects/work/repremium/.planning/PROJECT.md /home/parf/projects/work/repremium/.planning/REQUIREMENTS.md /home/parf/projects/work/repremium/.planning/ROADMAP.md /home/parf/projects/work/repremium/.planning/STATE.md /home/parf/projects/work/repremium/.planning/intel /home/parf/projects/work/repremium/.planning/INGEST-CONFLICTS.md /home/parf/projects/work/repremium/.ingest-manifest.yaml 2026-05-15 15:16:30 +02:00
555eb0543f chore: import broken Phase-1 extension as received
Snapshot of /home/parf/Downloads/manifest.zip as delivered, before any
GSD-driven remediation. Contains a partially-broken first attempt at the
Russian SPEC "Тз расширение фаза1.md" (Phase 1 of operator-session-recorder).

Source layout:
- manifest.json — MV3 declaration with tabCapture/activeTab/downloads/etc.
- src/background/index.ts — service worker (video buffer + archive packaging)
- src/content/index.ts — rrweb + user-event logger
- src/popup/{index.html,index.ts,style.css} — Russian popup UI
- offscreen/{index.html,index.ts} — orphaned offscreen (see audit)
- vite.config.ts — inline plugin emitting a separate live offscreen.js
- generate-icons.js, icons/ — minimal PNG icons
- "Тз расширение фаза1.md" — authoritative Russian SPEC

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 15:16:23 +02:00