Skip to content

build: gate unused files, exports, and types with fallow - #73

Merged
kixelated merged 3 commits into
mainfrom
quest/m1/dead-code-gate
Nov 27, 2026
Merged

kixelated merged 3 commits into
mainfrom
quest/m1/dead-code-gate

Conversation

@kixelated

@kixelated kixelated commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Closes the dead-code-gate quest.

Problem

just check ran fallow dead-code --unused-deps (#56), so unused files, exports, and types could still land between code audits.

Approach

  • just check now runs the full fallow dead-code (still about 0.1 s, so the gate gets no slower).
  • .fallowrc.jsonc:
    • supportEntry: app/test/*.html, because media.browser.ts loads both test pages through Vite by URL. Fallow follows their <script src> to media.tsx and room.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/api counted as used. The Worker's default export is exempt because wrangler.jsonc names it.
    • Turned off unused-class-members (about 40 false positives from calls through context objects and Comlink proxies) and duplicate-exports (modules are imported as namespaces, so Account.Info and Fave.Info never collide).
    • ignoreBinaries: just, moq-relay, which the Nix shell provides.
  • @hang/api now exports only the three types the app uses: AccountInfo, FaveInfo, and ProviderId. Before, it re-exported whole Account/Avatar/Fave/Health/OAuth/Room namespaces, and the app used only those three types. api/src/auth.ts now imports ./account directly, not the package index.
  • Cleanup the run found:
    • Deleted joinSchema from api/src/room.ts, which nothing used. The m2 audit-code quest listed it, so that bullet is gone too.
    • Unexported symbols used only in their own file: providerIdSchema, Provider, User (oauth), infoSchema, Row, NewRow (account), typeSchema (avatar), table (fave), Hang (app index), and LiveValue (room metadata).
  • Removed the finished quest, and updated CONTRIBUTING.md and the m2 audit-code/audit-deps quests to describe the new gate.

Decisions

The maintainer was away, so I made these calls. Please review them:

  • Checking entry exports and narrowing @hang/api. This goes beyond the quest's plan. Without it, the gate misses every export in api/src behind a namespace re-export, and the Goal covers api/. The other option was to keep the namespaces and accept that blind spot.
  • Turning off duplicate-exports. The plan didn't mention this rule, but its findings were all namespace-import false positives.
  • Adding room.html as a support entry along with media.html. Both are loaded the same way.

Impact

  • Public API: @hang/api is a private workspace package, and its only consumer is app/, updated in this PR (Api.Account.Info became Api.AccountInfo, Api.Fave.Info became Api.FaveInfo, Api.OAuth.ProviderId became Api.ProviderId). Nothing else uses it, so the title has no !.
  • Wire: none. All changes are type-level or unexports. Routes and schemas are unchanged.

Alternatives

  • entry instead of supportEntry for the test pages: they don't run in production, and fallow's docs recommend supportEntry for that.
  • Inline fallow-ignore comments for class members: there would be about 40, and the m2 code audit greps for dead methods anyway.

Follow-ups

None.

The parallel quest dedupe-room-helpers may conflict with the one-line change in app/src/room/metadata.ts. Whichever lands second should rerun bun fallow dead-code. #74 (prune-dev-icons-and-assets) is already merged into this branch with no conflicts.

Validation

  • Planted an unused file in each of api/src and app/src, an unused export in app/src/room/geometry.ts and api/src/client.ts, and unused types in api/src/account.ts and api/src/index.ts. bun fallow dead-code reported all 6 and exited 1. With the plants removed, it reports no issues.
  • quest check, bun run check (API declaration emit, tsc, Biome for api and app), bun run --cwd api test (45 pass), and bun run --cwd app test (79 pass) all pass locally.
  • I didn't run test:media locally because this host is heavily loaded. CI covers it.
  • After merging main (including #74) with no conflicts, just check passes on the merged tree. That covers bun fallow dead-code (no issues), quest check, bun run check, the api tests (45 pass), the app tests (79 pass), and test:media (4 pass).

Models

  • Size: S
  • Implementer: Claude Code, claude-opus-5-5, medium (arm A)
  • Implementer: Claude Code, claude-opus-5-5, medium effort (iterate, XS, arm A)

🤖 Generated with Claude Code

(Written by Claude Opus 5.5 with medium)

Review

Rewritten by quest review after each round.

  • Head: 32735f8

  • Base: origin/main at 3d7d96e

  • Risk: medium, it adds to plans under quest/, which agents start without a person reading them

  • Classified: medium by default

  • Risk file: none

  • Reviewer: Codex, gpt-6.2-sol, medium effort

  • Session: 01a21aac-2d3c-79c2-8851-bab5c21ff4e2, round 1

  • Score: 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

kixelated and others added 2 commits November 26, 2026 17:33
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>
@kixelated kixelated changed the title Gate unused files and exports with fallow build: gate unused files, exports, and types with fallow Nov 27, 2026
@kixelated
kixelated marked this pull request as ready for review November 27, 2026 01:45
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The 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: Minimal · up to 70b02

This change widens the dead-code check and narrows internal API exports without changing runtime behavior. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "build: gate unused files, exports, and types with fallow" matches the main change. The PR widens the just check Fallow run from --unused-deps to the full fallow dead-code check, which…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description matches the changeset. It explains the goal of closing the dead-code-gate quest and the problem with just check running fallow dead-code --unused-deps. It then covers the `.fallowr…
Full details: Title check

Explanation

The title "build: gate unused files, exports, and types with fallow" matches the main change. The PR widens the just check Fallow run from --unused-deps to the full fallow dead-code check, which covers unused files, exports, and types. The title is specific and concise, and it follows a conventional commit style.

Full details: Description check

Explanation

The description matches the changeset. It explains the goal of closing the dead-code-gate quest and the problem with just check running fallow dead-code --unused-deps. It then covers the .fallowrc.jsonc changes, the narrowing of @hang/api exports and the matching app consumer updates, the removal of joinSchema and the unexported symbols, and the validation steps. The raw summary confirms each of these changes appears in the diff.

Finishing Touches

Simplify code

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0f048ac1-3f95-415b-ab3a-d66d2e8bff76
Commits

Reviewing files that changed from the base of the PR and between 6a4da6d and 70b025c.

Files selected for processing: 19

  • .fallowrc.jsonc
  • CONTRIBUTING.md
  • api/src/account.ts
  • api/src/auth.ts
  • api/src/avatar.ts
  • api/src/fave.ts
  • api/src/index.ts
  • api/src/oauth.ts
  • api/src/room.ts
  • app/src/account.tsx
  • app/src/api.ts
  • app/src/components/login.tsx
  • app/src/home.tsx
  • app/src/index.tsx
  • app/src/room/metadata.ts
  • justfile
  • quest/m1/dead-code-gate.md
  • quest/m2/audit-code.md
  • quest/m2/audit-deps.md
Files with no reviewable changes: 2

  • api/src/room.ts
  • quest/m1/dead-code-gate.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@kixelated
kixelated merged commit 60585f6 into main Nov 27, 2026
2 checks passed
@kixelated
kixelated deleted the quest/m1/dead-code-gate branch November 27, 2026 02:16
kixelated added a commit that referenced this pull request Nov 27, 2026
Drop the unused joinSchema as #73 did, and pass the datagrams signal #68 added to consumeExtras in the OBS metadata test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant