Repository navigation
Give state readings and revision rules one owner each - #2484
Merged
Merged
Conversation
Readers that took state back from the rendering now read the application
publisher, and rules written twice now have one home.
Behavior changes:
- A thread on a line of a diff file not yet loaded is titled by its line
("§ app.py · new line 1") rather than "§ diff". The datum label is
read where resolution finds datums (`anchor-resolution.js`,
`datumLabel`), and a lazy widget names a datum it has not drawn
through a new `lfDatumLabel(key)` hook, which `lf-diff` implements.
`test_a_manifest_diff_can_comment_on_one_unloaded_file` gains that leg,
which fails on the base.
- The page's reading takes a retired slot from the publisher's widget
state rather than reading `data-lf-retired` back, so a slot painted
retired where the log decided nothing keeps its words in the reading.
Slots inside a holder's shadow root are covered too; the old selector
missed them. The page reading is
forgotten when the settlements change.
- Version comparison folds the base revision's authored values under
its projection and compares that with the publisher's current widget
state, instead of reading current state back from the DOM. An event
admitted under a different declaration of its verb is left out of the
base fold rather than throwing.
- `quoted()` has one answer, the widget descriptor's authored-ancestry
reading, which the controller's actions already use;
`widget-descriptors.js` owns it.
- A malformed fragment escape keeps its literal characters at first
paint and in `lf-tabs`, as followed links already did.
One home each, no behavior change:
- "The page shows the active revision" is `runtime.showsActive`,
replacing `!==` and `>` comparisons in version.js, context.js and
state-feed.js.
- Fragment decoding lives in prepaint.js (`lfInitial.fragmentId`);
`lf-tabs` finds a fragment's panel through `fragmentTarget`, now on
widget-api.
- The state coordinate key is `stateCoordinate`/`coordinateOf` in
projection/model.js, used by the publisher and annotation-inventory.
- A local action's meaning reads its widget's captured declaration, as
its reading does, rather than the document registry.
- `projectData` clears stale datums in the declared shadow roots
resolution reads (`shadowRootsIn`).
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The state half of a comparison marked a card only when its column changed, so a card the author moved within a column read as unchanged. It now also marks the cards outside the longest run that keeps the base order, the fewest cards whose moving explains the new order. `test_the_diff_marks_the_card_the_author_reordered_and_no_other` fails on the container-only rule. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # skills/leaf/assets/runtime/anchor-resolution.js # skills/leaf/assets/runtime/context.js # skills/leaf/assets/runtime/initial-render.js # skills/leaf/assets/runtime/thread/messages.js # skills/leaf/assets/runtime/version.js # skills/leaf/assets/runtime/widget-api.js # skills/leaf/assets/runtime/work.js # skills/leaf/packages/default/widgets/lf-tabs.js # skills/leaf/references/module-authoring.md
leaf-agent
approved these changes
Oct 12, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 12, 2026
Main's #2484 folded the browser's exhibit reading into the widget descriptor (`quoted` in widget-descriptors.js) and counted the exhibit itself as quoted; the merge keeps that one home and this branch's strict rule, which `questions.quoted_in` and tests/exhibit_cases.json hold. The version comparison's state half takes main's publisher-based reading, and the served projection entries key their coordinate with `stateCoordinate`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
added a commit
that referenced
this pull request
Oct 12, 2026
…2550) The [main CI run](https://github.com/max-sixty/leaf/actions/runs/38204537786) found that `test_a_settled_third_party_holder_wears_the_layers_mark` could restore a retired passage but its thread quote stayed detached. Reading the unchanged page after the first widget decision appended a permanent `reanchor` with a null anchor. The later decision restored the passage, but could not undo that recorded relocation. `revision_reanchors` now records relocation only when authored source becomes a new revision. A widget decision within the current revision may hide or restore the passage; the browser resolves the thread against that current state without making the temporary detachment durable. This preserves the intended revision behavior introduced in [#2484](#2484). The focused browser test failed before this change and passes afterward. The existing file-side test for a passage removed by a real revision also passes (`uv run pytest tests/test_render_projection.py::test_a_settled_third_party_holder_wears_the_layers_mark tests/test_interact_anchors.py::test_a_quote_without_a_section_detaches_when_its_words_disappear -q -n0`). --------- Co-authored-by: leaf-agent <[email protected]>
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.
Workstream #14 of the duplicate-logic sweep. Two readers took browser state back from the rendering, which
skills/leaf/assets/AGENTS.mdforbids, and several rules were written more than once. Each now has one owner, and every caller uses it.Behavior changes
anchor-resolution.js(datumLabel), the same way resolution finds datums, and a lazy widget names a datum it has not drawn through a newlfDatumLabel(key)hook, whichlf-diffimplements (module-authoring.md).test_a_manifest_diff_can_comment_on_one_unloaded_filegains that leg, which fails on the base.passages.jsreads each holder's standing outcome from the published widget state instead of readingdata-lf-retiredback, and forgets the page reading when those outcomes change. A slot painted retired where the log decided nothing keeps its words in the reading, and slots in a holder's shadow root count too (the old selector missed them).foldWidgetStatesand compared with the publisher's current widget state. An event admitted under a different declaration of its verb is left out of the base fold rather than throwing. A card the author moved within its column is now marked, the fewest cards whose moves explain the new order (test_the_diff_marks_the_card_the_author_reordered_and_no_otherfails on the base's column-only rule).quoted()has one answer.widget-descriptors.jsowns it: the descriptor's authored-ancestry reading, which a widget's actions already used, rather than a liveclosest().One home each, no behavior change
runtime.showsActive(context.js), replacing!==and>comparisons inversion.js,context.jsandstate-feed.js.prepaint.js(lfInitial.fragmentId), whichinitial-render.jsexports to modules.stateCoordinate/coordinateOfinprojection/model.js, used by the publisher andannotation-inventory.js.projectDataclears stale datums in the declared shadow roots that resolution reads (shadowRootsIn).test_a_settled_third_party_holder_wears_the_layers_markfails onmainas well as here.