Repository navigation
Check unused TypeScript locals and trim surplus exports - #3423
Merged
Merged
Conversation
leaf-agent
approved these changes
Oct 21, 2026
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_
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.
Enable TypeScript's existing
noUnusedLocalscheck in the browser framework and Worker, add the Python eval fixtures to the existing Vulture scan, and remove two unused type imports plus seven surplus exports. The implementations behind those exports remain live inside their modules; the geometry ownership table now points callers at the remaining exported helpers.Vulture 2.16 and the JavaScript export test were already installed. Vulture passes with the existing framework exclusions; removing those exclusions produces 217 findings dominated by framework callbacks and pytest declarations. A one-off Knip 6.42.1 scan, with served-path resolution and generated bundles excluded, produced 258 export/type findings and six actionable runtime exports. The rest of the inspected candidates have Python, registry, generated-code or documented public readers. A second configuration naming host entry points reduced this to 30 remaining findings after cleanup, including generated types and helpers called from Python. Knip is not added as a standing gate: it misses all seven motivating object fields/methods, and handling Leaf's non-JavaScript readers would require more integration. Removing the unused type imports also let the existing export check identify the seventh surplus export,
LocalAction.Validation:
pnpm run check(131 build, 505 runtime, 84 Worker tests), rebuilt bundles, the export check and one focused keyboard browser test, and pre-commit on the changed files. Runtime tests and the browser build check passed again after the export cleanup. The full-tree pre-commit run also passed every hook except an unrelated undefinedwrite_recordintests/model/test_codex_app_server.py, reproduced in base commit2549c0565.CI: the exact head was approved by the automated reviewer. The test job failed on the existing
test_a_turn_that_shares_a_user_message_leaves_the_delivery_owedcases (status.jsonlookup and an invalidturn/startednotification), as well as the Ruff error above. The completed/start-joins-follow-up case reproduces thestatus.jsonfailure on main at8a36017c09b27c90a6c41ce6ad6d2aaac19af13e; the affected Python sources are unchanged by this PR. These unrelated failures are permitted by the repository landing policy.