Skip to content

Read comparison counts from the canonical version reading - #2376

Merged
max-sixty merged 1 commit into
mainfrom
lit-runtime-cleanups
Oct 11, 2026
Merged

max-sixty merged 1 commit into
mainfrom
lit-runtime-cleanups

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Tabs and settled answers now count canonical version-comparison changes instead of counting CSS marker classes. A connection-bound watch refreshes on reconnection and stops listening while detached.

Survey item 16. I extended the existing comparisonChanges(owner = null) API instead of adding changesWithin: descendant selection belongs in the canonical reading. Comparison deduplication also uses its own Set rather than reading a marker class. Annotations now import this same reading directly, removing its forwarding chain through the controller, bootstrap, and application. Measured JavaScript across the seven changed modules: 5,548 → 5,571 (+23). The connection watch uses the shared whileConnected primitive; reference documentation adds 12 lines. The existing reconnect regression now exercises real revisions, both consumers, detached updates, and marker-independent counts.

Validation: three focused browser checks passed, covering annotation navigation, state-only revisions, and the comparison regression with real revisions, both consumers, stray CSS markers, detached updates, and reconnection. Source review, lint, and 323 runtime tests passed; CI runs the complete landing gates.

This was written by Codex on behalf of max-sixty

@max-sixty
max-sixty merged commit 7f3b7dd into main Oct 11, 2026
6 checks passed
@max-sixty
max-sixty deleted the lit-runtime-cleanups branch October 11, 2026 07:49
max-sixty added a commit that referenced this pull request Oct 12, 2026
…directly (#2496)

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 through `leaf.js` and `application.js` is 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 `diffOn` and `diffMarked` to module scope, but `diffBase`,
`diffPendingBase` and `diffBefore` were still inside
`createVersionController`, and the closure wrote the module values.
`comparisonBase`, `inlineComparison` and `toggleInlineComparison` still
went `leaf.js` → `application.js` → annotation inventory.
`renderVersions` reached state application the same way, and
`closeVersionMenu` reached the response surface the same way. The
comparison and the picker's presentation read only `runtime`, 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. `closeVersionMenu` was
only a wrapper around the picker view, so it now lives in
`version-picker.js` beside `versionMenuIsOpen`, and the response surface
imports both from there. `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. Its runtime neighbours with that shape are also factories
called once from `leaf.js`.
- Behaviour: none visible. Comparison, inline diffs, the picker and
activation behave as before.
- Source lines: −19 (749 added, 768 removed, almost all a moved block).
- Test lines: 0 for this item.

**Review item 41 (part): the test asserted how the count is computed.**
`tests/test_render_options_settled.py` hand-added an `lf-ins-block`
class 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. `watchComparison`
no longer re-checks `owner.isConnected`. `whileConnected` aborts its
listener at the arrival batch after the owner leaves. No `lf-comparison`
dispatch 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.
- Behaviour: none visible.
- Source lines: −2 (inside the version.js figure above).
- Test lines: −9.

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.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[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