Repository navigation
Studio: skip the audio gallery prune's sidecar pass under both caps and list prepared inputs once per sweep - #15874
Merged
Merged
Conversation
…pared input copies once per sweep
Member
Author
|
@codex review |
1 similar comment
Member
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
danielhanchen
marked this pull request as ready for review
October 29, 2026 12:12
# Conflicts: # studio/backend/tests/test_audio_inputs.py
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.
What changes
Two cleanup paths in the Studio audio stack stop repeating work that cannot change their result.
audio_gallery._prune_to_capruns after every saved TTS clip. It parsed every sidecar, built a full record per clip, sorted, then summed sizes, only to find that nothing was over either cap (the usual case below 2000 clips and 5 GiB). It now first lists the clip WAVs in the folder it locked and, if their count fits the clip cap and their WAV plus.source.wavbytes fit the byte cap, returns 0 without reading any sidecar. The clips the prune ranks are a subset of those WAVs (owned, not archived, not pinned), so when every WAV fits, the subset fits and main would also remove nothing. The size sum stops as soon as it passes the byte cap. Over a cap, the existing path runs unchanged.audio_inputs.sweepsized each live upload by globbing{id}.*.wavonce per input, one directory listing per input. It now lists the folder once and maps each name to the part before its first dot (an input id has no dot, so that is exactly the glob's match). Case folding follows pathlib's glob on the platform (os.path.normcase); stems that are not id-shaped, and any non-ASCII name on a case-insensitive platform, use the old per-input glob. Removals still glob at removal time, so an expired or evicted input still takes every prepared copy that exists when it is removed.No change to what is kept or deleted, the return values, or the log lines.
Results
Deterministic counts on the same fixtures, base = merge base, head = this branch (5 repeats each, wall time median with min to max in brackets; A/A = base run twice).
A/A spread on the base arm: the byte-cap prune case moved 116 to 135 ms between two base runs, so its +13 ms on head (one extra listing and 570 stat calls before the existing path) is inside noise. Every case leaves an identical file set (hash of the remaining names) and returns the same count on both arms.
Tests
tests/test_audio_gallery_prune_caps.py: a prune under both caps reads no sidecar (fails on main, passes here); just over the clip cap, the byte cap, and the byte cap counting a.source.wavstill remove the oldest clip.tests/test_audio_inputs.py: a sweep over live inputs does no per-input glob (fails on main); the single listing gives the same prepared copies as the per-input glob for neighbours such asaaaa/aaaab,aaaa..wav,aaaa.x.y.wav,aaaa.1.wav.tmp,cc-dd_1x.1.wav, and the byte cap evicts the same input.Path.glob(300 random folders, names with[,*,?, upper case, non-ASCII, empty middles) on Python 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14: 0 mismatches..source.wavcopies), each pruned at 13 cap settings around the exact clip count and byte total (one under, exactly at, one over, both caps): all 1,867 cases leave the same files and return the same count on main and this branch, 283 of them with deletions.audio_gallery,audio_inputsorgallery_flags(29 files): main 1124 passed, 1 skipped; this branch 1130 passed, 1 skipped (the 6 new tests).py_compileon Python 3.9 and 3.10.Not covered
os.path.normcaselike pathlib's glob for ASCII names and falls back to the per-input glob when a non-ASCII name is present.audio_galleryre-resolves its folder mid-operation is fixed separately (fix/audiogal-dir); the new check here only uses the folder the prune locked. The two branches merge cleanly.transcript_gallery.pyhas no cap or per-item listing, so it is unchanged.