Skip to content

Reject duplicate source filenames on new document ingest - #426

Merged
EricNGOntos merged 2 commits into
mainfrom
feat/wuchengke/duplicate-filename-conflict
Sep 17, 2026
Merged

EricNGOntos merged 2 commits into
mainfrom
feat/wuchengke/duplicate-filename-conflict

Conversation

@EricNGOntos

Copy link
Copy Markdown
Contributor

Summary

  • Reject a new ingest when the same user/namespace already has an active document with that source_file_name.
  • Allow replacement when the request includes document_id; same name is still allowed across namespaces, other users, and archived documents.
  • Return 409 ALREADY_EXISTS with the existing document id so the client can retry as an update.

Test plan

  • make check
  • pytest apps/api/tests/unit/test_document_ingestion_duplicate_filename.py
  • Remote Backend CI green, then merge

Made with Cursor

EricNGOntos and others added 2 commits September 17, 2026 11:36
- Added a new method to reject duplicate source file names during document ingestion.
- Integrated the duplicate filename check into the job creation process to prevent conflicts.
- Introduced helper functions for finding active documents by source file name and raising appropriate exceptions.
- Enhanced tests to verify conflict handling for duplicate file names across different scenarios.
The full create_v1/v2 unit path queried jobs during scope resolution, so the sqlite fixture failed in CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
@EricNGOntos
EricNGOntos merged commit 1ab931d into main Sep 17, 2026
6 checks passed
@EricNGOntos
EricNGOntos deleted the feat/wuchengke/duplicate-filename-conflict branch September 17, 2026 04:47
@EricNGOntos EricNGOntos mentioned this pull request Sep 17, 2026
1 task
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