fix: address dead UUID check and copy-paste error in upload_chunk#158
Merged
Conversation
- Move uuid::Uuid::parse_str above the store.get lookup so the 'invalid_uuid' reason code is actually reachable when a malformed UUID is supplied in the URL. Previously the store.get HashMap lookup always returned None first, so the invalid_uuid branch was dead. - Fix copy-paste error: the missing-end error message said 'Could not read Content-Range start'; corrected to 'end'. Closes #157
The previous PR moved the UUID parse check above the store.get lookup so the 'invalid_uuid' reason code is actually emitted. Add a regression test that asserts the response body for a malformed UUID contains reason="invalid_uuid" (pre-fix it would have been "expired_or_unknown").
Contributor
Author
|
Added a regression test ( The test hits
|
Contributor
Author
There was a problem hiding this comment.
Reviewed locally — both fixes look correct and minimal. (Cannot self-approve since this PR was opened by the same account.)
- The
invalid_uuidbranch was dead code:store.get(uuid)returnsNonefor any malformed UUID first, so the metric reason was unreachable. Moving theUuid::parse_strcheck above the store lookup fixes that, and the newupload_chunk_invalid_uuid_reports_invalid_uuid_reasontest pins it. - Error string typo ("start" → "end") in the missing-
endbranch — straightforward.
Verified locally:
cargo test --release upload_chunk_invalid_uuid_reports_invalid_uuid_reasonpasses.- Rust quality CI (fmt/clippy/test) is green; only Docker image builds are still pending and don't affect this code change.
LGTM — needs a human approval to merge.
rubenhensen
approved these changes
May 16, 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.
Summary
Two small, self-contained fixes in
src/main.rs::upload_chunkper #157:invalid_uuidbranch. Theuuid::Uuid::parse_strcheck sat afterstore.get(uuid), but the store is keyed on the same string passed in the URL, so a malformed UUID always trippedNonefirst and the dedicatedinvalid_uuidreason code was never emitted in metrics. Moved the parse check above the lookup.endbranch reported"Could not read Content-Range start". Now saysend.Closes #157
Test plan
cargo build --release— cleancargo test --release— 86 passed, 0 failedcargo clippy --all-targets --release -- -D warnings— cleancargo fmt --all -- --check— cleanReviewer quickstart:
git fetch origin && git checkout fix/upload-chunk-cleanups && cargo build --release && cargo test --release