Skip to content

F1: registry has no UNIQUE constraint, so the duplicate-upload race guard never fires #81

Closed

Description

@amar-python

Found in ART Milestone 0 (#53). Code read at main 032b522; not reproduced.

Problem

dynamic_loader.py:321-336 says the duplicate checks are racy and that "the registry's UNIQUE indexes are the real guard". There are no unique indexes on csv_files:

  • api/db.py:199-208 creates the table with no UNIQUE constraint.
  • There are no Alembic migrations (F4).

So two concurrent identical uploads can both pass the check-then-act duplicate test and both register. The UniqueViolation handler never fires.

Fix

Add UNIQUE constraints on csv_files(file_hash) and csv_files(file_name), through a migration once F4 lands. Add a concurrency test that sends two identical uploads in parallel and expects exactly one registry row.

Part of ART M1. BR-28.


Generated by Claude Code

Activity

  1. added this to the ART extension milestone on Oct 26, 2026
  2. added
    bugSomething isn't working
    artART framework extension work
    on Oct 26, 2026
  3. added 2 commits that reference this issue on Oct 26, 2026
  4. amar-python commented on Oct 26, 2026

    @amar-python
    OwnerAuthor

    Fixed by #87, merged as da18cfd. Migration 0002_registry_unique adds UNIQUE constraints on csv_files.file_hash and csv_files.file_name, and both loaders now turn a UniqueViolation into a clean result instead of an error. The deterministic tests in tests/test_migrations.py cover this. CI on main is green.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    artART framework extension workbugSomething isn't working

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions