Skip to content

fix(files): uniquify materialized upload names - #6273

Merged
j15z merged 3 commits into
stagingfrom
fix/mship-materialize-name-collision
Aug 6, 2026
Merged

fix(files): uniquify materialized upload names#6273
j15z merged 3 commits into
stagingfrom
fix/mship-materialize-name-collision

Conversation

@j15z

@j15zj15z commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • allocate an unused root-level workspace file name before materializing uploads
  • retry exact name-index collisions with the next suffix while preserving replay and storage accounting
  • return the final persisted name in materialize_file results so Mothership can address renamed files

Type of Change

  • Bug fix

Testing

  • 54 related Vitest tests passed
  • TypeScript type-check passed
  • API validation and changed-file lint checks passed
  • full ship generators, lint, and CI audit checks passed
  • manually verified trace 6725ea941acc0d4547de9a741f288284 returned dogs (2).pdf and Mothership used the chosen name

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercelBot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
docsSkippedSkippedAug 5, 2026 1:55am

Request Review

@cursor

cursorBot commented Aug 5, 2026

Copy link
Copy Markdown

PR Summary

Cursor Bugbot is generating a summary for commit 26e6206. Configure here.

@greptile-apps

greptile-appsBot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes upload materialization allocate an unused root-level workspace filename and preserves the selected name across persisted metadata and replay responses.

  • Retries transactions when the workspace filename uniqueness constraint detects a concurrent collision.
  • Resolves replayed materializations from the current workspace-file record.
  • Adds tests for suffix allocation, collision retries, retry exhaustion, unrelated uniqueness errors, and replay behavior.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

FilenameOverview
apps/sim/lib/copilot/tools/handlers/materialize-file.tsAdds unique root-name allocation, targeted collision retries, synchronized persisted names, and replay lookup without an eligible follow-up defect.
apps/sim/lib/copilot/tools/handlers/materialize-file.test.tsExpands coverage for allocation, collision handling, bounded retries, storage accounting, and replay outcomes.

Sequence Diagram

sequenceDiagram
participant C as Materialize caller
participant A as Name allocator
participant DB as PostgreSQL
C->>A: Allocate root-level filename
A->>DB: Check available names
A-->>C: Candidate filename
C->>DB: Transition upload in transaction
alt Filename collision
DB-->>C: Targeted unique violation
C->>A: Allocate again
else Transition succeeds
DB-->>C: Materialized workspace file
else Transition already completed
C->>DB: Read current workspace file
DB-->>C: Replayed file metadata
end
Loading

Reviews (2): Last reviewed commit: "fix(files): sync materialized display na..." | Re-trigger Greptile

Comment threadapps/sim/lib/copilot/tools/handlers/materialize-file.ts
@j15z

j15z commented Aug 5, 2026

Copy link
Copy Markdown
CollaboratorAuthor

@greptile

@j15z

j15z commented Aug 5, 2026

Copy link
Copy Markdown
CollaboratorAuthor

@cursor review

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 902de3f. Configure here.

@j15z
j15zforce-pushed the fix/mship-materialize-name-collision branch from 902de3f to bbf7a55CompareAugust 5, 2026 01:54
@j15z
j15z merged commit 5baa7a4 into stagingAug 6, 2026
30 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/mship-materialize-name-collision branch August 6, 2026 01:59
Sign up for freeto 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

@j15z