feat(BA-6154): add upload session state model#11765
Closed
jopemachine wants to merge 1 commit into
Closed
Conversation
Introduce the pure data layer for the chunk-based TUS upload session that will land in BA-3974. No HTTP wiring or filesystem I/O yet — this commit only defines: - `ChunkRecord(offset, length, sha256)`: a single received chunk's record. - `SessionState(session_id, total_size, received, status)`: the source of truth for an upload session, with computed properties for `committed_offset` (the contiguous prefix end used as TUS Upload-Offset), `missing_ranges` (gaps the client still needs to send), and `progress_percent`. - `ChunkAcceptance(state, committed, completed_now)`: the result the storage class will return after each commit attempt. - New error module `storage/errors/upload.py` with `ChunkConflictError` (409) and `UploadSessionCorruptedError` (500) — the only errors this data layer can raise (the latter from `SessionState.from_json`). Parametric unit tests cover every computed property, plus JSON roundtrip and corruption handling. No production code paths consume these classes yet, so this PR is additive and behavior-neutral. Resolves BA-6154. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This was referenced May 22, 2026
Member
Author
|
Closing in favor of #11766: the session-state model and the on-disk storage class both live in |
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.
📚 Stacked PRs
This PR is part of a 6-PR stack implementing BA-3974 (epic: BA-6153). Merge in order:
feat(BA-6154): add upload session state model← you are herefeat(BA-6155): add TusUploadSession storage classfix(BA-6156): rewire TUS PATCH/HEAD to chunk-based store(user-visible fix)test(BA-6157): add multi-proxy NFS race regression testfeat(BA-6158): support TUS Checksum extensionfeat(BA-6159): add /upload/status endpoint + progress headersSummary
Resolves BA-6154. Part of epic BA-6153 (implements BA-3974).