Skip to content

Give each commented part of a picture its own margin entry, named and traced by the part - #6417

Merged
max-sixty merged 3 commits into
mainfrom
chart-element-comments
Nov 18, 2026
Merged

max-sixty merged 3 commits into
mainfrom
chart-element-comments

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A thread on one part of a picture, such as an lf-chart point or an lf-diagram node, now has a margin entry of its own instead of joining the picture's. The entry and its Page Map group are named by the label the part registers, as the comment box names it ("chart · week 3, sessions 8,412"). The entry stands level with its part, its card opens beside the part, and hovering or focusing it traces the part on its registered surface rather than the whole picture. This applies to any visual that calls registerVisualParts. A part the picture hasn't drawn yet keeps its own named entry at the picture's top, and a saved draft on a part behaves the same way.

Pointer on the week 2 entry: before After

resolveAnchor now carries a part's label with its element and surface, so the margin names a part from the lookup that placed it. Anchor placement places saved drafts as it places threads (savedAt), which replaces the inventory's own draft-placement reading and keeps a draft on a part in step when the picture redraws. The margin's ResizeObserver no longer watches boxes a visual draws, since lf-chart redraws inside a size delivery and raised a ResizeObserver loop error; a visual already reports its parts' moves through update(), and module-annotations.md now says so.

Calls to weigh:

  • On a picture wider than the column, entries are pins at its right edge, so two nodes on one line of a left-to-right diagram stack there and read apart only on hover or in Page Map (below, the pointer on "Start request").
  • The trace on a diagram node is the quiet grey contour, not the brackets the whole picture got.
  • Two commented dots list in Page Map in comment order, not data order.

This follows #6371, which the user asked for, and Codex reviewed it three times. Tests: runtime suite (1,047), check:browser, and the focused browser tests on part entries, chart points and saved-draft entries; each new assertion fails with its fix reverted.

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

… traced by the part

A thread on one part of a picture, such as an lf-chart point or an lf-diagram
node, now has a margin entry of its own instead of joining the picture's. The
entry is named by the label the part registers, as the comment box names it
("Thread, chart · week 3, sessions 8,412"), and so is its Page Map group.
It stands level with its part, as a pointed row stands level with its row, and
its thread card opens beside the part. Hovering or focusing the entry traces the
part, on the surface its visual registers, rather than the whole picture. A part
the picture hasn't drawn yet, as in a shut tab, keeps its own entry and name,
stands at the picture's top and traces the picture. A comment the user put away
unsent on a part does the same.

Resolving a part's anchor now carries the part's label with its element and
surface (`resolvedElement`'s `label`), so the margin names a part from the same
lookup that placed it rather than searching the visual's parts again for each
thread on every collection. The inventory builds a part's row with the
pointed-row grouping: the part's id keys the row, the part's element is the
row's point, and `entryPart` gives the part and its surface for the rows whose
point is what the thread is about. A pointed row's point says only where its
comment stands, so hovering it still traces its whole target.

Anchor placement now places each saved comment draft as it places a thread,
and the inventory reads it there (`savedAt`) instead of keeping its own cache
of draft placements per page reading. A draft is then placed again whenever a
thread would be, and its moves count in the placement version. With the cache,
a draft's entry on a chart point traced the whole chart after the chart drew
itself again for a narrower box, until something else refreshed the margin.

The margin's ResizeObserver no longer watches boxes inside a picture (a tag
that declares `visual`), only the picture's box and the boxes around it. A
part's row stands level with a box the picture draws, and lf-chart draws afresh
inside a size delivery, so watching that box raised "ResizeObserver loop
completed with undelivered notifications" when the window narrowed, which
test_a_comment_on_a_chart_s_point_stays_on_its_datum caught. A picture reports
its parts' moves through its registration's `update()`, which runs a margin
pass. The same rule now covers a contribution registered on a part element.

Behavior changes in tests: test_a_comment_on_a_chart_s_point_stays_on_its_datum
now presses the week 3 point's entry, since the chart has an entry per point.
New runtime tests resolve part anchors as placement does and check that two
parts of one picture, a part it hasn't drawn and a saved draft on a part each
stand an entry named by the part, and that `entryPart` gives a part's own
surface and nothing for a pointed row. The seeded placement test now holds a
saved draft's placement to a fresh resolution after every change too, and new
ones check that a saved draft on a part follows the part once it is drawn and
that placement's hearers never hear a saved draft as a thread. New
browser tests check that hovering a chart point's entry rings that point and a
diagram node's entry traces that node, and that a draft put away on a chart's
point still traces it after the chart draws again. Codex reviewed the change
three times; each later pass checked the fixes for the one before.

Worth weighing:

- Entries stand level with their parts, and so do their cards. On a picture
  wider than the column the entries are pins at the picture's right edge, so
  two nodes on one line of a left-to-right diagram stack there, and which is
  which shows only on hover, focus or in Page Map.
- The trace's grey ink on a diagram node's contour is quieter than the brackets
  it drew round the whole picture.
- A chart orders its point rings by when each was first asked for, so two
  commented dots read in the order their comments were placed rather than by
  their data.

> _This was written by Claude Code on behalf of max-sixty_
# Conflicts:
#	browser/runtime/anchor-placement.js
#	browser/runtime/annotation-inventory.js
#	tests/runtime/anchor-placement.test.mjs
…ate() moves them

The visual-parts reference now says label(id) names a part in its margin
entry and Page Map as well as Threads, and that the margin learns a part
moved inside its visual only from update(), since the margin no longer
watches boxes the visual draws. Two inventory comments follow the code:
the pointed-row record names its surface, not a part.

