Repository navigation
build: gate unused files, exports, and types with fallow - #73
Conversation
Quest-Claim: 24158cafa93afc32
Widen `just check` from `fallow dead-code --unused-deps` to the full run, with entry exports checked so the API's package surface is tracked too. Narrow `@hang/api` to the three types the app imports, and unexport or delete what the run found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. WalkthroughThe changes configure Fallow to check for unused files, exports, types, and dependencies. The API barrel now exports selected types instead of several modules, and other declarations are no longer exported. Application code uses the updated type names. The check command and related documentation are updated. Merge Risk:
|
Closes the dead-code-gate quest.
Problem
just checkranfallow dead-code --unused-deps(#56), so unused files, exports, and types could still land betweencodeaudits.Approach
just checknow runs the fullfallow dead-code(still about 0.1 s, so the gate gets no slower)..fallowrc.jsonc:supportEntry: app/test/*.html, becausemedia.browser.tsloads both test pages through Vite by URL. Fallow follows their<script src>tomedia.tsxandroom.tsx.includeEntryExports: true, so exports from package entries (api/src/index.ts,api/src/client.ts,app/src/index.tsx) count as dead when nothing imports them. Without it, everything re-exported through@hang/apicounted as used. The Worker'sdefaultexport is exempt becausewrangler.jsoncnames it.unused-class-members(about 40 false positives from calls through context objects and Comlink proxies) andduplicate-exports(modules are imported as namespaces, soAccount.InfoandFave.Infonever collide).ignoreBinaries: just, moq-relay, which the Nix shell provides.@hang/apinow exports only the three types the app uses:AccountInfo,FaveInfo, andProviderId. Before, it re-exported wholeAccount/Avatar/Fave/Health/OAuth/Roomnamespaces, and the app used only those three types.api/src/auth.tsnow imports./accountdirectly, not the package index.joinSchemafromapi/src/room.ts, which nothing used. The m2audit-codequest listed it, so that bullet is gone too.providerIdSchema,Provider,User(oauth),infoSchema,Row,NewRow(account),typeSchema(avatar),table(fave),Hang(app index), andLiveValue(room metadata).CONTRIBUTING.mdand the m2audit-code/audit-depsquests to describe the new gate.Decisions
The maintainer was away, so I made these calls. Please review them:
@hang/api. This goes beyond the quest's plan. Without it, the gate misses every export inapi/srcbehind a namespace re-export, and the Goal coversapi/. The other option was to keep the namespaces and accept that blind spot.duplicate-exports. The plan didn't mention this rule, but its findings were all namespace-import false positives.room.htmlas a support entry along withmedia.html. Both are loaded the same way.Impact
@hang/apiis a private workspace package, and its only consumer isapp/, updated in this PR (Api.Account.InfobecameApi.AccountInfo,Api.Fave.InfobecameApi.FaveInfo,Api.OAuth.ProviderIdbecameApi.ProviderId). Nothing else uses it, so the title has no!.Alternatives
entryinstead ofsupportEntryfor the test pages: they don't run in production, and fallow's docs recommendsupportEntryfor that.fallow-ignorecomments for class members: there would be about 40, and the m2codeaudit greps for dead methods anyway.Follow-ups
None.
The parallel quest
dedupe-room-helpersmay conflict with the one-line change inapp/src/room/metadata.ts. Whichever lands second should rerunbun fallow dead-code. #74 (prune-dev-icons-and-assets) is already merged into this branch with no conflicts.Validation
api/srcandapp/src, an unused export inapp/src/room/geometry.tsandapi/src/client.ts, and unused types inapi/src/account.tsandapi/src/index.ts.bun fallow dead-codereported all 6 and exited 1. With the plants removed, it reports no issues.quest check,bun run check(API declaration emit, tsc, Biome forapiandapp),bun run --cwd api test(45 pass), andbun run --cwd app test(79 pass) all pass locally.test:medialocally because this host is heavily loaded. CI covers it.just checkpasses on the merged tree. That coversbun fallow dead-code(no issues),quest check,bun run check, the api tests (45 pass), the app tests (79 pass), andtest:media(4 pass).Models
🤖 Generated with Claude Code
(Written by Claude Opus 5.5 with medium)
Review
Rewritten by
quest reviewafter each round.Head: 32735f8
Base: origin/main at 3d7d96e
Risk: medium,
it adds to plans under quest/, which agents start without a person reading themClassified: medium by default
Risk file: none
Reviewer: Codex, gpt-6.2-sol, medium effort
Session:
01a21aac-2d3c-79c2-8851-bab5c21ff4e2, round 1Score: 9/10,
Source review found that the broader Fallow gate covers both browser-test entry pages and that all consumers of the narrowed API type exports were updated with the HTTP and relay contracts intact, though builds and tests were not run.Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none