2.0 KiB
Phase 4 plan
Start: cd4a25a, codex/phase3; branch codex/phase4. Master §§3.4, 2c.5, 6/6b and accepted answer03 apply.
First perform scope-resolved declaration/reference analysis and record rankings in phase4-seams.md. Commit this plan before source changes.
Implement at most six seams, one green commit each: eager shell/shared renderer files first, then Presenter, Remote, Watch party, Share/External, Stats view. Exact declarations/bytes and synchronous hooks are in phase4-seams.md. Add groups (contract 1), preserve old SHELL compatibility, mirror inert native JSON, extend Lazy.proxy to window.YT registration. Keep player, queue, persistence, boot and required eager features in RAM. Maintain native/Web fallbacks and URL-driven/resumed sessions.
Tests first: protected playback source fingerprints, eager load-order/manifest consistency, registry proxies and browser cache smoke coverage. After every seam run frontend tests, server bun install/test, hidden-timers, and both-engine cached feature smoke. Use isolated Bun/proxy scratch data, not production. Then run existing lazy/offline/staged guard checks and reduced LTE baseline; add a split-feature update scenario that waits for its background download and proves no unrelated assets transfer. Save actual results and compare with Phase 3/after-phase0.
Targets: app.js ≥30% raw-byte reduction from 587,029; lower Chromium long-task total; a chunk edit downloads only that chunk plus derived index/manifest/worker checks. WebKit has no long-task observer; report that limit and existing paint regression honestly.
Risks: classic-script TDZ; synchronous playback hooks must forward without promises; duplicate UI boot/event listeners; stale singleton replacement forbidden. No live replacement without disposal/state handoff. Rollback each seam by reverting its commit; ASSET_SYNC=0 and ASSET_HASHING=0 still supported. Finish self-review against master 6/6b, ≤350-word phase4-report, commit, then overwrite DONE04 signal. Real iPhone audio/quota checks remain manual. No deployment.