Skip to content

Keep a rewritten thread's quoted words on its card - #1770

Merged
max-sixty merged 11 commits into
mainfrom
thread-original-quote
Oct 5, 2026
Merged

max-sixty merged 11 commits into
mainfrom
thread-original-quote

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

When a later version rewrites the words a comment quoted, Leaf keeps the thread on their section, and the Threads panel used to name it by the section's new heading, so a returning reader saw a passage they never commented on. The card now keeps naming the quoted words, with a quiet "Changed" status in the slot "Earlier data" uses, and "Find in threads" matches those words.

build_threads (events.py) keeps the anchor an automatic reanchor moved off as rewritten_from, until a reply places the thread again, so an agent's explicit move to a section keeps showing the place it chose. The browser's thread record carries the field, and the card and search read it.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 8 commits October 4, 2026 09:27
When a version rewrites the words a comment quoted, the page keeps the
thread on their section, and the Threads panel named it by the section's
new words, so a returning reader saw a passage they never commented on.
The card now marks such a thread with a "changed" link. Pressing it opens
the inline comparison on that section, from the revision the comment was
written on to now, and a second press, or the card leaving, closes it.
"Find in threads" also matches the words the thread was opened on.

- thread/model.js: `rewrittenFrom` reads the rewrite from the opening
  comment's anchor and revision. A reply that moved the thread is not a
  rewrite.
- version.js: `toggleChangeSince` opens the existing inline reading on one
  element from an exact revision, with no page-wide marks. An inline reading
  now records which press opened it, so a Change entry and a thread no
  longer close each other's reading, and a page comparison stopping leaves
  the thread's reading in place.
- passages.js: a reading may break blocks with a newline. The comparison
  uses that so a heading without a full stop and the paragraph under it
  stay two sentences; before, their words interleaved.
- http.py, live_shell.py: a revision also answers at /revisions/rN.html,
  as a version does at /versions/vN.html, since a comment records only the
  revision's number.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Two threads can stand on one rewritten section, from different revisions,
so a reading now belongs to the thread that pressed for it rather than to
threads in general: one card's press takes the other's place, aria-expanded
follows its own reading, and a card that stops offering the link or leaves
the panel closes only its own. A press still loading is cancelled only by
its own thread or a revision, not by another card.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	skills/leaf/scripts/leaf/http.py
A thread whose quoted words a later version rewrote named itself by its
section's heading, and "changed" diffed the whole section, so in a long
section the card no longer said what was quoted and the diff marked every
other edit there. The card now keeps the quoted words, and "changed" shows
only their edit: the deletions overlapping them and the insertions beside
those, found in the old text by the anchor's quote and context.

The inline comparison also weighs each replaced sentence against its own
counterpart, so a rewritten heading stays whole beside a lightly edited
sentence after it, and a deletion running to a block's end stands on its
own line rather than splicing onto the next block.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A quote can stop resolving with its words still in place, as when a second
copy makes it ambiguous, and a quote taken from generated words never
appears in the authored text. Either way "changed" marked nothing or the
whole section; it now says the words are unchanged or not found instead.
The card names the opening quote through the same label every thread uses,
so a design thread keeps its prefix.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	skills/leaf/assets/runtime/thread/thread-card.js
The "changed" diff drew struck and inserted words into the page, which
the version comparison and later revisions also own, so it needed
per-thread ownership, fetch cancellation and card-lifetime closing, and
each review round found another lifetime case. It is removed, with the
revision-number address it fetched through and the alignment and reading
changes made for it; version.js, passages.js, text-alignment.js, http.py
and live_shell.py are back to main.

What stays: a thread whose quoted words a later version rewrote keeps
naming those words on its card, with a quiet "Changed" status in the slot
"Earlier data" uses, and "Find in threads" matches them.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The committed browser bundle is stale. The test job fails npm run check:browser on three generated outputs because the browser framework imports the changed thread model. Rebuild and commit those outputs so the shipped bundle matches this source change.

max-sixty and others added 2 commits October 4, 2026 16:40
A reply that moves a thread to its section alone leaves the same anchor
shape an automatic reanchor does, so the card called an agent's chosen
place "Changed" and named the old quote instead. The fold now keeps the
anchor a reanchor moved off as `rewritten_from` until a reply places the
thread again; the card and "Find in threads" read that, and the browser's
public thread record and a locally opened thread carry it. Rebuilds the
committed browser bundle, which the thread model is part of.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	build/browser/generated/browser-runtime.js.map
#	build/browser/generated/browser-runtime.manifest.json
#	skills/leaf/assets/vendor/browser-runtime.js
leaf-agent
leaf-agent previously approved these changes Oct 4, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 21d6715 into main Oct 5, 2026
5 checks passed
@max-sixty
max-sixty deleted the thread-original-quote branch October 5, 2026 00:24
max-sixty pushed a commit that referenced this pull request Oct 5, 2026
The gallery revision case still expected an automatically reanchored
thread card to replace its quoted words with the new paragraph text.
Since #1770, the card keeps the original quote with a “Changed” label
while the active anchor moves to the surviving section. The existing
test already checks both durable `reanchor` events; this change checks
the retained quote and that the card's anchor remains actionable. The
former assertion failed in [the main
run](https://github.com/max-sixty/leaf/actions/runs/37260003321).

The focused browser case failed before this update and passes afterward.
No product behavior changes.

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 10, 2026
The two datum replacement tests now expect the visible `Changed` status
when a saved quotation's words differ from the current value. Their
checks that the comment, draft, and mark follow the stable datum remain
in place. [#1770](#1770) added
this status for changed quoted words; these older datum tests still
expected no status. This repairs both datum failures in [main CI run
37929061293](https://github.com/max-sixty/leaf/actions/runs/37929061293).

Verification: both tests failed before the assertion update and pass
after it.


The branch now includes current main, including #2171’s bounded sample
loader, which repairs the shared `ERR_INSUFFICIENT_RESOURCES` /
entry-module presentation failure in these older CI runs.

Current-main validation: the exact affected browser cases pass locally;
independent source review found no actionable issues. Fresh broad CI
runs on this updated head.

> _This was written by Codex on behalf of max-sixty_

Co-authored-by: leaf-agent <[email protected]>
Co-authored-by: Maximilian Roos <[email protected]>
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