Skip to content

fix(upload-folder): explain which folders collided instead of a generic bailout#20

Merged
Bebbssos merged 2 commits into
mainfrom
fix/upload-folder-name-collision-message
Jul 22, 2026
Merged

fix(upload-folder): explain which folders collided instead of a generic bailout#20
Bebbssos merged 2 commits into
mainfrom
fix/upload-folder-name-collision-message

Conversation

@Bebbssos

@Bebbssos Bebbssos commented Jul 22, 2026

Copy link
Copy Markdown
Owner

The bug

ixr upload folder on a local directory tree whose top-level folder name
collides with an already-existing remote folder aborted the ENTIRE upload
with a misleading, unhelpful error, silently dropping every file/subfolder
that needed that colliding folder as a parent — even brand-new content
nested underneath that had nothing to do with the collision.

Root cause: internxt-core's create_folder_with_retry returned
Ok(None) on an "already exists" conflict without ever looking up the
existing folder's uuid, so the CLI had no way to continue treating it as
"found the existing folder" — it could only skip.

Fix (now complete, two repos)

1. internxt-core-rust (separate repo/crate this depends on):
PR #4, merged and
released as 0.1.2. On "already exists," create_folder_with_retry now
looks up and returns the existing folder's uuid (paginating
get_folder_subfolders, matching by exact name) instead of giving up.
Ok(None) is now reserved for the rarer case where even that lookup fails
(a race) or non-conflict retries are exhausted.

2. This repo (now bumped to internxt-core = "0.1.2"): upload_folder
in src/commands.rs fully reworked around the new behavior:

  • The common collision case is now fully transparent — a colliding folder
    (and everything nested under it) uploads normally, logged as Folder ready: X rather than a skip.
  • The shared failed tracker (previously file-only) is now populated by
    folder-level problems too: a genuine Ok(None) (lookup-miss race /
    exhausted retries), an unretryable create_folder_with_retry error, and a
    "parent folder not found because its own creation failed" skip. All three
    used to be either a silent status line or a hard return Err aborting
    everything; now they're tracked per-item and reported in the final
    summary/exit code alongside file failures, and only the affected subtree
    is skipped.
  • Removed the old folder_map.is_empty() all-or-nothing bailout entirely —
    no longer needed, since a genuinely total failure now naturally surfaces
    through the same per-item failed reporting as everything else.

Test plan

  • cargo build --all-features / cargo test --all-features (32/32) /
    cargo clippy --workspace --all-targets --all-features — clean, same
    pre-existing warnings only, none new
  • Live-verified end-to-end against a real account: uploaded a
    3-folder/3-file tree, then uploaded the identical tree again to
    reproduce the original collision. Now: Folder ready: X for all
    three folders (no skip, no abort), and only the 3 genuinely-duplicate
    files fail, each with a clear 409 Conflict reason and exit code 1 —
    exactly the behavior the bug report wanted, replacing the old
    unconditional "Failed to create folders, cannot upload files".

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

Bebbssos and others added 2 commits July 22, 2026 19:13
…ic bailout

When a local folder's top-level name collided with an existing remote
folder, create_folder_with_retry (internxt-core) returned None, and
upload_folder silently swallowed it — every child needing that folder as
a parent was skipped with only a "Parent folder not found" message, and
if the tree had a single top-level folder, folder_map ended up empty,
tripping "Failed to create folders, cannot upload files" with no
indication of what actually happened or which folder was at fault.

Now: report exactly which folder(s) hit a name collision (and their
contents get skipped) as they're discovered, thread real create errors
through with folder-name/path context instead of a bare unlabeled
propagation, and have the final bailout message name the colliding
folder(s) plus actionable next steps.

The real fix — making create_folder_with_retry look up and return the
existing folder's uuid on this conflict, so a collision doesn't need to
skip anything at all — belongs in internxt-core; see
Bebbssos/internxt-core-rust#4 (unreleased at the
time of writing). Once that lands and the dependency here is bumped,
the all-or-nothing folder_map.is_empty() bailout can likely be relaxed
to skip only the affected subtree, matching the per-file partial-failure
reporting used further down in this function. Left a code comment to
that effect.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… bailout

internxt-core 0.1.2 (released, includes PR #4) makes create_folder_with_retry
look up and return the existing folder's uuid on a name collision instead of
giving up, so the common case is now fully transparent: a colliding folder
(and its contents) upload normally instead of being skipped.

Ok(None) is now only the rarer case (lookup miss on a race, or exhausted
non-conflict retries) — treat it the same as any other per-item failure:
track it in the shared `failed` list (moved up so both the folder and file
loops share it) and skip just that subtree, instead of aborting the whole
upload via the old `folder_map.is_empty()` bailout (removed). A missing
parent (because its own folder failed) is now also tracked in `failed`
rather than just a status line, so it's no longer invisible in the final
summary/exit code either.

Live-verified: re-uploading an identical tree (folder-name collision on
every level) now succeeds at the folder level ("Folder ready: x" for all
three, no skipping) and only the genuinely-conflicting files fail with a
clear 409 each — exactly the behavior the original bug report wanted,
instead of the old unconditional "Failed to create folders, cannot upload
files" abort.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Bebbssos
Bebbssos force-pushed the fix/upload-folder-name-collision-message branch from 3860160 to cc9a9e6 Compare July 22, 2026 16:21
@Bebbssos
Bebbssos merged commit 7ca819b into main Jul 22, 2026
1 check passed
@Bebbssos
Bebbssos deleted the fix/upload-folder-name-collision-message branch July 23, 2026 13:03
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.

1 participant