Files
hyperframes/scripts
James RussoandClaude Opus 5.5 5f6995fe77 fix(studio-server): audio decodes are bounded, stop when nobody waits, and their cache is capped (#7991)
* fix(studio-server): audio decodes are bounded, stop when nobody waits, and their cache is capped

The waveform and peaks routes each started a full-file ffmpeg decode per request, with no limit on how many ran
at once, no sharing on the waveform route, and no way to stop one after its request went away. Their cache
folder also grew without end.

- Both routes now decode through one shared queue of 4 slots, one decode per cache entry, shared by every
  request that wants it. When the last request waiting on a decode leaves, its ffmpeg is killed (or it leaves
  the queue).
- `.waveform-cache` keeps at most 500 entries; a write past that drops the oldest.

— Rames

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(studio-server): trim comments to the package's comment share

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(studio-server): raise the packed size budget for the audio decode limits

The bounded decode queue, the abort when nobody waits and the capped cache
add about 485 bytes to the packed tarball. Main had already reached 178,489
bytes against a 178,000 budget, so together they pass the 1% tolerance
(179,877 bytes). The new budget is the measured size plus the script's 5%
headroom.

— Rames

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(studio-server): waveform decodes keep a fixed-size peak buffer, time out, and the cache is byte-capped LRU

- decodeAudioPeaks streams samples into a 65536-entry max-abs buffer that merges
  neighbouring runs when full, instead of buffering and concatenating the whole decode.
- A shared decode is stopped after 10 minutes and its slot freed.
- .waveform-cache is capped at 256 MB as well as 500 entries; a cache hit marks its
  entry used, so eviction drops the least recently used.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(studio-server): raise the unpacked size budget after rebasing onto main

Measured with pnpm pack after the rebase: 697160 unpacked bytes, over the
690000 budget by more than 1%. The new budget is the measured size plus 5%.

— Rames

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 04:34:40 +00:00
..