Skip to content

fix: remove unread exports and dormant arrival marking - #5014

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-4947
Nov 1, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-4947

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

The export audit reproduces eight unread exports on main. Keep local layout, outline and screenshot helpers private and remove unused facade re-exports. Remove the selectable-element helper's export too, since its only external reader was the unused facade.

Remove the dormant arrival-marking implementation and its unused comparison entry points. #4890 deliberately stopped mounting this owner; arrival marking remains off, and the Versions picker still starts and ends comparisons. This removes the dead implementation rather than weakening the audit or restoring the disabled default. The kernel is rebuilt.

Validation: the existing export audit fails before the change and passes afterward; all 737 runtime tests, the browser build check, and the browser test for comparison bars and the h walk pass. Reviewed the diff and searched the removed exports' consumers.

Closes #4947 — automated triage

Keep module-local helpers private and remove facade exports without readers. Remove the unmounted since-seen implementation and its otherwise unused comparison entry points, preserving the disabled arrival marking chosen in #4890 and the active Versions comparison behavior. Rebuild the kernel.

Closes #4947
@leaf-agent
leaf-agent merged commit 91dae9c into main Nov 1, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-4947 branch November 1, 2026 22:36
max-sixty added a commit that referenced this pull request Nov 2, 2026
The JavaScript export check (`tests/journeys/test_unused_exports.py`)
ran only in the daily `journeys` tier. That run has failed every day
this week, with over a hundred failures each time, so an orphaned export
reached main and stayed until Tend triaged the daily report: #4724 and
#4873 left seven on 30 and 31 October, and #5014 removed them on 1
November. Vulture, its Python counterpart, runs as a pre-commit hook,
which both landing paths (a pull request's lint step and `wt merge`'s
pre-merge) run over the whole tree, so the change that orphans a Python
definition is the one told.

This moves the export check beside vulture:

- `leaf-dev unused-exports` holds the check, unchanged, with the test's
docstring as its module header. It takes about two seconds.
- `.pre-commit-config.yaml` runs it as `unused-exports`, woken locally
by the file kinds that export or read (`.js`, `.mjs`, `.ts`, `.py`,
`.html`, `.md`, `worker/wrangler.toml`). CI runs every hook on every
file.

It also removes what #5014's deletion of `since-seen.js` left behind:

- the `keepalive` option of `deliverBookkeeping` and `postEvent`, which
only the departing `seen` send set, and `runtime.seen`, which only
`since-seen.js` read;
- the six arrival tests skipped while `since-seen.js` was unmounted. The
module, renamed `test_changes_in_place.py`, keeps the comparison and
at-work tests;
- the prose in `change-walk.js`, `events.md`, `read_state.py`,
`agent_state.py` and `browser/AGENTS.md` that described the turned-off
marking. The server's reading of `seen` events is unchanged, and no tab
posts one.

And it drops the `uuid` devDependency, which no module imports. A
one-off knip scan of dependencies flagged 33; the other 32 are bundled
from `build/entries`, loaded by evals or `tests/*.mjs`, or resolved as
types and peers. As #2326 and #3423 found for exports, knip would need
more configuration than it saves, so it is not added as a gate.

Validation: `leaf-dev unused-exports` and every pre-commit hook pass on
the changed files; `pnpm run check:browser`, the 737 runtime tests, and
the browser test for comparison bars and the `h` walk pass.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 2, 2026
The export check from #5028 counted an export as read wherever a Python,
HTML or Markdown file named it as a word. The package references
document the public API by name, so every facade re-export of a public
name stayed alive: on main it reported nothing while twelve exports had
no reader. This replaces it with knip, run by pre-commit like vulture
and dependency-cruiser.

`knip.config.js` lists the modules something other than an import loads
(boot, the public package API, the suite's `check-api.js` windows,
`lf-*` widget modules, the render gate's probes, scripts the suite
injects, and the Node, Workers and harness programs), and resolves
`/runtime/`, `/vendor/` and `/widgets/` through
`tests/served-paths.mjs`, the composition the runtime tests already use.
The `knip` hook (knip 6.44.1, installed by pre-commit as
dependency-cruiser is) reports unused modules, exports and types, and
takes about ten seconds.

Measured on two trees:

| Tree | Word check | knip |
|---|---|---|
| main before this change | nothing | the twelve exports below, and five
false findings (see below) |
| main before #5014 | that change's eight | six of the eight, the
twelve, and the three `version.js` exports only `since-seen.js` read |

Knip misses what only an entry's loader reads: an entry's exports all
count as read, so an unused re-export on `check-api.js` or an unused
helper exported from a render-gate probe module goes unreported. Those
were the two of #5014's eight it missed.

Removed, as nothing reads them:

