fix(audio): establish canonical local-audio resource policy - #866
fix(audio): establish canonical local-audio resource policy#866seonghobae wants to merge 66 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Aborting at the 100 MiB ceiling still left .part, .ytdl, and -Frag* siblings in the import cache. Delete only paths that stay inside that import directory so a rejected transfer cannot accumulate cache bytes. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
There was a problem hiding this comment.
Stale comment
Reviewed exact head
1f3fdb8b. The prior 50 MB / missingmax_filesize/ stale doctoring findings are fully addressed: YouTube download now usesDEFAULT_MAX_ENCODED_FILE_BYTES, rejects announced oversize beforedownload=True, aborts from the progress hook, and revalidates the written file. Do not mark Ready or merge this draft until #865 is in protecteddevelopand the abort-path cache leak below is on this head.Request changes: in-flight abort still returns
size_exceededwithout deleting bytes already written. yt-dlp HttpFD writes the current block, then calls the hook; on exception it only closes the stream. The post-download path deletes an oversize final artifact; the abort path does not. Each rejected import can leave*.part,*-Frag*, and*.ytdlin a fresh project cache.Successor
cursor/bc-75568fe4-aa90-4cf7-bb40-c9d68be95b82-b46fat5e8fa77fdeletes owned siblings that stay inside that importout_dirand ignores escaped paths. Apply that here or reconstruct this branch onto it before Ready.Queued, skipped, predecessor, or draft-skipped CodeRabbit evidence is not success.
Sent by Cursor Automation: Fix Issues
There was a problem hiding this comment.
Reviewed exact head 5e8fa77f on fix/audio-resource-policy-781 (base develop@acdbea63). The prior in-flight abort finding is fully addressed on this head: _abort_over_budget_download deletes owned siblings before the fail-closed size_exceeded raise. _owned_file_path realpaths the candidate and the import out_dir, rejects the directory root, and requires resolved.startswith(root + os.sep), so a path or symlink that escapes that import directory is ignored. _remove_download_artifacts stems tmpfilename / filename (one .part strip) and removes matching stem, stem.*, and stem-* entries, which covers .part, .ytdl, and -Frag*. test_download_youtube_audio_progress_hook_deletes_partial_artifacts proves those three are gone after abort while keep-me.txt and an outsider .part remain.
The earlier 50 MB post-write, missing Rust intake doctoring, CHANGELOG 50 MB, and progress-hook int-only items stay fixed. YouTube admission uses DEFAULT_MAX_ENCODED_FILE_BYTES (100 MiB) in Python, desktop analysis.ts, and native audio_resource.rs. Announced oversize rejects before download=True. Exact 100 MiB is accepted; 60 MiB is accepted; 100 MiB + 1 is rejected. Closed #875 is the same tree as this head — do not reopen a competing abort-cleanup owner.
Next action: keep this Draft. Integrate #865 into protected develop first, then reconstruct and revalidate this stack on the unchanged resulting exact head. Do not mark Ready or merge on queued, skipped, predecessor, or CodeRabbit draft-skipped evidence. Remaining #781 channel/rate contracts and decoded-memory / CPU/GPU admission budgets are still out of this draft's claim — do not treat policy-v1 encoded-byte admission as full #781 closure.
Residual (not a change request): a process kill, a locked Windows .part, or a differently named format-id fragment can still leave cache bytes until that per-project import directory is removed. Generic DownloadError / timeout paths do not sweep unnamed artifacts. Admission still fails closed.
Sent by Cursor Automation: Fix Issues


