fix(audio): delete owned YouTube partials on in-flight abort - #875
fix(audio): delete owned YouTube partials on in-flight abort#875cursor[bot] wants to merge 46 commits into
Conversation
A 60 MiB import must be accepted, exact 100 MiB must pass, and announced/in-flight/post-download oversize must fail before cache fill. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
…ling Drive yt-dlp max_filesize and a progress hook from AudioResourcePolicy, reject announced oversize before download=True, and delete artifacts that still exceed 100 MiB after write. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Update residual-risk text so Rust intake is no longer described as missing, and cite yt-dlp max_filesize/progress_hooks in APA 7th. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
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>
|
Canonicalization evidence: #875 exact head |
Summary
Successor to #866 at exact head
1f3fdb8b. That head already uses the canonical 100 MiB encoded-byte ceiling (max_filesize, announced-size reject, progress-hook abort, post-download policy check). This change deletes owned.part,.ytdl, and-Frag*siblings that stay inside that import's output directory when the hook aborts, so a rejected transfer cannot accumulate cache bytes. Paths that escape the directory are ignored.Apply this onto #866 or reconstruct #866 onto this head before Ready. #865 must still integrate first. Do not merge this draft as a substitute for #866's remaining #781 lanes.
Exact head after this commit:
5e8fa77f.Verification
uv run pytest tests/test_youtube.py --cov=bandscope_analysis.youtube --cov-branch— 30 passed, 100% statement+branch onyoutube.pyruff check/ruff format/mypy --stricton the YouTube module./scripts/harness/quickcheck.sh— not a substitute for exact-head CI on this branchSecurity Notes
Attack surface
YouTube import writes untrusted bytes into a project cache directory. An over-budget transfer can still write the current block before the progress hook raises.
Trust boundary
Filesystem cleanup is limited to paths that
realpathto a file strictly inside the importout_dir. Renderer metadata and announced yt-dlp sizes remain untrusted.Mitigations
DEFAULT_MAX_ENCODED_FILE_BYTEStmpfilename/filenameand matching siblings are deleted on abortTest points
.part,-Frag1, and.ytdlsiblings and keeps unrelated files inside and outsideout_dirOSErrorpath resolution fail closedDependency and Supply Chain
i18n impact
Reviewer checklist
developRefs #781. Depends on #865. Repairs remaining abort-path leak on #866.