Skip to content

Tell what changed in a page since the last visit - #185

Merged
markusressel merged 2 commits into
feature/historyfrom
history-changes
Nov 14, 2026
Merged

markusressel merged 2 commits into
feature/historyfrom
history-changes

Conversation

@markusressel

Copy link
Copy Markdown
Member

A2 of the shared history concept. It needs backend B2 (MkDocsEditor-Backend#97: GET /document/{id}/changes/, PUT /document/{id}/seen/) and goes into feature/history.

  • On open (SeenChangesUseCase.open): the editor asks for the changes since the last look. A banner under the top bar says "Changed by Alice, Bob via Claude Code since you were here", with the changed headings. No banner when:
    • the page was never seen,
    • nothing changed,
    • or only the account itself changed it. Its own agents still count as news.
  • Seen: right after the answer, the page is marked seen with that answer's seenToken, as agreed with web and backend. It is marked again on leaving the page (leave: ON_STOP and when the editor closes), so your own edits don't come back as news.
  • Changes sheet: tapping the banner opens the changes hunk by hunk (the same Hunk view as the history), and a hunk jumps to its place in the page.
  • Notifications and the dashboard open the editor, so the banner shows there too.
  • A server without B2 (404 without a code) shows nothing and marks nothing. A 409 unknown-revision is logged and asked again on the next visit.

Tests: models from real B2 answers (backend-2a), the use case with a fake client (own edits, own agent, first visit, unchanged, old server, leave), and a Robolectric test of the banner.

🤖 Generated with Claude Code

markusressel and others added 2 commits November 14, 2026 04:10
On opening a page, a banner names who changed it since the account last
looked and where; it opens the changes hunk by hunk, and a hunk goes to its
place in the page. The server keeps the seen mark, set with the token of
the shown answer and again on leaving, so the own edits are no news later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The changes since the last visit were asked for inside a state update,
  which runs again when the state changed meanwhile: each run marked the
  page seen, so the shown answer was always empty. Leaving the page no
  longer marks it on ON_STOP either, which the screen gets while opening.
- The account itself is left out of the names of the banner.
- In the history an agent goes with its own person: "Bob via Claude Code,
  Anna" instead of "Bob, Anna via Claude Code".
- Lines with little in common get no word marks.
- A commit time a little ahead of the device clock reads as now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@markusressel

Copy link
Copy Markdown
Member Author

Second commit: fixes from an emulator test against a local backend from master (B1 and B2), with real commits from two accounts and an agent. The banner was always empty: open() was called inside _uiState.update {}, whose compare-and-set loop runs again whenever the state changed in between, and each run marked the page seen. The commit message lists the smaller fixes. Checked on the emulator afterwards: list, diff, open in editor, restore, banner and sheet.

@markusressel
markusressel merged commit 7723605 into feature/history Nov 14, 2026
3 checks passed
@markusressel
markusressel deleted the history-changes branch November 14, 2026 03:36
markusressel added a commit that referenced this pull request Nov 14, 2026
…changed a line (#187)

* Add a REST client for the revision history (#183)

Models follow a real backend answer: authors who are not accounts come
with empty strings, and times carry the committer's offset.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Show the revision history of a page (#184)

The editor menu opens the history: who changed the page and when, with
agents and the changed headings. An entry opens to the inline diff of its
commit with the changed words marked, a hunk opens the editor there, and
editors can restore an older version.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Tell what changed in a page since the last visit (#185)

* Tell what changed in a page since the last visit

On opening a page, a banner names who changed it since the account last
looked and where; it opens the changes hunk by hunk, and a hunk goes to its
place in the page. The server keeps the seen mark, set with the token of
the shown answer and again on leaving, so the own edits are no news later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Fix what the emulator test against a real backend found

- The changes since the last visit were asked for inside a state update,
  which runs again when the state changed meanwhile: each run marked the
  page seen, so the shown answer was always empty. Leaving the page no
  longer marks it on ON_STOP either, which the screen gets while opening.
- The account itself is left out of the names of the banner.
- In the history an agent goes with its own person: "Bob via Claude Code,
  Anna" instead of "Bob, Anna via Claude Code".
- Lines with little in common get no word marks.
- A commit time a little ahead of the device clock reads as now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Undo a single change from the history (#186)

Editors on a server with revert get "Undo this change" on every entry but
the first version. Later changes stay; a conflict names the sections where
they are in the way. The history menu entry and the changes since the last
visit only show on servers that have them, read from server-info features.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Restore a section from the history and tell who last changed a line (#188)

* Restore a single section from the history

A hunk under a heading of an older version offers to restore that section,
on servers with blame (which covers section restore), like the web client.
A section missing in the version or in the page is said in words. Adds the
REST client for blame as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Tell who last changed a line and when

A tap on the author strip, or on the line numbers next to it, asks the
server's blame and shows the author of the lines around it, their agents,
the time and the message of the change, with a way into the history.
Lines not committed yet say so instead of a time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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