- the re-exports of `elementAxes` (`element-frame.js`), lit's
`classMap`, `styleMap` and `unsafeHTML` (`framework.js`), `langForPath`
(`syntax.js`, so `browser/AGENTS.md`'s owner index now names
`language-paths.js`, which defines it), and `nameAction`, `relabel`,
`offerElement`, `selectableOffer`, `selectableOffered` and `generated`
(`widget-elements.js`);
- `export` on `timeline-view.js`'s `clock`;
- `leaf-dev unused-exports`, the `imports` reading in
`tests/js_facts.mjs`, and its dev test.

`leaf.js` now hands `page-geometry.js` the five `target-paint.js`
functions it calls instead of the module namespace. Knip's documented
namespace-import heuristic (its guide, "Namespace Imports") credits a
namespace import that its module both reads members of and passes whole
with only the members read, so it reported those five as unused;
`knip.config.js` notes this.

Validation: the hook passes on the merged tree and fails on a planted
unused export, a re-export only prose names, and an orphan module; every
pre-commit hook, `pnpm run check:browser`, the 737 runtime tests and an
aim browser test pass.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 4, 2026
`v` marks what changed since the newest stamped version older than the
one being read, and pressing it again takes the marks off, whichever
press started the comparison, a Compare in Versions included. On 3
November the user chose to call the marks up with a key, rather than
have a page arrive marked with what changed since their last visit
(removed in #5014). Comparing with an older version stays with Versions,
which `g V` already opens, as `g T` opens Threads and `g M` On me. Bare
`v` was free, since restoring a selection is `g v`.

The command lives in `version.js` beside `g V`'s, since the comparison
is its result. In the leaf's menu it is the Annotations row beside Hide
annotations, reading "Show changes since v2" or "Hide changes", which is
also its touch route. Turning the comparison off also closes an open
change card, as a lit Compare does.

Ending a comparison, with `v` or a lit Compare, now gives the notice
"Changes hidden", as `o` gives "Annotations hidden". Before, a screen
reader heard nothing when the marks went, since the live region still
held the comparison's count.

The comments in `version.js` and `change-walk.js`, and the feature
gallery's guide, named Compare in Versions as the only press that starts
and stops a comparison, and `version.js` still described a walk through
the Versions rows that re-based it. They now name Compare and `v`.

Tests: a new browser test stamps v2, revises again, and checks that `v`
marks only what changed since v2, that a second `v` clears the marks and
says so, and that `v` also clears a comparison a Compare with v1
started.

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

Coming back to a page the agent revised while the user was away, the
panel now says how much changed since the version they last saw, as "3
changes since v12 — v shows them", and the page still arrives unmarked.
`v` marks those changes; once the user has seen everything, it marks
what changed since the newest older version, as #5290 made it. The user
chose on 3 November to call the marks up with a key rather than find
them waiting, and on 4 November took up being told on return that there
is something to call up, in a notice that passes after a notice's time
like a version's arrival.

### What counts as seen

`since-seen.js` comes back from before #5014 to record what the user
saw, and owns `v`, which moves out of `version.js` (its command id is
now `changes.toggle`).

- A revision counts as seen only while the tab is visible, its window
focused and its reading continuous, so a browser standing beside the
terminal the user types into sees nothing land. The tab posts `seen` as
the user leaves and hands the revision to a reload.
- The version the user last saw is the newest stamped one at or before
the newest revision they saw, found at their arrival. The server never
stopped reading `seen` (`read_state.seen_revision`); the Python side
changes only the prose that said no tab posts one.
- A return to a draft the user watched land says nothing, though it
differs from the version, since nothing in it is news.

### Counting without marking

`applyDiff` splits into `diffWith`, which reads a comparison and touches
nothing, and `commitDiff`, which puts it on the page; `loadBase` takes
the fetch out of `showComparison`, and `changesSince` counts. The count
runs after the document is presented, and starts again if a revision
lands while it runs.

### Startup

`since-seen.js` loads with the runtime, one more source module (about 9
KB) before the page presents, because `v` and the record of the first
presentation have to be there when it does. The count's `/api/view`
request waits until after presentation. A base/head probe of the startup
path didn't finish on a host at load 50, so the request and byte
comparison above is read from the module graph rather than measured.

### Tests

- Coming back after a stamp and a revision says "2 changes since v1 — v
shows them" and marks nothing, and `v` marks both changes, not only the
one since v2.
- A version that lands while the window lacks focus counts on return,
and `v` marks it.
- A return to a draft the user watched land makes no count request,
while a revision landing when they are away gets one and its notice.

Each fails with its rule taken out (focus ignored, `v` ignoring the
version last seen, the unseen rule removed). `pnpm run test:runtime`
(813), `pnpm run check:browser`, pre-commit and the change and
comparison tests in `test_changes_in_place.py` pass. A fresh reviewer
used the return in Firefox; its three findings (a notice repeating on a
watched draft, a stale count, a dropped notice) are fixed here.

> _This was written by Claude Code on behalf of max-sixty_
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.

Runtime export audit reports newly unread exports

1 participant