Public: anyone can read this; the crew can change it.

The hollow work check counts only callers that run #740

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

Closes #739

shipped production is serving it for issue #739 — its issue is already done deploy d79f016

opened this

Closes #739

What changes. The hollow work check no longer counts a caller that never runs. Reach started at every declaration under src/http, src/web, src/crew, src/cli and src/tui, so an action called only from a page function that no route names passed. It now starts at each module's own top-level statements, where src/main.ts, the CLI and the terminal begin, and follows names from there. A route's handler is reached through the table that registers it; a table nothing calls registers nothing.

On main (1e4ebce) the audit still names only the two allowed entries, so nothing new needs wiring or allowing.

Shown on the real tree, in memory

  • Unroute the fleet graph's three pages (the page functions stay, with their imports): readFleetGraph, fleetGraphFor and windowBounds are named. Under the old rule they passed.
  • Cut the spawn door's two imports: spawnForge and childDirOf are named, as before.

Tests (test/hollow.test.ts, 26): every "called" fixture now has an entry point that runs it. New: a page function no route names does not make its action called; a route does once its table is run; a table nothing calls reaches nothing; a caller under any of the five directories that never runs is no caller.

Files. scripts/hollow.ts (−17 lines of roots and wording, the surface list is gone), the test, a sentence each in CLAUDE.md and README.md.

Verified. bun x tsc --noEmit clean; bun scripts/hollow.ts clean; hollow, check-list and tree tests 40/40.

🤖 Generated with Claude Code

commented

Review round 1: two ways an action nothing runs could still pass. Both are closed, with a test each.

  1. An import() counted wherever it sat. One inside a page function that no route names hid every export of the module it named. It is now credited to the code around it: the module is loaded, and its exports reached, when that code runs. At the top level of a loaded file it runs; inside a function nothing calls it does not.
  2. Every module's top-level statements counted as running. A file nothing loads could call an action at its top level and hide it. Running now starts at the entry files, listed in ENTRIES with who starts each: the server (src/main.ts), the forge command, the terminal, the git hook entry, and the operator's restore. A module is loaded when an entry is, when a loaded module imports or re-exports it, or when code that runs import()s it; only then do its top-level statements run.

Tests (test/hollow.test.ts, 29, three new): the reviewer's two cases as written; an import() in a file that is loaded but in a function that does not run; an orphan loaded for its side effect, directly and through another file; an import() of the orphan in a function nothing calls; each entry file starts running and a file that merely looks like one (src/tui/gallery.ts, src/x.ts) does not.

On the real tree, in memory (main 112a282): both cases aimed at resetConnectLimit leave it named; unrouting the fleet graph still names its three actions; cutting the spawn door still names spawnForge and childDirOf. The audit on main names only the two allowed entries.

One limit, stated. A top-level const x = f() runs f when its file loads, but the audit follows it only once something mentions x. That errs toward naming an action, never toward hiding one, and nothing on main depends on it.

Verified. tsc clean; reserved-names, studio, check-list, hollow and tree, 227/227 in one run on this head.

🤖 Generated with Claude Code

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs