Skip to content

Add transfer tests for the upload range format - #217

Merged
ozcan-durak merged 1 commit into
mapilio:mainfrom
chrisdebian:test/upload-range-contract
Nov 5, 2026
Merged

ozcan-durak merged 1 commit into
mapilio:mainfrom
chrisdebian:test/upload-range-contract

Conversation

@chrisdebian

Copy link
Copy Markdown
Contributor

Test-only PR, as Ozcan asked on #212. There's no change to how uploads behave.

The upload header uses Mapilio's own format rather than RFC 7233: the end value is always the total size, and an empty request with bytes=total-total/total completes the upload. I got this wrong in #212, so these tests and a short comment in upload_manager.py should stop anyone else "fixing" it the same way.

Six transfer cases, each a full upload through UploadManager.upload():

  • one-byte file
  • exactly one chunk
  • exact multiple of chunks
  • final remainder (101 bytes with 100-byte chunks)
  • resumed mid-file
  • resumed with one byte left

Each case checks the exact headers sent, the bytes stored and the returned hash.

Two things to check, please:

  • You named three of your six cases on fix: correct Content-Range end byte in chunked upload (RFC 7233) #212, so the other three are my best guess. Happy to swap them for yours.
  • I don't have the image-server handler, so the tests use a small fake server based on your comment and the backend's contract smoke test. Its rule that a chunk must start at the stored offset is my assumption.

Testing: pytest gives 111 passed locally. With the #212 change put back temporarily, all six new tests fail.

This was written with Claude Code, and I've reviewed it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ue2Xf5aBJNCP6zpRMLwZpm

@ozcan-durak ozcan-durak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked against the upload handler: the stored-offset check is correct. These six cases cover the boundaries we need, so no need to swap them.

All 111 tests pass here, along with six transfers through the actual Node route. Ready to merge.

@ozcan-durak
ozcan-durak merged commit 802860d into mapilio:main Nov 5, 2026
4 checks passed
@ozcan-durak ozcan-durak self-assigned this Nov 5, 2026
@chrisdebian
chrisdebian deleted the test/upload-range-contract branch November 5, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants