Repository navigation
feat(file_storage): sync worker API, S3 multipart server puts, BIGINT sizes (#708) - #720
Merged
Merged
Conversation
…url), S3 multipart server puts, BIGINT sizes (#708) Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
Cap multipart part size at S3's 5 GiB; trashed rows count as committed in worker compensation; README matches the reaper. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
store_path declares a real file's size so S3 parts grow past the 10,000-part limit; presigned TTL checked before the query; abort asserted on mismatch. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
Deploying simple-module-python with
|
| Latest commit: |
8bb8668
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7fdafa0e.simple-module-python.pages.dev |
| Branch Preview URL: | https://feat-b33-file-storage-worker.simple-module-python.pages.dev |
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. |
This was referenced Oct 30, 2026
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.
A public way for sync Celery workers to store and read files, and S3 server-side writes that work past 5 GiB.
Closes #708
What changed
file_storage.contracts(sync, lazily imported, runs under the caller'stenant_context):store_path(path_or_stream, *, filename=None, content_type=…, public=False) -> StoredFileOutgoes through the normal upload path: size, MIME and quota checks, hashing, compensation. It runs in its own transaction and publishesFileUploadedafter commit. An unscoped call fails before any IO.open_local(file_id)is a context manager yielding a temp file in a private directory that is always cleaned up. The metadata transaction is closed before streaming.presigned_url(file_id, ttl_seconds=…).putgoes multipart abovedirect_upload_threshold_bytes, including unknown-length streams. Parts stay within S3's bounds, and any error, cancellation or failed completion aborts the upload without masking the original error.s3:AbortMultipartUpload.file_storage_stored_file.size_bytesisBIGINT(migrationf5b1c3e8a207). On Postgres it was a 32-bitINTEGER, so any file of 2 GiB or more failed on insert, which would have made large server puts useless.file_storageits own branch label, following CLAUDE.md's "label an unlabelled module on its next revision".test_migration_graph, the migrations guide and CLAUDE.md's heads line are updated.multipart_part_size_bytesis capped at 5 GiB (S3's per-part limit). A stored value above that is dropped with a warning instead of failing every multipart put.server-key namespace that the reaper skipped. I removed it: the reaper only aborts untracked multipart uploads older than twice the session TTL (48 h), which no real put runs for, so server orphans are cleaned up like browser ones.Verification
make lint✓ ·make test-js✓ ·make test-py✓ (6641 passed, 41 skipped) ·make migrations-roundtrip-pg✓ (alembic check: no new operations)test_file_storage_worker.py: path and stream round trips, cross-tenant and missing ids, unscoped refusal, temp cleanup, remaining-size detection.test_file_storage_worker_failures.py: quota, MIME, size, flush and commit failures, compensation.test_file_storage_server_put.py: threshold boundaries, exact final part, unknown size, abort on stream, completion and part failures, part-count bound, part-size cap.https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4