Version diffs in the history modal, rendered on the document page - #352
Open
namedgraph wants to merge 2 commits into
Open
Version diffs in the history modal, rendered on the document page#352namedgraph wants to merge 2 commits into
namedgraph wants to merge 2 commits into
Conversation
Add From/To version selection to the Memento history modal and render a client-side triple diff between the two selected versions as Turtle-style hunks: subject header, then -/+ predicate-object lines (red/green, matching the From/To column headers), changed values of the same property paired up. The diff is the set difference over canonical triple keys, computed with the new shared ldh:triples-map() extracted from the origin-vs-local comparison in layout.xsl. The shared key gains an rdf:parseType="Literal" branch (XMLLiteral objects previously keyed on empty text) and an opt-in numeric normalization: layout.xsl keeps it for cross-serializer comparison, the version diff compares exact lexical forms. Both ?version= representations are fetched with a per-branch-context ixsl:http-request fan-out joined by ixsl:all; no server changes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Compare in the history modal now navigates to ?version=<to>&diff=<from> - the diff is display state like ?mode=, read from the URL at render time and never sent to the server, so back/forward re-render it and a plain reload degrades to the ?version= snapshot. ldh:RDFDocumentLoad fetches the compared version through a self-guarding promise step; ldh:rdf-document-response renders the union of both versions (ldh:merge-metadata reused, plus a prune pass so a changed typed block keeps only its current rdf:value) with the one-sided triple-key sets tunneled down the shared template chain. Blocks get diff-added/diff-removed/diff-changed borders via ldh:diff-class() in the bs2:Row emitters, individual property values get marked <dd>s, and a changed XHTML block stacks its old content (red) above the new (green). A legend alert next to the historical-version notice explains the colors. ldh:triple-key() is extracted from ldh:triples-map() so the dd/block decorators and the map builder share one triple identity. The Turtle-hunk rendering from the previous commit is removed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
namedgraph
force-pushed
the
ft-version-diff
branch
from
August 20, 2026 11:23
35efd57 to
f86266c
Compare
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.
Adds version comparison to the graph-versioning history UI (P2.2 remainder).
Selection UI
The history modal's version table gains From/To radio columns (headers colored to match the diff colors) and a Compare button. Defaults preselect the viewed version and its predecessor.
Diff as display state
Compare navigates to
<doc>?version=<to>&diff=<from>. Thediffparam is display state like?mode=: read from the URL at render time, never sent to the server (ldh:snapshot-paramsunchanged), surviving intoldh:PushState. Back/forward re-render the diff; a direct load degrades to the plain?version=snapshot.Rendered union
ldh:RDFDocumentLoadfetches the compared version through a self-guarding promise step;ldh:rdf-document-responsethen renders the union of both versions' descriptions (reusingldh:merge-metadata/ldh:MergeRDF, plus a prune pass so a changed typed block keeps only its currentrdf:value— its hydration factory cannot handle two). The one-sided triple-key sets are tunneled down the shared template chain:diff-added(green) /diff-removed(red) /diff-changed(amber) borders via the newldh:diff-class()in thebs2:Rowemitters<dd>s vialdh:value-diff-class()rdf:_Nentries survive the merge, so removed blocks render near their old positionsShared diff core
ldh:triple-key()(subject | predicate | object identity, XMLLiterals keyed on serialized content, opt-in numeric normalization) is extracted fromldh:triples-map(); the origin-vs-local comparison inlayout.xslis refactored onto the same functions.Known limitations
?diff=URL renders the plain snapshot🤖 Generated with Claude Code