Skip to content

fix(id/web): make upload-name claiming atomic (#2363) - #3425

Merged
dezren39 merged 1 commit into
mainfrom
queue/5250-2363-upload-name-atomic
Nov 1, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/5250-2363-upload-name-atomic

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Closes #2363. Queue task 5250 (follow-up from triage task 3521, verdict CONFIRMED).

Problem

upload_handler resolved the stored name via uniquify_upload_name (get-only check) and claimed it with a separate awaited unconditional tags().set — two concurrent same-name different-bytes uploads could both resolve to the same free name, and the later set silently un-named the first (the #1549 failure mode, concurrent case). Filename-keyed metadata written after the tag set could also describe the losing upload.

Fix

Scope note (stated in code): the lock coordinates handlers sharing one AppState; independent states/processes and non-upload tag writers do not participate — matching the packet scope.

Tests

Verification: targeted cargo test --features web --lib upload_router_tests on the laptop — result posted on #2363 when it lands.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Hold an AppState upload-name mutex across uniquify-resolve, the tags().set claim, and the filename-keyed metadata writes in upload_handler, so two concurrent same-name different-bytes uploads can no longer both resolve to the same free name and silently un-name the first (#1549 concurrent case). Sequential semantics unchanged. Adds a regression test that interleaves two same-name uploads at the resolve/set boundary (via the same lock) and asserts distinct stored names, per-blob responses, listing/resolvability, and metadata describing the blob each name resolves to.
@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 09:43
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 27 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1dc192a8-745e-4ccd-984a-8161a29bc915
Commits

Reviewing files that changed from the base of the PR and between ab6c84c and 2329930.

Files selected for processing: 2
  • pkgs/id/src/web/mod.rs
  • pkgs/id/src/web/routes.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T08:45:02.308899Z 2329930 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit 7d0c1a8 into main Nov 1, 2026
1 check passed
@dezren39
dezren39 deleted the queue/5250-2363-upload-name-atomic branch November 1, 2026 09:58
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.

id(web): PR #1696's upload-name uniquifier is check-then-act — concurrent same-name uploads still silently un-name the first

1 participant