> _This was written by Claude Code on behalf of max-sixty_
@max-sixty
max-sixty merged commit 4bcb736 into main Nov 18, 2026
5 checks passed
@max-sixty
max-sixty deleted the chart-element-comments branch November 18, 2026 20:48
max-sixty added a commit that referenced this pull request Nov 18, 2026
#6413 and #6417 landed on main 15 seconds apart. #6417's `savedAt` called
`placement()` and `reads(placement)`, which #6413 had replaced with versions
its readings check, so on main `savedAt` throws a ReferenceError whenever the
margin reads a saved comment draft, and the browser type check and three
anchor-placement runtime tests fail. `savedAt` now settles and reads
placement's version as `placedAt` does, and the merge of main into this
branch no longer leaves it written twice.
max-sixty added a commit that referenced this pull request Nov 18, 2026
…t gallery (#6420)

**Main is broken until this lands.** #6413 and #6417 merged 15 seconds
apart, and #6417's `savedAt` still called `placement()` and `reads()`,
which #6413 had removed. On main, `savedAt` throws a ReferenceError
whenever the margin reads a saved comment draft, and the browser type
check and three tests in `anchor-placement.test.mjs` fail. `savedAt` now
reads placement as `placedAt` does; those tests fail on main's file and
pass here.

`leaf-dev placement cards` now has a case for a thread on one point of a
chart. Since #6417 a thread on a part of a picture has its own margin
entry and its card opens beside that part, but the gallery could only
put a thread on a block or on quoted words. A case now takes `visual`,
the part as an anchor names it, and the fixture page gains a chart of
dots below its wide table. Each capture outlines what the card keeps
clear of: the resolved element where the target names one, and the block
otherwise. A part's capture therefore outlines the point rather than the
whole chart, and every other case outlines the same box as before.

| 1440×900: beside the point | 1000×700: above the point |
| --- | --- |
| <img width="420"
src="https://gist.githubusercontent.com/max-sixty/cb0cd2b18d4f4718c5603b1ae50a92d7/raw/f46a65464c56682e47a1ec9914c3619d9170d24a/cards-chart-point-1440.png">
| <img width="420"
src="https://gist.githubusercontent.com/max-sixty/cb0cd2b18d4f4718c5603b1ae50a92d7/raw/f46a65464c56682e47a1ec9914c3619d9170d24a/cards-chart-point-1000.png">
|

In the 1000×700 window the card stands above the point and clear of it,
but it covers the chart's upper half, including the week 4 and week 5
dots. It keeps clear of the part alone, as `comment-placement.js` has a
card on a pointed table row keep clear of that row rather than the
table.

The gallery case was a follow-up the user asked for once #6417 landed.
Tests: `check:browser`, the anchor-placement, annotation-inventory and
kept runtime tests, and `uv run leaf-dev placement cards --case
chart-point --case words` in Chromium, where the `words` case reads as
before.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 19, 2026
…ting (#6428)

A reload asks for its document before the page it replaces goes away.
Where that page then hears the server take its last draft write, it
holds the draft as durable, and #6399's handoff leaves the reload only
drafts still waiting, so the reload shows the older generation it was
served until its first look. Words typed on arrival go over that older
generation and are replaced by the departing page's words. This is the
flake in `test_held_keys_stand_beside_a_saved_draft` ("H" for "Half a
thought", 2 of 13 runs under `-n 3` on a loaded Mac, with #6399 in).

The page now leaves its durable copies in the tab too, still marked
durable so the reload doesn't write them again; a served generation
older than a copy gives way to it by version in `hearReading`, as for
any reading.
`test_words_typed_on_a_reload_stand_over_a_write_taken_as_it_was_served`
serves the reload a document fetched before the write lands and fails on
main. The saved-draft test drops the wait-for-save step #6416 added; its
selection passed 8 of 8 runs.

To weigh: a store that went back as the page reloaded (a server
restarting from an older copy) isn't heard by the reload, so a durable
copy shows words the server lost and isn't written back; main drops
them. A Codex review found that taking the copies' versions as the
reload's heard store version, which would catch that, suppresses reads
of other drafts, so it's left out. Codex also confirmed a pre-existing
flaw this doesn't touch: recovery after a rollback writes the tab's
words over a generation another device wrote after the rollback.

`pnpm run check` and `pnpm run test:runtime` fail on main at the moment
in `anchor-placement.js`, from #6417; this change doesn't touch it.

Found while following up the saved-draft flake from #6383.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent added a commit that referenced this pull request Nov 19, 2026
…t each commented part has its own margin entry (#6524)

Since #6417, each commented part of a picture has its own margin entry.
On `lf-trace` that splits the node comment and the frame comment into
two entries, so the card opened on either one holds a single thread and
draws no Previous/Next thread buttons.
`test_trace_comments_restore_an_exact_image_and_duplicate_named_element`
clicked the card's Next thread to get from one thread to the other, and
timed out waiting for a button #6417 meant to remove.

The journey now crosses between the two threads with the page walk's `t`
and `Shift+t`. It still checks what it protects: each thread restores
the evidence it was written on, meaning the frame comment brings back
its captured image and the node comment its "After checkpoint" tree. The
two checks it drops were about the card's own buttons (a click on ‹ or ›
lands in the reply, and Escape moves focus to the thread). Those are
general card behavior that
`tests/browser/margin/test_opening_threads.py` covers on a shared
passage, not anything specific to the trace.

On this runner the test failed before the change with the reported
`Locator.click` timeout on `Next thread`, and passes after it.

Closes #6517 — automated triage

Co-authored-by: leaf-agent <[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