Skip to content

viewer: show a revision pair as real diffs, field by field, split or unified - #66

Draft
joelburget wants to merge 5 commits into
sdiehl:mainfrom
joelburget:improve-code-and-field-diffs
Draft

viewer: show a revision pair as real diffs, field by field, split or unified#66
joelburget wants to merge 5 commits into
sdiehl:mainfrom
joelburget:improve-code-and-field-diffs

Conversation

@joelburget

Copy link
Copy Markdown
Contributor

The code viewer's revision pair showed two full bodies side by side and a bare "changed — previously" for anything else, leaving the reviewer to find the edit by eye. Bodies are now aligned line by line with a Myers diff and word-level marks inside edited lines (no dependency: the viewer's own painter keeps every token class and navigable reference on both sides), with long unchanged runs folded. Every other field reads as a diff too — signature, effect row, docstring, kind/visibility/claims/deprecation tags, and each relation row (callers, calls, tests, uses, members) as the set it was against the set it is, with the status line naming what moved. A page-wide split/unified control (remembered) lays pairs out old-beside-new or old-above-new, and any card can choose its own. To diff relation rows, prism index --diff now records the edge delta (edges: {added, removed}) in the artifact; the viewer rebuilds the old dependency graph as new − added + removed, and an older artifact without the field simply leaves relation rows undiffed.

🤖 Generated with Claude Code

joelburget and others added 5 commits August 25, 2026 09:04
Two full bodies side by side left the reader to find the edit by eye. The
card now aligns the two revisions line by line with the shortest edit
script (Myers), tints what one side has and the other lacks, marks the
words that moved inside an edited line, pads the short side of an uneven
edit so the rows stay level, and folds long runs of unchanged lines to
their ends. Both sides keep their syntax painting and links.

No dependency: the painter already owns every token and reference, so a
diff library would have rendered the text without either. The painter
learned two things for this — an innermost emphasis layer, and never
letting a newline fall inside a tag, so painted text splits cleanly into
one well-formed fragment per line.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
"changed — previously" over a card whose body had not moved told a
reviewer that something changed and left them to find it. Every field a
review reads is now a diff against the other revision: the signature,
effect row and docstring by the same line-and-word engine the body uses;
the kind badge, visibility, claims and deprecation as tags that left and
tags that arrived; and each relation row — callers, calls, tests, uses,
members — as the set it was against the set it is, with a chip that left
struck through and one that arrived marked, never hidden behind the
row's cap. The status line names the fields that moved.

A page-wide control lays every pair out split (old beside new) or
unified (old above new), remembered across visits; any card can choose
its own layout for the visit.

The relation rows need the old dependency graph, which the diff artifact
did not carry. `prism index --diff` now records the edge delta — the
edges one revision has and the other does not — as an `edges` field,
always present so "nothing moved" reads differently from an artifact
written before the field existed. The viewer rebuilds the old graph as
new − added + removed and asks it the same questions it asks the new
one; with an older artifact the relation rows simply do not pretend.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A doc diff kept the docstring's measure, the body spanned the card, and a
relation row split after its label column, so three dividers on one card
sat at three different places. Every split field now bleeds to the card's
edges and divides at its midpoint; the relation rows' chip halves are sized
to meet the same line past the label.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The split relation row inherits the row's 8px gap twice before its new
half, which the midpoint calculation left out, so its divider sat 16px
right of the body's.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@joelburget
joelburget force-pushed the improve-code-and-field-diffs branch from 82d6cd2 to 8d3513b Compare August 25, 2026 16:11
@sdiehl

sdiehl commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Hi Joel, very nice as always! And its great it works with the v20 version already.

I'll probably get through to reading through this weekend and can fold this into v21. 👍

@joelburget

Copy link
Copy Markdown
Contributor Author

Hey Stephen, take your time. I left it as a draft because I haven't had the time to review everything myself yet. I'll hopefully get to it in the next few days, and will mark it ready for review at that point.

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.

2 participants