fix: make SEA binary cache writes concurrency-safe
AB
2mo ago+48+48+01234567890123456789-4-4-0123456789
Summary
- write downloaded SEA binaries to unique temporary files in the cache directory
- atomically publish completed downloads and tolerate another process winning the cache race
- clean up temporary artifacts on both success and failure
- add regression coverage for concurrent writers and existing-cache behavior
Testing
uv run --frozen pytest tests/test_sea_binary.py -q(6 passed)uv run --frozen ruff check .uv run --frozen pyright -p .uv run --frozen mypy --platform linux .- full Python 3.9 and 3.14 suites run on Windows; only the pre-existing Windows failures addressed by #355 remained
Fixes #351
Summary by cubic
Make SEA binary cache writes concurrency-safe. Previously concurrent writers shared a temp path and could race, leading to partial or orphaned files; now each writer uses a unique temp file, publishes atomically, and cleans up. Fixes #351.
- Write downloaded SEA binaries to unique temp files in the cache directory via
tempfile.NamedTemporaryFile. - Atomically replace the destination; if another process already populated the cache, keep that file.
- Always remove temp files, on both success and failure.
- Add regression tests for existing-cache reuse and concurrent writers.