Buyer/security gap
Advances #781 by replacing divergent local-audio resource limits with one versioned policy and enforcing it before expensive analysis/model work. The same 100 MiB encoded-byte ceiling now applies to native local-file bootstrap, desktop bridge validation, Python request/decode admission, and YouTube download/bootstrap admission.
Exact current identity and stack
develop@acdbea6344fe1231c39535b575f4de35e4c607c9.d3e27929d794dd6333ca5458ecfa3ed705f3af52.fix/audio-resource-policy-781.f86e266b2ab2dc5a95e6b4a484e777b29f0feeafat this refresh.This branch deliberately descends from #865 because #865 owns the thin desktop-core crate root used by the native resource modules. #865 must integrate first; predecessor checks, reviews, and approval never transfer to this head.
Implemented policy-v1 boundary
AudioResourcePolicy: canonical 100 MiB encoded-file ceiling, 44.1 kHz target rate, 900-second decoded-duration ceiling, checked derived-sample arithmetic, mono/floating/finiteness requirements, and one-sample-over-budget decode probe.localSource.fileSizeBytesbefore analysis dispatch.TemporalAnalyzerandAudioStemSeparatordecode only through the bounded policy probe and reject invalid output before beat analysis or Demucs/model work.analysis.tsapplies the same encoded-byte ceiling to native local-file and YouTube bootstrap responses and rejects non-integral JavaScript byte metadata.DEFAULT_MAX_ENCODED_FILE_BYTES: announced oversize rejects beforedownload=True, yt-dlpmax_filesizeplus a progress hook abort in-flight, and the completed filesystem artifact is revalidated with the canonical policy..part,.ytdl, and-Frag*artifacts whose canonical path remains strictly inside that import's app-owned cache root; foreign, empty, directory, escaped, and path-resolution failures are ignored.Current-head convergence
The previous canonical head
5e8fa77f6ac1e38a68518285961da5056f22c242is historical. The branch advanced by 17 commits tod3e27929d794dd6333ca5458ecfa3ed705f3af52, modifying only the audio-resource-policy/YouTube implementation, focused tests, CHANGELOG, and doctoring. The prior exact-head E501 failure intest_audio_resource_policy_coverage_regressions.pyis therefore not current: the intervening branch work corrected that formatter/lint boundary and the unchanged current head now has terminal-successciandreleaseevidence.All current inline review threads are resolved. The earlier Cursor
CHANGES_REQUESTEDfindings about the 50 MiB post-write divergence and in-flight abort artifact leak are stale/currently addressed; later Cursor review explicitly verified those repairs on predecessor head5e8fa77f. Two GitHub Code Quality test-helper findings are resolved/outdated on the current branch. Historical review state does not count as current independent approval.Exact-current-head repository evidence
Evidence below binds only to
d3e27929d794dd6333ca5458ecfa3ed705f3af52.Terminal-success BandScope repository workflows:
cirun31990978931;releaserun31990978948;build-baselinerun31990978905;sbomrun31990978911;secret-scan-gaterun31990978903;SAST Semgreprun31990978893; andbanditrun31990978900.Two repository security workflows are non-passing, and their exact current-head jobs/logs were inspected before classification.
security-audit— inherited protected-base dependency baselineRun
31990978877, job95274388858, completes checkout/tool setup andnpm ci, then fails specifically atnpm audit --workspaces --audit-level=highon exactly the protected-base JavaScript findings already owned by canonical #783:nanoid <3.3.18(GHSA-2v37-7h3g-55p8);pdfjs-dist >=5.6.83 <6.2.108(GHSA-hq66-cqwq-w95j); andundici 7.0.0–7.28.0advisories.The later Python/Rust audit stages are skipped because npm exits first; skipped evidence is not success. This branch has no package manifest/root-lock delta, so these findings are not #866-owned and are neither suppressed nor duplicated here.
aggregate
Security Scan— inherited protected-base Trivy findingRun
31990978916has terminal-success Scorecard, Dependency Review, and OSV base-vs-head comparison. Its only failed substantive job istrivy-fs95274390956, which reports exactly one HIGH whole-tree finding:CVE-2026-16633forpdfjs-distatpackage-lock.json:6370.The workflow itself directs remediation to the shared base so open PRs inherit the fix. This remains canonical #783-owned protected-base evidence, not a reason to mutate #866 product code or weaken a gate.
Ownership / dependency gates
developtip without transferring predecessor evidence.develop, regenerate fix(audio): establish canonical local-audio resource policy #866 security evidence on the then-current reconstructed head.security-auditstill exposespersist-credentials: trueuntil that canonical workflow repair integrates.ContextualWisdomLab/.github#1020(fix(ci): harden trusted uv flat-lock materialization). Protected centralmainhas not inherited it. Historical.github#939/ closed-unmerged predecessor state is not a current dependency order for this BandScope branch. Do not repeatedly dispatch the unchanged failing central coverage path before #1020 integrates.Remaining #781 work
This Draft does not claim full #781 closure. Remaining lanes unless separately superseded by accepted architecture and current source evidence include:
Merge boundary
Keep Draft and unmerged until dependency-root order is satisfied and the unchanged resulting exact head has realistic focused/full tests GREEN, exact 100% owned production statement/branch coverage plus required docstrings/rustdoc, applicable native/Rust parity, every required SAST/security/SBOM/supply-chain/package/release/central review gate terminal-success, zero valid unresolved findings, #865/#783/#861/central prerequisites integrated and regenerated, a qualifying independent non-author last-push approval, and ordinary branch-protection acceptance without bypass.
Queued, skipped-required, failed, absent, predecessor-head, protected-base, model-only, self/author, or administrative-bypass evidence is not success.
Refs #781.