Repository navigation
Description
This issue was written by an AI assistant (Claude) from a conversation with the maintainer. Check the details before you act on them.
Problem
When a user suggests a property and the server rejects it as a conflict, the user does not see which property caused the conflict. PropertiesError::Conflict (src/domain/properties.rs) has no data, and the web layer returns only a 409 with the brief "Conflict". The UI (conflict snippet in ui/src/routes/app/[id]/[[slug]]/suggestProperty.svelte) shows only the value that the user typed: "already exists on this item (or is too close to an existing item). Upvote it". "Upvote it" is underlined text, not a link or a button.
Causes of a conflict
src/db/properties_repository.rs returns Conflict in 3 places:
- Similarity. The query finds values in the same class with
normalized_damerau_levenshtein > 0.8. It searches the globalpropertiestable, not only the properties of this item. Thus a user can get a conflict with a property that is not on this item. Thesimilar_propertieslist is available here, but the code only writes it to a debug log. - Exact duplicate. The same class and value is already linked to this item.
- Race. The unique index rejects the
RELATE.
Proposed change
- Change
PropertiesError::Conflictto hold the conflicting properties, for exampleConflict { existing: Vec<Property> }. Fill it fromsimilar_propertiesfor cause 1 and withtest_propfor causes 2 and 3. - Return the list in the 409 response body as external types, not
RecordIdvalues. Add it to the OpenAPI schema. - In
suggestProperty.svelte, list each conflicting property. If the property is on this item, give a vote button. If it is not on this item, let the user suggest that value instead of the value they typed. - Change the message so that it does not say "on this item" when the match came from the global table.
Other callers that match PropertiesError::Conflict (src/db/properties_actor.rs, src/processing/ml_queue_actor.rs, src/web/properties.rs) must change to Conflict { .. }.
Question
Is cause 1 intended to search all items? If so, the system rejects a new value for an item when a similar value exists on any item of the same class. That is a canonicalisation rule, so the UI must show the canonical value to the user. If not, the query must be limited to the properties of this item.
Activity