refactor(01-04): remove stale 'Plan 04 wires this' comments now that it's wired

- Update module header to list port keepalive + OFFSCREEN_READY among
  the module's owned responsibilities (no longer "wired by Plan 04")
- Replace 'Plan 04 owns the ping loop' on PORT_NAME with the actual
  D-17 + Pattern 5 citation
- Replace 'Plan 04 fills the lifecycle' on keepalivePort with its
  D-17 + Pattern 5 role

Pure comment cleanup — no behavior change. All 9 tests still GREEN.
This commit is contained in:
2026-05-15 17:47:32 +02:00
parent b064a214b2
commit b0f4adcbd4

View File

@@ -2,8 +2,8 @@
// offscreen/index.ts and the inline string in vite.config.ts:13-216). // offscreen/index.ts and the inline string in vite.config.ts:13-216).
// Owns: getDisplayMedia capture, MediaRecorder lifecycle, in-memory ring // Owns: getDisplayMedia capture, MediaRecorder lifecycle, in-memory ring
// buffer with WebM-header retention + 30 s age trim, codec strict-mode, // buffer with WebM-header retention + 30 s age trim, codec strict-mode,
// track.onended cleanup. Port keepalive + OFFSCREEN_READY handshake are // track.onended cleanup, long-lived port keepalive (D-17), and the
// wired by Plan 04 in the matching wave-1 lane. // OFFSCREEN_READY handshake (Pattern 4).
import { OffscreenLogger } from '../shared/logger'; import { OffscreenLogger } from '../shared/logger';
import type { Message, VideoChunk } from '../shared/types'; import type { Message, VideoChunk } from '../shared/types';
@@ -13,7 +13,7 @@ export const VIDEO_BUFFER_DURATION_MS = 30_000; // 30 секунд
const VIDEO_MIME = 'video/webm;codecs=vp9'; // D-20 strict — no fallback const VIDEO_MIME = 'video/webm;codecs=vp9'; // D-20 strict — no fallback
const VIDEO_BITRATE = 400_000; // CON-video-codec const VIDEO_BITRATE = 400_000; // CON-video-codec
const TIMESLICE_MS = 2_000; // SPEC §4.1 const TIMESLICE_MS = 2_000; // SPEC §4.1
const PORT_NAME = 'video-keepalive'; // Plan 04 owns the ping loop const PORT_NAME = 'video-keepalive'; // long-lived port name (D-17, Pattern 5)
const PORT_PING_MS = 25_000; // < 30 s SW idle threshold const PORT_PING_MS = 25_000; // < 30 s SW idle threshold
const PORT_RECONNECT_MS = 290_000; // pre-empt the ~5 min port cap (Pitfall 4) const PORT_RECONNECT_MS = 290_000; // pre-empt the ~5 min port cap (Pitfall 4)
@@ -24,7 +24,7 @@ let videoRecorder: MediaRecorder | null = null; // renamed from 'mediaRecorde
let mediaStream: MediaStream | null = null; let mediaStream: MediaStream | null = null;
let videoBuffer: VideoChunk[] = []; let videoBuffer: VideoChunk[] = [];
let firstChunkSaved = false; let firstChunkSaved = false;
let keepalivePort: chrome.runtime.Port | null = null; // Plan 04 fills the lifecycle let keepalivePort: chrome.runtime.Port | null = null; // long-lived SW keepalive (D-17, Pattern 5)
// ─── Кольцевой буфер (pure functions — testable in Node) ──────────────── // ─── Кольцевой буфер (pure functions — testable in Node) ────────────────