Repository navigation
Remove dead runtime paths and correct comments whose reasons stopped being true - #989
Conversation
…being true lf-chart and keyboard scopes justified their shape by every x-upgrade module loading on every page, which import-on-demand ended; the comments now give the reasons that still hold. Drops selectionAnchor's unreachable datum section, state-application's guards on always-served fields, a redundant ?? null, read.js's unused scan/scheduleScan members and widget-api's unused pageScroller re-export, and fixes "1 unread messages" in the first-unread button's name. packages.md now lists the Thread's unreadCount and the message's unread flag.
…rts it The removal read the runtime tree for importers and found none, because the importer is leaf/render-checks/layout.js, which loads the facade over HTTP from the served page. Every render gate then failed to parse its probe module: "does not provide an export named 'pageScroller'". tests/test_smoke.py::test_a_shipped_page_passes_the_real_browser_gate fails on c4f5edf with that SyntaxError and passes with the export restored.
leaf-agent
left a comment
There was a problem hiding this comment.
The comment added above export { pageScroller } settles at one export a fact that holds for the whole facade, so the next sweep pays the same cost. widget-api.js's own header calls it "The one helper surface behavior modules import" — that is the reading under which removing the re-export looked safe, and it leaves out the render gate's probes. Seven modules under skills/leaf/scripts/leaf/render-checks/ import seventeen names from /runtime/widget-api.js over HTTP from the served page: shallowSigs, READER_VIEW_RESTORE_CASES, uiInside, verbatimOwnerIdentity and the rest are each exactly as invisible to a runtime-tree search as pageScroller was. A sweep that reaches any one of them reproduces the red test and writes this comment one export lower. The statement belongs in the header, where it covers every export at once — skills/leaf/assets/CLAUDE.md opens with "Keep each rule with the modules it constrains: local contracts in module headers".
Separately, #987 rewrites the same two packages.md sentences this PR edits, and removes unreadCount from the Thread model in conversation/model.js in favour of a Thread-level unread list of {message, version}. They are not duplicates, but whichever lands second has to reconcile the contract line: after #987, the unreadCount this PR documents is no longer a field a package can read off readThreads().
# Conflicts: # skills/leaf/references/packages.md
This removes runtime code that nothing reaches any more and corrects comments that justify code with reasons that stopped being true. The one reader-visible change: the first-unread button's accessible name used to announce "1 unread messages" and now says "1 unread message".
Stale reasons. Both
lf-chart.jsandkeyboard/scopes.jsjustified their shape with "every x-upgrade module loads on every page". SinceimportWidgetsbecame import-on-demand, that is false:widget-loader.jsimports only the declared tags that stand in the markup. The code in both places is still right, for a different reason:measurereleases the draw.Both comments now say that. In the same vein,
widget-elements.jspointed atkeyboard/page.jsforunaccountedGesture, which lives incomposing/engagement.js.lf-tabs.jscompared its tab memory to the scroll position, whichstorage.js's own header already names beside it — "the reading position, which panel of a widget stands open, whether design mode is on" — so the analogy was a second copy of what the store settles, not a fact the widget owns.Dead code:
capture.js/selectionAnchor: computedsectionfromdatum?.dataset.lfProjectionbefore returninganchorForDatum(datum), which setssectionitself.sectionis now computed only on the path that reads it.state-application.js:threads ?? []andreceipts ?? []guard fields the served state always carries. The same function already readsthreads.flatMapunguarded a few lines later.engagement.js:replyBoxHasDraft(...) ?? nullrepeated anullthe callee already returns.read.js: no caller outside the module usesscanorscheduleScan, so they are no longer increateReadAcknowledgement's returned object.widget-api.js: who imports the facade. The first push removed thepageScrollerre-export after reading the runtime tree for importers and finding none. The importer isleaf/render-checks/layout.js, which loads the facade over HTTP from the served page, so no runtime-tree search reaches it; every render gate then failed to parse its probe module (does not provide an export named 'pageScroller') andtestwent red. The export is back, and the facade's header now states the rule once rather than annotating the one export that broke: seven modules underleaf/render-checks/import seventeen names this way, and each is as invisible to aruntime/search aspageScrollerwas.Reference. None. This branch had added the Thread's
unreadCountand the message'sunreadflag topackages.md; #987 landed first, droppedunreadCountfrom the Thread model in favour of anunreadlist of{message, version}, and documented both fields itself. Mergingmaintook its text for those two sentences, so the reference is unchanged by this PR.Checks.
lintandtestwere green on9a4d0815, beforemainwas merged in.tests/test_smoke.py::test_a_shipped_page_passes_the_real_browser_gatefails onc4f5edf8with the SyntaxError above and passes on9a4d0815.npm run test:runtimepasses at the current head (77 tests). The plural fix has no regression test: pinning one aria-label string would need a browser case whose only assertion is that string, whichtests/CLAUDE.mdwould not keep.