fix(api)!: a taken file path is a duplicate, with the field named - #122
Merged
Merged
Conversation
Moving or renaming a file onto a taken path answered the generic conflict, while an upload onto one hit an unmapped constraint: duplicate, no fields, and a warning in the log. Both now answer duplicate with `fields` naming path, and an upload onto a taken externalId names that field too. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: jgjesdal <jostein@intellistream.ai>
olavgg
approved these changes
Sep 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
POST /files/updateonto a taken path: the response was the genericconflict. It is nowduplicatewithfields: [{"field": "path", …}].PUT /files(upload) onto a taken path or externalId: the partial unique indexinodes_path_hash_active_ukand the constraintinode_external_id_hash_keywere missing fromDataIntegrityViolationExceptionHandler's map. The 409 therefore came back as aduplicatewith no fields, and the server logged "Unmapped constraint violation". Both are mapped now, so the 409 namespathorexternalId.DuplicateProbleminstead ofApiProblem.Compatibility
conflicttoduplicate.duplicateand only gainsfields.Not verified
A unit test covers the constraint-name map. I have not checked against a real Postgres that Hibernate reports the partial unique index's name on a unique violation (23505). Postgres words it as
violates unique constraint "inodes_path_hash_active_uk", which is what the name extractor parses.Docs (datahub-sdk-docs)
The 409 row in
reference/files.md§Upload › When it fails could mentionfields.This is one of four independent problem-type PRs (see #120). They merge cleanly with each other in any order.
./gradlew :datahub-api:testpasses.🤖 Generated with Claude Code