Skip to content

The merge itself joins the entity history - #472

Merged
WaylandYang merged 1 commit into
devfrom
feat/history-shows-merges
Sep 7, 2026
Merged

WaylandYang merged 1 commit into
devfrom
feat/history-shows-merges

Conversation

@WaylandYang

Copy link
Copy Markdown
Contributor

Opening an entity showed the facts a merge had invalidated, never the merge. entity_merges has had its own clock since #337 (created_at / reverted_at) and no reader on this axis, so the panel stated the consequence and left out the cause — the largest change of mind there is: from here on, this and another entity are the same thing.

entity_history now carries three more kinds:

  • merged_in — another entity was merged into this one.
  • merged_away — this one was merged into another; its id stops standing on its own.
  • merge_reverted — the merge was undone.

Two directions rather than one line, because absorbing and being absorbed are different things on the graph and the rollback is written per direction. The other entity comes back by name (LEFT JOIN, so a purged base still lists the event), and the revert is attributed from the audit trail (merge.revert, target = the merge) instead of the merge row's merged_by: the person who undoes a merge is usually not the one who made it, and an automatic merge has no one there at all. The paging total counts the new branch.

crates/utopia-store/tests/history_shows_the_merge_itself.rs asserts direction, attribution and the total against a real database.

🤖 Generated with Claude Code

Entity merges had a clock since #337 but no reader: opening an entity
showed the facts a merge invalidated, never the merge. `entity_history`
now carries merged_in / merged_away / merge_reverted, with the other
entity by name and the revert attributed from the audit trail rather
than borrowed from the merge row.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: WaylandYang <wayland0916@gmail.com>
@WaylandYang
WaylandYang merged commit a169f3d into dev Sep 7, 2026
4 checks passed
@WaylandYang
WaylandYang deleted the feat/history-shows-merges branch September 7, 2026 22:31
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