Repository navigation
App review 2026-07-10: resolve all 81 findings - #146
Merged
Merged
Conversation
#87) The WebGPU spec requires copyExternalImageToTexture destinations to carry COPY_DST and RENDER_ATTACHMENT usage. The probe texture only had COPY_DST | TEXTURE_BINDING, so every spec-conformant Chrome popped a validation error and the probe returned false — silently disabling the WebGPU tier app-wide and starting the backend ladder at WebGL2. Adds a spec-conformant mock-device unit test that enforces the usage rule (red without the flag) and a real-Chromium browser test asserting the end-to-end probe passes on any host with a working adapter. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…e banner (#90) The early `if (err) return <Banner/>` replaced the whole JobPage — header, sync panel, retry/download/delete — with one bare error line that could never be cleared. Render the error through the existing inline banner inside the normal layout instead, and give it a Dismiss affordance so the user can clear it without leaving the page. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…140) computeAudioStartOffset, shouldRescheduleOnTick, loopWrapTime and shouldArmCrossfade modeled the pre-ping-pong single-<audio> scheduler and had zero non-test consumers (verified by repo-wide grep). Their green unit tests falsely signaled live, covered code, and the module header described loop-wrap semantics that no longer match the real walker in useAudioMaster.ts. Keep LoopRegion/TrimRegion and clampLoopRegion — still imported by store.ts, io-points.ts and arrangement-loop.ts — and rewrite the header to describe only what remains. (Moving the types into types.ts was deliberately skipped: store.ts/io-points.ts belong to other work streams in this review round.) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…the sync forever (#81) decodeMp4AudioStreaming's `ready` promise was only settled by mp4box's onReady/onError — but mp4box never fires either for a cleanly truncated recording (missing or cut-off moov parks it silently in ERR_NOT_ENOUGH_DATA). The classic crashed-phone-recording therefore blocked `await ready` forever: no rejection, no ffmpeg fallback, sync panel stuck at "syncing-cam-N" with no banner. Three guards, mirroring webcodecs/demux.ts: - locateMoov() === null → throw "moov box not found" before streaming the (potentially multi-GB) body — fail fast, no wasted disk reads. - after EOF + flush(), if `ready` never settled → throw instead of awaiting a promise that can never resolve. - `ready.catch(() => {})` so fail-fast throws don't leave an unhandled rejection when mp4box rejects `ready` afterwards. Browser tests build truncated fixtures by slicing tone-3s.mp4's real bytes (ftyp+partial-mdat, moov cut mid-box, oversized body) and assert rejection < 2 s; a control asserts the valid fixture still decodes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… MEMFS temp files (#117) @ffmpeg/ffmpeg 0.12's exec() resolves with the exit code instead of rejecting, so a failed transcode fell through to a blind readFile: the user saw an opaque Emscripten "FS error" instead of ffmpeg's actual reason, and the deleteFile cleanup (not in a finally) was skipped — leaking the full input bytes in the singleton's MEMFS on every retry until the tab OOMs. - capture the last 12 ffmpeg log lines via ffmpeg.on("log") and throw "transcode failed (exit code N) — ffmpeg says: …" on rc !== 0, so the sync-failure banner names the real cause, - move both deleteFile calls into a finally block (best-effort per file, since either may not exist depending on where the failure happened), - detach the log listener in the same finally. Browser tests: garbage input rejects with exit code + stderr context (not "FS error"); MEMFS root has no input-*/output-* leftovers after two failed decodes nor after a successful one. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
JobPage now subscribes to the job's render op: the Quick render button disables and shows 'Rendering… N%', a stage+pct progress console appears under the sync panel, and the status badge flips to 'rendering'. A synchronous pending flag covers the gap before the op reaches the store, so a double click can no longer start two renders. quickRender itself gets a single-flight lock (mirroring runEditRender's activeRenders check) so concurrent encodes can't race into the same output file. Render stage labels move to a shared render-stages module used by both RenderScreen and JobPage. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… out (#89) segmentIndexAtArr is half-open, so a loop.end sitting exactly on an interior segment boundary resolved into the FOLLOWING segment and nextLoopWrapMasterT parked the wrap at nextSeg.in — the first sample of a chunk the loop doesn't contain. The walker (wrapHere gated on wrapInSegIdx === curIdx) then armed a segment HOP instead: every loop pass audibly bled the next chunk's head, crossed the drawn loop band, and fired a second zero-lead crossfade back to loop.start against a still-seeking idle element. Reachable systematically: clampLoopToBounds pins loop.end to exact seam arr-values via masterToArr's edge fallback. nextLoopWrapMasterT now treats an interior-seam loop.end (within 1e-9 s of the containing segment's arr start) as end-of-previous-segment: wrapInSegIdx = idx - 1, wrapAtMasterT = segments[idx-1].out. Tests: three new geometry cases in arrangement-loop.test.ts (seam, first-seam, strictly-inside control) — red before, green after — plus a walker-level jsdom test that the idle is parked at the loop target, not the next chunk's head. The existing duplicate-chunks walker test gained a distinct tail chunk: without one, the trim projection had silently clamped its loop to the seam, so it now exercises what its comment always claimed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…he rejection forever (#118) getFfmpeg() memoized the in-flight load promise but never cleared it on rejection. One flaky fetch of the ~25 MB core made every later ffmpeg fallback (mkv/flac/AC-3, WebCodecs-refusing files) reject instantly with the stale network error — even after connectivity returned — until a full page reload. - clear the memo when the load rejects (guarded against racing a newer load), so the next decode retries, - wrap core-download failures in an actionable message ("Could not download the media decoder (~25 MB) — check your connection and retry." + underlying cause), - terminate the half-initialized worker before rethrowing so a retry starts clean. Unit tests (mocked @ffmpeg/ffmpeg + toBlobURL) pin: success memoized once; fetch failure retried with fresh downloads; failure message names download + cause; load() failure also retryable. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…d end-pause (#76) Hop-arming required distToEnd > 0, so if no RAF tick landed inside the 50 ms lead window before a segment's out (GC pause, heavy main-thread work, hidden tab), t crossed the boundary un-armed with no recovery: the authoritative segment index is deliberately never invalidated for a valid idx, the gap branch needs curIdx === -1, and the end-pause branch had the same > 0 lower bound. The active element then free-ran into master material outside the arrangement — with a loop active this plays wrong audio until the extrapolated arr-time crosses loop.end (matching the intermittent long-form loop-offset report); without one it sails to the end of the file. Mirror the loop-wrap path's overshoot tolerance: arm the hop whenever distToEnd <= LEAD_TIME_S (including <= 0) with fireAtCtxTime = ctx.currentTime + max(0, distToEnd), and drop the lower bound on the end-pause branch too (its timer already clamps to 0 ms). Tests: two new jsdom cases simulating the stall (t jumps from inside the segment straight past out) — hop recovery parks + plays the idle at the next chunk's head; last-segment overshoot still schedules the pause. Both red before, green after. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ts (#78) compositeImage() now takes a required FrameTimes struct ({tTimelineS, tMasterS}) instead of a single optional trailing time param, making the time-axis contract explicit: FX windows + envelopes read the timeline axis, beat grid + sidechain follower read the master axis — mirroring the preview's buildFrameDescriptor split. editRenderMulti threads the per-frame tMaster (previously discarded) through to the compositor; the single-cam path passes tS for both axes. Direct-mode FX lookups now use master-time instead of the re-accumulated segment cursor. New compositor-times.browser.test.ts pins all three axes (FX window vs timeline, sidechain vs master, beat-synced LFO vs master); the removed '?? t' fallback can no longer silently revert exports to output-time lookups. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…NDER badge or FAIL after cancel (#92) Badge + progress derivation moves into a pure history-model module: a done render op is terminal (falls through to DONE via lastRender), error:'cancelled' is a deliberate cancel and no longer branded FAIL, and progress bars only show for ops that are actually moving — no frozen 100% bar for the rest of the tab session. RenderScreen now clears the op when it navigates away after done and after a cancel, and JobPage clears it after a successful quick render, so the ops store's clear-on-terminal contract actually happens. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…recovery, capability downgrade (#115) The WebGPU rung of the backend ladder had no failure handling: a rejecting WebGPUBackend.init() propagated into a permanent 'Compositor failed' overlay, the session-cached probe result kept saying webgpu=true so remounts re-failed until a full reload, and device.lost was never observed — a mid-session GPU loss froze the preview silently. - factory: wrap the WebGPU branch in try/catch, dispose the half-initialised backend, and fall through to WebGL2 (mirroring the existing WebGL2→Canvas2D fallthrough). - capabilities: new markWebGPUUnavailable() poisons the probe cache and flips the initialised singleton, so getCapabilities()/probeWebGPU() report webgpu=false for the rest of the session. - WebGPUBackend: subscribe to device.lost (ignoring the intentional 'destroyed' dispose path), downgrade the capability, and surface the loss via the new optional CompositorBackend.onContextLost hook; also log uncapturederror events. - PreviewRuntime: on context loss stop the RAF, dispose the dead backend (ticks no-op safely), and notify the new onBackendLost option. - Compositor.tsx: remount the canvas via an epoch key on loss — the canvas's context mode is fixed on first getContext, so the WebGL2 fallback needs a fresh element; the rebuilt ladder starts at WebGL2. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…127) The resilience logic of the codec resolver — the reason the ladder exists — had zero coverage: only valid-fixture / forceBackend happy paths ran. New coverage pins the routing decisions: Unit (stubbed sub-decoders, jsdom): - streaming failure on a small Blob falls through to WebCodecs, - >= 500 MiB streaming failure surfaces directly with NO fallback (whole-file retry would OOM) and touches no other backend, - the /webkit|webcodecs/i err.name give-up gate: matching names skip ffmpeg entirely, ordinary names (EncodingError) reach it — a Chromium error-name change now fails loudly instead of silently killing the fallback, - the aggregated three-backend error message names every attempt. Browser (real Chromium, DEFAULT route, no forceBackend): - ALAC-in-M4A (new 53 KB fixture tone-alac.m4a, ffmpeg-generated 440 Hz sine) is undecodable by AudioDecoder and decodeAudioData but lands on backend "ffmpeg-wasm" with correct audio — the real failure-triggered route odd recordings take, - a moov-less truncated recording rejects (no hang) with the JobPage banner text naming ffmpeg/webcodecs/streaming and the moov cause. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ects (#71) Re-detection now reconciles via an overlap-based merge instead of exact-boundary matching: detector chunks inherit id / accepted / bpmOctaveShift from the auto chunk they overlap most (>= 50% of the shorter side), user-shaped chunks (trims, splits, joins, slices, inserts) are preserved verbatim with contested fresh chunks dropped, and only genuinely vanished regions leave the list — so a 1 dB nudge no longer resurrects DROPs, wipes KEEPs, or prunes the arrangement through id churn. The first re-detect in a session with downstream work (persisted arrangement or manual edits) is gated behind the same confirmDestructive() dialog as the other destructive actions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…med wrap (#77) The end-pause branch was not gated on state.armed === null. With a loop ending at (or within the 50 ms lead window of) the last segment's out, the tick AFTER wrap-arming skipped the loop block and the hop if (both guarded on armed) and fell into the end-pause else-if, scheduling setTimeout(setPlaying(false), distToEnd). The crossfade then fired sample-accurately on the audio thread, but nothing on the swap path cancelled that timer (cancelEndPause was only reachable via cancelArmedCrossfade) — so 'loop the last chunk' played one pass and stopped, intermittently (whenever a tick landed in the (0, 50 ms] window after arming). Gate the end-pause branch on state.armed === null and cancel any pending end-pause in the crossfade swap block, so a fired wrap always clears a stale pause. Test: extended 'loop end at last-segment.out — wraps instead of pausing' to actually fire the crossfade and advance real time past the stale timer's deadline — it asserted isPlaying only immediately after arming before, which is why the bug slipped through. Red before, green after. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… or direct navigation (#93) A missing render op used to default to a live-looking 'Rendering… 0% / Preparing' console with a ghost Cancel button — forever, since renders die with the tab. After a short grace window (the op appears a beat after the editor navigates here), the screen now says 'No render in progress', explains that renders don't survive a reload, and offers 'Back to editor' as the primary action plus a Job-overview exit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… trim (#79) buildEditSpec's trim slices dropped their arrStartS, so the export re-accumulated arr-time from 0 at the trim point: with a leading trim of Δ seconds the picture resolved pills/cuts/FX Δ seconds early while the audio correctly played from the trim point — a constant Δ-second A/V content desync plus wrong FX resolution across the whole file. Segment now carries arrStartS (the slice's start on the FULL editor arrangement axis); buildEditSpec populates it from sliceByArrSegments and editRenderMulti uses it as the per-segment arr base (accumulation stays as the fallback for arrangement-less callers). Direct-mode FX/ overlay lookups already moved to master-time in the #78 commit. Tests: store.test.ts pins arrStartS on trimmed slices; a new verify-export browser test renders a master-trimmed pill arrangement and asserts the exported frames show the pill at the editor's arr-position (pre-fix it showed the song's beginning). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…fmpeg core cache (#116) Two SW-update hazards, both config-level: 1. registerType "autoUpdate" → "prompt". autoUpdate forces skipWaiting + clientsClaim into the generated SW: a GitHub-triggered deploy landing mid-session activated the new SW immediately, cleanupOutdatedCaches purged the old hashed lazy chunks (ffmpeg fallback, streaming decoders, export worker), and the container deploy means the server no longer has them either — first Export / add-cam after the deploy died with "Failed to fetch dynamically imported module". With "prompt" the new SW stays waiting until the old session's tabs close: live sessions keep their fully-precached build, fresh sessions get the new one. Trade-off: an always-open tab updates only after being closed once — acceptable vs. bricking mid-edit sessions. (Verified in dist/sw.js: skipWaiting only inside the standard SKIP_WAITING message hook, no clientsClaim.) A refresh-banner UI could later hook this via virtual:pwa-register, deliberately not added here to keep the change config-only. 2. /ffmpeg-core/* is CacheFirst for a year on unversioned URLs, so a core upgrade never reached existing users while the hashed wrapper JS updates every deploy — a permanent wrapper/core mismatch. The loader now appends ?v=<@ffmpeg/core version> (injected via Vite define from the installed package.json): the cache busts exactly when the core changes, with zero redundant re-downloads otherwise (unlike StaleWhileRevalidate, which would re-fetch ~31 MB per session). maxEntries: 8 evicts entries of old versions. Unit test pins the versioned URL shape; browser ffmpeg tests confirm the query URL loads against a real server. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
After a render the job page now shows the output MP4 in an inline <video controls> panel — fed by the same OPFS object URL as the Download link — so watching the cut no longer requires leaving the app. Panel carries the render timestamp in the label row. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…er frames (#138) drawFrame uploaded every layer's pixels into ONE shared layerTex and wrote every layer's uniforms into ONE buffer, while the render-pass draws were only recorded and submitted after the loop. Queue-timeline ops (copyExternalImageToTexture / writeBuffer) execute at call time — before the recorded draws — so any 2+-layer descriptor drew every layer with the LAST layer's pixels and fitRect/uvMat, and mismatched source dims destroyed the texture mid-loop, failing the whole submit with a destroyed-texture validation error (black frame). WebGL2 renders the identical descriptor correctly, so this silently broke the per-frame GPU-backend parity invariant for any future crossfade/PiP/dual-layer descriptor. Each drawn layer now gets its own pooled texture (keyed by slot, lazily resized) and its own tiny uniform buffer, so recorded draws capture their own state. Browser tests pin two-layer frames with same-size and different-size sources to the WebGL2-equivalent result. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…o longer clip the target's head (#80, #104) Every crossfade-arming path seeked the idle <audio> to the EXACT wrap target and play()'d it at ARM time, while the gain ramp that makes it audible fires up to LEAD_TIME_S (50 ms) later. A MediaElementAudioSourceNode keeps pulling samples at gain 0, so at the moment the ramp fired the idle's content sat at target + (lead − playStartupLatency) ≈ target + 20–40 ms — every loop pass clipped the loop-start downbeat by a RAF-phase-dependent amount (audible per-pass groove shift) and every long-form chunk seam clipped the incoming chunk's head. #80 and #104 are the same defect observed at the hop and wrap arming sites respectively; one mechanism, one fix. Compensate the pre-roll: new pure helper armParkMasterT(target, dist) parks the idle at target − max(0, dist) (clamped ≥ 0) so its clock sits on the target at fire time. Residual error is the play() startup latency, now pointing at material BEFORE the target — far less audible than a clipped transient for beat-anchored material. The four duplicated arming blocks (lead-window wrap, immediate wrap, OP-1 deferred wrap, segment hop) are folded into one armCrossfade helper so the compensation lives in exactly one place. Tests: unit tests for armParkMasterT (lead, negative-dist, clamp-at-0) plus walker-level tests asserting the exact compensated park position at wrap arming (11.97 for target 12 armed 30 ms early) and hop arming (29.96 for seam 30 armed 40 ms early). All red before, green after; the pre-existing coarse park assertions (±0.05) still pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…tive (#72) Two layers: the detection sliders freeze (solid-cold fill, no glow, 'decoding audio…' hint) while pcmDecoding is true, so a slider touch in the seconds-long decode window of a cached long-form open can no longer run an analysis-less detection. Independently, the overlap merge now carries the prev chunk's analysis (detectedBpm, confidence, stability, bar-grid anchor) into matched fresh chunks that came back without PCM, and re-snaps their raw silence-boundary end to the carried bar grid — so even an analysis-less detection keeps bar rulers, snap, extend-by- bars and the min-bars filter intact. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ed PWA can sync offline (#130) The precache glob had no `wasm` (and no `png`), and the only runtimeCaching rule matches /ffmpeg-core/ — so the hashed sync_core_bg-*.wasm the sync worker's wasm-bindgen glue fetches from /assets was cached nowhere. An installed PWA opened offline (rehearsal room, venue without Wi-Fi) got through the app shell, upload, and job creation, then bricked at the sync phase on that one fetch. Add wasm,png to globPatterns: pulls in the ~330 KB sync core plus the three manifest icons (~47 KB) — precache grows 1835 → 2204 KiB, an acceptable app-shell cost. ffmpeg-core's ~31 MB wasm remains excluded via the existing globIgnores and keeps its on-demand CacheFirst rule. Verified in the built dist/sw.js manifest: assets/sync_core_bg-*.wasm and pwa-icon-*.png present, ffmpeg-core absent, 40 precache entries. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ShowwavesVisualizer/ShowfreqsVisualizer index PCM/energy decoded from the FULL master audio, and text overlays are authored at the editor's playback.currentTime (master axis) — but the export compositor drew both at the output-relative muxer timestamp. As soon as segments drop or trim material, output time diverges from master time and the burned-in waveform/EQ/overlay shows the wrong section of the song for the entire file. compositeImage now hands FrameTimes.tMasterS to visualizer draw() and renderOverlays(); the Visualizer.draw contract is documented as master time. Browser tests pin both: a recording fake visualizer receives tMasterS (not timestampUs/1e6, not tTimelineS), and a text overlay windows on the master axis. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The per-card trash button was opacity-0 until hover — invisible on touch devices (no hover) and for keyboard focus, yet still hit-testable, so taps on the card corner fired a surprise confirm. It is now always visible with solid colors (paper chip, danger on hover) and gets a focus-visible outline. Deletion goes through the app's ConfirmDialogHost (confirmDestructive) instead of window.confirm, naming the job being deleted. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ong side (#137) Seeks arriving before loadedmetadata are stashed in pendingSeekRef and replayed in the A-side metadata handler — which always wrote refsStable.a.current.currentTime. The ping-pong state survives audioUrl changes (the WebAudio graph is cached per element and stateRef only resets on a fresh graph build), so after an odd number of crossfade swaps the audible side is B: the replayed seek landed on the muted idle A while the store had already cleared seekRequest — playback silently resumed from B's stale position. The live-seek path already picked the active side; the replay path now does the same. Test: drives one wrap swap (active → B), swaps the audio URL in place, seeks before metadata, fires loadedmetadata — asserts the stashed seek lands on B and not on A. Red before, green after. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ore take-1.mp4.mp4 (#142) The download name was built as `${title}.mp4`, but titles default to filenames, producing a double extension. New shared filenames helper strips a trailing extension (letter-bearing, 1-5 chars — version suffixes like 'Take 1.2' survive) before appending exactly one .mp4. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
#107) Video allocated round(segDur*fps) frames per segment independently while audio is concatenated sample-exactly — identical off-grid chunk durations (the bar-grid long-form case) all round the same direction, so A/V desync grew ~16.7 ms per chunk boundary at 30 fps and crossed the lip-sync threshold within a handful of chunks. Timestamps were additionally stamped as framesEmitted*round(1e6/fps), truncating 33333.33→33333 µs (~18 ms drift per 30 min). New pure module frame-timing.ts: planSegmentFrames() derives counts from cumulative kept-duration targets (round(cumKeptS*fps) − framesEmitted) so errors cancel and video length tracks audio within half a frame at every boundary; outputTimestampUs() rounds the exact product per frame. editRenderMulti uses both; totalFrames now equals the actual plan sum. Unit tests pin the 93-BPM bar-grid case (40 chunks: 3097 frames, not 3080), the half-frame adversarial case, and the 30-min timestamp drift. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
) DetectionPanel no longer writes to IDB itself — its old persist() snapshotted the store at slider time and wrote the OLD chunk list paired with the NEW silenceConfig 250 ms later. useTriagePersist is now the single writer; it fingerprints chunks + silenceConfig together after the detection resolves. A generation counter discards stale detections that resolve after a newer one (slow-drag out-of-order races), and the persist hook FLUSHES its pending debounced write on unmount instead of cancelling it — so "tweak a slider, quickly hit Back / Continue" can no longer leave IDB with chunk ids the freshly written arrangement references but job.chunks never contained. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ermanent failure (#124) The write-failure path only console.warned and claimed 'we'll retry on the next change' — but nothing was scheduled, so a transient IndexedDB failure (QuotaExceededError, connection closed by another tab) after the user's last change lost the edit silently. persistSnapshot now retries on a bounded 1s/2s/4s backoff, upgrades each retry to the store's current state (never overwrites newer edits with a stale snapshot), and after the final attempt pushes a visible editor notice ('Saving failed — recent edits may be lost on reload'). Adds the previously-missing hook-level loss-window coverage: transient failure retries without a further user change, retries are bounded and surface a notice, and a retry picks up fresher state after an interleaved edit. (The unmount/pagehide flush windows were covered in the #120 commit.) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…gth (#103) shiftPillSource clamped sourceInS to 0 and sourceOutS against the PRE-shift sourceInS independently, so a clamped nudge moved the two edges by different amounts — the source window shrank while the arr window stayed put, breaking the 1:1 arr<->source mapping (preview ran off-rate with drifting alignment; export diverged from preview). The same stale-in pattern lived in setClipSyncOverride and setSelectedCandidateIdx (poisoning the RESET baseline) and in setPillSourceOffsetMs. All sites now clamp the SHIFT once (applied = max(delta, -inS)) and move both edges by the applied amount, via shared clampSourceShift / shiftPillSource / shiftPillOriginalSource helpers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…#135) Cut.atTimeS is timeline-time (valid range [0, totalArrDuration]) but the drag clamp used jobMeta.duration — the master-audio length. Duplicated chunks (song longer than session) made the song's tail unreachable for cut drags; a short song assembled from a long jam let cuts be dragged far past the song's end into dead arr-space. Clamp now runs against totalArrDuration(arrangementSegments), with the master-duration fallback only for pre-load empty segments where both axes coincide. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…emo deps (#136) camStatusByCamId called activeCamId(timelineT) — a function of pills, arrangementSegments and timelineT — but memoized on [clips, cuts, currentTime] only. While paused, dragging/trimming/resetting a pill under the playhead changed the active cam without recomputing the memo, so the lane header kept the old cam's ON-AIR LED until the next seek/play. Deps now include pills, arrangementSegments and timelineT; during playback timelineT ticks with currentTime, so the deliberate 60 Hz narrowing is unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
addVideoToJob/addImageToJob derived the new cam id from videos.length, but removeCamFromJob keeps survivor ids stable (no renumbering) — so [cam-1, cam-2, cam-3] → delete cam-1 → add produced a SECOND 'cam-3': the editor's live-update handler treated the newcomer as the existing cam-3 (overwriting its sync/trim/duration), the new clip never got its own lane, persisted cuts bound ambiguously, and the OPFS upload clobbered the old cam's media (camVideoPath keys on camId). New nextCamIndex() allocates one past the highest existing cam-N suffix (length as a floor for non-standard ids). Display names stay derived from array position, so visible numbering is unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… + second-tab warning (#129) Auto-persist was an unversioned read-modify-write: with the same project open in two tabs (cmd-click in History, yesterday's leftover tab), any persist-relevant change in the stale tab rewrote the FULL editing surface — cuts, pills, fx, trim, colorGrade — over the other tab's edits, discovered only on the next reload. - jobs-db: LocalJob gains a monotonically increasing editRev; new updateJobGuarded(id, expectedRev, patch) applies the patch and bumps the rev in one readwrite transaction, or refuses with the current rev on mismatch (patch cannot smuggle its own id/editRev). Plain updateJob writers (sync results, triage, renames) don't bump it. - useAutoPersist: every flush now CAS-writes against the revision this tab last wrote (seeded from the row at mount). A refused write pauses saving and raises a blocking dialog — 'Overwrite with this tab's version' resumes on top of the other tab's rev, 'Keep the other tab's edits' leaves saving paused. Flushes per job are serialized so an explicit flush racing the debounce can't self-conflict. - Proactive detection: the editor holds a Web Locks exclusive lock per project; a second tab is warned at mount ('Edit here anyway' / 'Go back') before it ever writes. Covered by CAS semantics tests against real Chromium IndexedDB and hook-level jsdom tests for refusal, pause, overwrite-resume, keep-paused, and both Web-Locks outcomes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ip archive (#86) Every project lived solely in one browser profile's IndexedDB + OPFS: a 'Clear site data', storage eviction, profile reinstall, or wanting to continue on another machine destroyed all edit work; only the rendered MP4 was ever downloadable. Now: - storage/zip.ts: dependency-free ZIP container (STORE method, ZIP64 for multi-GB entries). The writer references media Blobs lazily so a 20 GB project exports without 20 GB of RAM (only the mandatory CRC32 pass streams the data); the reader hands back lazy slices so import writes straight into OPFS. - local/project-archive.ts: exportProjectArchive packages project.json (full LocalJob row — Float32Array fields base64-tagged, native file handles replaced by OPFS sources since the bytes travel inside) plus master audio, all cam media (incl. handle-backed originals, with a one-shot permission re-prompt), frame strips, and the rendered output. importProjectArchive restores everything OPFS-backed, minting a fresh id + rewriting internal paths when the archived id is taken, validating the manifest (foreign/newer-version archives rejected with clear errors), and cleaning up on failure. - Settings gains a Projects section: per-project Export (with measured size) and an Import button. Verified by ZIP round-trip unit tests (incl. forced ZIP64 + CRC), pure-helper tests (path rewrite, handle stripping, manifest validation), a real-Chromium OPFS+IDB export→wipe→import round-trip (byte-identical media, Float32Array survival, id-collision fork, legacy v2 rows), and Settings component tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
followerFor cached every distinct sidechain config forever (WeakMap → unbounded inner Map). A macro-knob drag streams a distinct config per pointermove and every follower curve spans the full master track (~1.73 MB at 120 fps for an hour-long job), so a few seconds of dragging on a long-form job permanently retained tens to hundreds of MB until job reload. The inner map is now a true LRU capped at FOLLOWER_MEMO_MAX (8): hits refresh recency via delete+set, inserts past the cap evict the least-recently-used entry. 8 covers every concurrently active sidechain FX (one curve each, distinct configs) with headroom, so steady-state playback never thrashes; only stale intermediate drag configs fall out. Worst-case retained memory on a 1-hour job drops from unbounded to ~14 MB. Measured (node, 431k-sample envelope = 1 h @ ~120 fps): one rebuild is ~4.4 ms median — the memo already limits rebuilds to one per unique config (both 60 Hz consumers share it), so the drag-path cost stays a single rebuild per pointermove; retention was the real leak. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…114) buildLoudnessEnvelope was called synchronously in Editor.tsx's background getPcm().then(...) — a single-pass scan over every PCM sample that lands AFTER the editor is interactive. For an hour-long master (~79 M samples @ 22.05 kHz) that is a ~100-300 ms main-thread block; if the user already hit play it stalls the preview rAF and the audio walker past its crossfade lead window (audible seam glitch). New buildLoudnessEnvelopeAsync mirrors buildPeakPyramidAsync (#62): the bucket scan runs in ~2M-sample chunks with MessageChannel event-loop yields between them; sync and async builders share one extracted bucket kernel (fillPeakBuckets/normalizeInPlace) so results are sample-identical (unit-tested, incl. chunk-seam windows and progress monotonicity). Editor.tsx now awaits the async variant and re-checks `cancelled` after the await. The export worker path (local/jobs.ts) keeps the sync builder. Measured (Chromium, 15-min master ≈ 19.8 M samples): one 35.9 ms synchronous block before → 10 chunks with a 4.7 ms longest block after (browser test asserts the ratio and logs the numbers; an hour-long master extrapolates to ~145 ms → ~5 ms). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…139) Bar-grid tick generation existed three times: the editor's pure buildRulerTicks, TriageTimeline's usePerChunkBarTicks (same algorithm, same 8/32/64 px zoom gates, plus stride labeling + extension flags), and SeamStrip's barTicks (ad-hoc 4/14 px thresholds). Any grid change (pickup, odd meters, swing) needed three edits or the surfaces drifted. buildRulerTicks is now the one grid builder, generalized with the features the triage copies added: - extendBeforePhase: project the grid left of the anchor (bar numbers <= 0) so a focused chunk's grid spans the whole view as snap targets - labelStride ("auto" = power-of-2 stride keeping labels >= 56 px apart, unlabeled downbeats kept while >= 6 px per bar, beats/subdivisions suppressed at stride > 1) - extensionSpan: ticks outside the half-open [startS, endS) span are flagged extension (keeps #57's boundary-bar-not-primary behavior) - a shared quarter-pixel-per-bar density floor Both triage rulers are now thin projections in chunk-ruler-ticks.ts (buildChunkGridTicks / buildSeamBarTicks) anchored on the chunk's audioStartMs — pickup-bar support (barOffsetBeats) exists by construction in the shared math instead of being missing from the copies. SeamStrip inherits the canonical zoom gates and adaptive label stride instead of going blank below 4 px/beat or crowding labels. useTimeRuler/niceStep moved to a pure time-ruler-ticks.ts module. Also fixes a left-edge gap both copies had in different ways: 1/8 and 1/16 subdivisions of the beat straddling the window start are now emitted (the editor skipped them via an early continue, triage via a ceil'd first-beat index). Tests: parity test proving triage and editor produce the identical grid for the same anchor/zoom, stride/extension/extendBeforePhase coverage, time-ruler tests, and a TriageTimeline render smoke test for the stride-labeled ruler. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…e/arrange gapless transports (#82) The dual-<audio> ping-pong + WebAudio crossfade transport existed as three forked copies (useAudioMaster 898 lines, useTriageAudio 505, useArrangeAudio 342) with byte-identical scaffolding: AudioGraph, StrictMode WeakMap cache, graph-build, scheduleCrossfade/cancelArmed, LEAD_TIME_S/CROSSFADE_S, URL-resolve/play-mirror/seek-subscription effects. Crossfade fixes landed in one copy and silently missed the other two (the triage copy had already drifted). New src/local/audio/pingpong-engine.ts owns graph construction + per-element cache, active/idle side bookkeeping, armCrossfade (pre-roll-compensated idle parking per #80/#104, stall-overshoot tolerant per #76), armWithoutCrossfade (end-of-material sentinel — a fake swap would snap the playhead backwards), consumeFired, cancelArmed, park/seek/play-pause/volume plumbing. The armed payload is generic: each screen keeps its own walker (editor loop + segment hops incl. OP-1 deferred wrap, triage loop/seam/sequence, arrange planner) and interprets the payload on fire — no false unification of the walker semantics. New src/local/audio/use-pingpong-transport.ts extracts the React glue Triage and Arrange duplicated line-for-line (job URL resolve/revoke, readiness, engine build, play mirror, external-seek handling). The editor keeps its own glue (seekRequest + segment-hint rebinding, pending pre-metadata seeks, volume coupling) on top of the engine. Behavioral deltas in triage/arrange from inheriting the editor-grade arming path: idle now parks a lead-window EARLY (armParkMasterT) so loop starts / incoming chunk heads no longer clip their downbeat, the idle seek is epsilon-guarded, and gain-ramp cancellation anchors at ctx.currentTime. 38 new engine/transport unit tests (regression pins for #76/#80/#104 ported to engine level); all 32 existing useAudioMaster jsdom tests and the real-Chromium loop browser test pass unchanged on the engine-backed hooks. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… playhead (#110) The single canvas draw effect had playback.timelineT/currentTime in its deps, so every playback frame re-ran the full raster: backing- store realloc (canvas.width assignment), every video lane's thumbnail tile blits, the waveform column model over every device pixel (with fresh typed-array scratch), trim bands, splice marks, loop band — although the only per-frame pixel change is the 1.5 px playhead. On top, `videoBands` was a fresh array in the deps, so ANY component render invalidated the scene even outside playback. Split per the pattern #63 established (playhead-only overlay layers): - The scene canvas keeps everything except playhead + quantize ghosts and drops timelineT/currentTime (and unused duration/audioDuration/ trim.in/out/arrTotal) from its deps — it now redraws only on scroll/zoom/data/selection changes. - A transparent, hit-through overlay canvas stacked above it draws the playhead + Q-hold quantize ghosts per frame (clear + 1 stroke + grip; backing store reallocs only on geometry change). Pre-split z-order preserved (ghosts above playhead above lanes). - videoBands memoized on [clips.length, videoLaneHeight]. Measured (Chromium browser test, 2 cams + waveform, 60 playhead-only ticks): scene fillRects 649 → 0, canvas backing-store reallocs 59 → 0, playhead still stroked 60×. Remaining per-tick cost is React reconciliation, addressed separately (#113). The test also pixel-verifies both layers (paper scene below, hot playhead ink at the expected column above) and pins the op counts as a regression gate. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
#113) Timeline re-renders every playback frame (playhead subscriptions), and each render rebuilt the whole header column: LaneHeader (a ~360-line skeuomorph control strip) was a plain function fed five fresh inline closures per render — with 5 cams that is ~300 component renders/s — plus the scrollbar tick rows and the vertical fader reconciling per frame. ProgramStrip got the memo treatment in #63; LaneHeader didn't. - LaneHeader is React.memo'd (Object.assign keeps the WIDTH expandos); all its other props are primitives, so the memo actually holds. - New timeline/lane-callbacks.ts: per-cam callback factory with an identity cache. Handlers are created once per cam and read live state via getState() at call time (the pattern onTakeStart already used); onDeleteClip resolves through a ref so Editor re-renders can't invalidate the cached identities. TAKE tap/hold/paint, single-active-hold guard, stale-release guard, reset and delete semantics are covered by unit tests (incl. fake-timer promote). - Static scrollbar tick row + thumb knurl hoisted to module-constant elements (constant identity → React bails out of those subtrees); VerticalFaderThumb memo'd with a stable onScrollTo. camStatusByCamId still recomputes per frame (the ON-AIR LED must track the playhead) but its output is per-cam strings, so the memo'd headers no longer re-render when the status doesn't change. Measured (Chromium perf test from #110, 2 cams, 60 playhead ticks): ~62 ms median before → ~42 ms after (-30% per-tick main-thread time in the harness; the win scales with cam count). Unit suite: 1562 green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The editor had zero undo coverage while destructive bulk operations
(X-hold clear, program-strip long-press, quantize commit, paint-over,
pill trims) auto-persisted to IndexedDB within 300 ms — one mis-gesture
permanently destroyed a whole performed take.
New editor/history.ts subscribes to the store and keeps a bounded
(100-entry) undo/redo stack of the user-editable document slice: cuts,
fx, pills, per-clip edits (sync override, source-trim, rotation/flip,
viewport transform, image duration, start offset), master trim,
overlays, color grade, filter slots, audio volume, loop, and beat-grid
settings. Bursts coalesce via a 300 ms idle window and finalization
waits for in-flight gestures, so a drag, a hold-paint, or an X-clear is
ONE entry — and a cancelled hold (Esc) collapses to no entry at all.
Restores flow through the store, so useAutoPersist's dirty-check sees
them and writes the restored state back (verified end-to-end against
IndexedDB in real Chromium via scripts/verify-undo-e2e.mjs).
Cam add/remove is deliberately not undoable (job-level asset ops):
clip fields merge per-id on restore and cuts/pills referencing removed
cams are filtered, so undo never resurrects a deleted lane.
Cmd/Ctrl+Z + Shift+Cmd/Ctrl+Z are registered through the shortcuts
keymap (exact-modifier policy keeps plain Z on the zoom FX pad) with
platform-appropriate cheat-sheet entries; the TransportBar gains
undo/redo buttons driven by depths mirrored into store.history; the
keyboard X-clear now toasts "Cleared — ⌘Z/Ctrl+Z to undo" and each
undo/redo flashes what it touched ("Undo — cuts + FX").
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… pin loop invariant (#125) The "loop active: pill click select 8 s, never 10BC8 seeks" invariant lived as a single inline conditional deep in Timeline.tsx's pointerdown handler and had already regressed once as a user-reported bug. The zone/lock/snap/loop decision matrix now lives in timeline/pill-pointer.ts as a pure function (decidePillPointerDown) with the full matrix under unit test — including select-only/no-seek under an active loop, MATCH-snap promotion to cam-track-move, and lock-independent reset-button behavior. Timeline.tsx just executes the returned decision; drag-payload construction stays local. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…cal/ (#122) editor/ (React UI) and local/ (pipeline, workers, storage glue) imported each other freely — worker/export bundles absorbed UI-layer code (a state store even imported a type from a React component file), and an editor -> local -> editor file cycle existed. Shared pure domain code now lives in src/core/, which imports nothing from the upper layers: core/fx/ (from editor/fx: types, catalog, looks, envelope, modulation, active, pack, audio-envelope, renderer-context, webgl2 + webgpu shader sets) core/render/ (from editor/render: backend, factory, canvas2d/ webgl2/webgpu backends + webgpu ctx, build/frame descriptors, element-transform, adaptive-scaler) core/types.ts, snap.ts, cuts.ts, arrangement-pills.ts, arrangement-time.ts, output-frame.ts, perf/marks.ts (from editor/) core/timing/cam-time.ts, arrange/chunks-to-segments.ts, waveform/{peak-pyramid,build-pyramid-async,draw-waveform}, capabilities.ts (from local/) core/bpm.ts (BpmValue extracted from BpmReadoutView.tsx) UI-adjacent render modules stay in editor/render (preview-runtime, video-element-pool, feature-flag); persistence-coupled pyramid-cache stays in local/waveform. Layer ladder is now acyclic and enforced by src/layer-boundaries.test.ts: local/ never imports editor/components/ pages, core/ never imports any upper layer nor React/zustand. All 102 moves are git renames; imports rewritten mechanically, no behavior change (full unit suite, targeted browser tests, tsc and vite build verified green). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…upe initial state (#121) editor/store.ts held ~90 actions across 12+ domains in one closure, with the ~29-field initial state hand-enumerated three times (create / reset / loadJob) — a field forgotten in reset() silently leaked state from the previous job into the next. The store is now assembled from domain slices in editor/store/ (job, playback, clips, pills, cuts, quantize, fx, grade, output, ui), each owning its state fields, actions, pure helpers and an initial-data factory. initialEditorState() composes the factories once; create() and reset() both spread it, so the lists can no longer drift. loadJob() keeps its deliberately different field set (holdGesture / quantizePreview / notice / preparingCamIds / history stay untouched across a job load) and now documents that. Public API unchanged: useEditorStore and all shared types re-export from editor/store.ts, state shape stays flat and identical — zero consumer changes (store.test.ts untouched and green). New store-reset.test.ts pins the reset contract enumeration-free: every data field is polluted with a sentinel and must be restored. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
) The per-project Web Lock releases asynchronously, so a StrictMode remount (dev) or fast back-and-forth navigation (prod) saw ifAvailable:null from its own dying lock and mis-fired the second-tab warning. Project locks are now refcounted per tab with a short release grace, so same-tab remounts reuse the held lock; a genuine second tab still warns. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…l per-video sync The upload page routes drops by MIME and uses showOpenFilePicker (no <input type=file> anymore), and sync state lives per-video (videos[i].sync) instead of a job-level status field. Drop real file paths via Input.dispatchDragEvent so multi-GB media works, click the DIRECT mode card, and poll the new shape. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…der screen Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
81 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves every finding from the 2026-07-10 multi-agent app review (tracking: #145). 17 fix agents in 5 dependency-ordered waves, TDD throughout, one commit per issue.
What's in here
Bug fixes across every subsystem — playback engine (loop scheduling, segment hops, seek replay), export/render (master-time vs timeline-time contract now explicit in types, A/V drift cancellation, AAC↔Opus fallback restored), triage (re-detect preserves user decisions, persist races eliminated), arrange (pool preview loop, touch scroll, hit-tested reorder), GPU backends (WebGPU probe, device-lost recovery, per-layer resources), codec robustness (moov-less fail-fast, ffmpeg exit codes, retryable core load), jobs/persistence (quota consent instead of silent deletion, orphan cleanup, cross-tab CAS guard, flush-on-unmount), and a stack of UX fixes (honest render status, inline output player, real drag & drop, double-extension downloads, …).
New capabilities
.tk1.zip(No project backup/export/import — days of edit work are trapped in one browser profile's evictable storage #86)Architecture — shared ping-pong audio engine (−967 duplicated lines, #82), single bar/beat tick source (#139), 3045-line store split into 10 slices (#121), dependency-free
src/core/layer with boundary tests (#122).Found along the way — the new GPU parity suite exposed that the noir filter never compiled on WebGPU (
filteris a reserved WGSL word) and silently no-opped; the live e2e exposed a same-tab remount race in the new second-tab warning. Both fixed here.Verification
Closes
Closes #64, Closes #65, Closes #66, Closes #67, Closes #68, Closes #69, Closes #70, Closes #71, Closes #72, Closes #73, Closes #74, Closes #75, Closes #76, Closes #77, Closes #78, Closes #79, Closes #80, Closes #81, Closes #82, Closes #83, Closes #84, Closes #85, Closes #86, Closes #87, Closes #88, Closes #89, Closes #90, Closes #91, Closes #92, Closes #93, Closes #94, Closes #95, Closes #96, Closes #97, Closes #98, Closes #99, Closes #100, Closes #101, Closes #102, Closes #103, Closes #104, Closes #105, Closes #106, Closes #107, Closes #108, Closes #109, Closes #110, Closes #111, Closes #112, Closes #113, Closes #114, Closes #115, Closes #116, Closes #117, Closes #118, Closes #119, Closes #120, Closes #121, Closes #122, Closes #123, Closes #124, Closes #125, Closes #126, Closes #127, Closes #128, Closes #129, Closes #130, Closes #131, Closes #132, Closes #133, Closes #134, Closes #135, Closes #136, Closes #137, Closes #138, Closes #139, Closes #140, Closes #141, Closes #142, Closes #143, Closes #144, Closes #145
🤖 Generated with Claude Code