Repository navigation
Give version comparison one module-scope home and import its readers directly - #2496
Merged
Merged
Conversation
…directly #2376 moved `diffOn` and `diffMarked` to module scope but left `diffBase`, `diffPendingBase` and `diffBefore` inside `createVersionController`, which wrote the module values from its closure. `comparisonBase`, `inlineComparison` and `toggleInlineComparison` still travelled leaf.js -> application.js -> the annotation inventory, and `renderVersions` and `closeVersionMenu` took the same route into state application and the response surface. None of that needs an application capability: the comparison and the picker's presentation read only `runtime`, the registry and the documents they fetch. They now live at module scope in version.js, one per document, and the annotation inventory, state application and response surface import them. The forwarding entries in leaf.js, application.js and the three factories' parameters are gone. `createVersionController` stays a factory. What remains in it (travel, activation, arrival continuity, the menu's key scopes) needs `readAndApply`, `midComposition`, `syncLayout` and the standing captures, which exist only once leaf.js has wired the application; neighbouring runtime modules with that shape are factories called once from leaf.js. `watchComparison` no longer re-checks `owner.isConnected`: `whileConnected` aborts the listener when the owner leaves. The settled-options test no longer hand-adds `lf-ins-block` and asserts it is not counted. No user path adds that class; the test asserted how the count is computed. The rest of the test still drives real revisions through both consumers and detach/reattach. No user-visible behaviour changes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 12, 2026
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.
Version comparison now has one home: its state and readers live at module scope in
skills/leaf/assets/runtime/version.js, and the surfaces that read them import them directly. The forwarding that carried them throughleaf.jsandapplication.jsis gone. Numbering below is the Lit-survey review's (items 20–41), not GitHub issues.Review item 31: comparison state split across two scopes. #2376 moved
diffOnanddiffMarkedto module scope, butdiffBase,diffPendingBaseanddiffBeforewere still insidecreateVersionController, and the closure wrote the module values.comparisonBase,inlineComparisonandtoggleInlineComparisonstill wentleaf.js→application.js→ annotation inventory.renderVersionsreached state application the same way, andcloseVersionMenureached the response surface the same way. The comparison and the picker's presentation read onlyruntime, the registry and the documents they fetch, so they moved to module scope unchanged apart from dedent and Prettier rewraps. The annotation inventory and state application now import them.closeVersionMenuwas only a wrapper around the picker view, so it now lives inversion-picker.jsbesideversionMenuIsOpen, and the response surface imports both from there.createVersionControllerstays a factory: what remains in it (travel, activation, arrival continuity, the menu's key scopes) needsreadAndApply,midComposition,syncLayoutand the standing captures, which exist only onceleaf.jshas wired the application. Its runtime neighbours with that shape are also factories called once fromleaf.js.Review item 41 (part): the test asserted how the count is computed.
tests/test_render_options_settled.pyhand-added anlf-ins-blockclass and asserted the counts ignored it. No user path adds that class, so that block is removed. The rest of the test still drives real revisions through both consumers and detach/reattach.watchComparisonno longer re-checksowner.isConnected.whileConnectedaborts its listener at the arrival batch after the owner leaves. Nolf-comparisondispatch falls between a removal and that batch: activation clears the comparison before it patches, and restores it only after landing. A stray read would only count marks under the detached owner, and reconnection reads again.Checks:
npm run test:runtime, plus focused browser cases for settled-options/tabs counts, inline version diffs, versions-menu close routes, pending comparison across a live revision, comparison replay, the margin map's comparison and comparison retry.