Skip to content

Duplicates can be decided in a batch and filtered by type - #429

Merged
WaylandYang merged 1 commit into
devfrom
feat/review-batch
Sep 6, 2026
Merged

Duplicates can be decided in a batch and filtered by type#429
WaylandYang merged 1 commit into
devfrom
feat/review-batch

Conversation

@WaylandYang

Copy link
Copy Markdown
Contributor

First cut of #428, capability only; the review page follows.

What it adds

  • POST /kbs/{id}/review/batch{ ids: [...], action: "merge" | "keep" }, Editor, 1–500 ids. Every id goes through the same decide_review a single decision uses: same merge direction, same status and decided_by, an audit row per success (with the batch size in its detail). One failure — an id that does not exist, a pair already decided, a merge that errors — does not stop the rest; the response lists each id with its error or none. An unknown action rejects the whole batch. The review stream is pushed once at the end.
  • ?types= on the duplicates queueany (default), same (both sides typed and equal), conflict (both typed and different). A side with no type is in neither of the last two: not knowing is neither "same" nor "different". review::counts gains duplicates_same_type and duplicates_type_conflict on the same predicate, so the rail's numbers and the list agree by construction.

Not done on purpose

No automatic merge of identical-name, same-type pairs (the issue's point 2). Same name and same type is not identity, and the base's rule stands: a namesake tie goes to a person. The filter plus the batch make that person's click one click.

Verified

crates/utopia-store/tests/a_batch_decides_like_a_person.rs on a real database: four namesake pairs (two same-type, one type-conflict, one with an untyped side); the three filters return exactly the expected ids and the counts match them; a batch merge of two real ids and one ghost merges the two, reports the ghost, and leaves exactly one entity of each pair merged into the other with the decider recorded; deciding an already-decided pair reports an error; a batch keep clears the conflict pair and the counts follow. review_stages still passes with the new signature. cargo fmt, cargo clippy --all-targets -D warnings.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: WaylandYang <wayland0916@gmail.com>
@WaylandYang
WaylandYang merged commit 8a2b8cc into dev Sep 6, 2026
4 checks passed
@WaylandYang
WaylandYang deleted the feat/review-batch branch September 6, 2026 06:38
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