Repository navigation
Description
Context
#2536 adds scripts/check-unused-exports.ts to bun run lint. It reports an exported declaration in a package's src/ that no other file imports, and its scanned list is fixed at SCANNED_PACKAGES = ["ui-server", "ui-kit", "ui-react"]. #2536 left every other workspace package out of scope on purpose. Extending the gate is this issue.
The same gate run over the other packages at epic/2542-dead-code (9df9192f3 plus the #2536 branch), with an empty allowlist, reports 494 findings:
| Package | Findings |
|---|---|
| core | 280 |
| ui-sdk | 111 |
| module-jobs | 23 |
| ui-backend-claude | 18 |
| ui-backend-pi | 18 |
| module-diagrams | 11 |
| module-finance | 11 |
| module-images | 10 |
| scrape | 4 |
| geo | 3 |
| render-template | 3 |
| module-travel | 1 |
| ui-render-puppeteer | 1 |
Triage re-ran this at PR #3448's head (f54c4b768, on epic/2542-dead-code) and got the same 494, package by package. The three remaining packages with a src/ that the table does not list (common, module-speaking, module-video) report 0 findings, so they can join the list with no clean-up.
To reproduce:
bun -e 'import { check } from "./scripts/check-unused-exports.ts";
console.log(check(".", { packages: ["core"], allowlist: [] }).findings.length)'#2536 found two kinds of use that the import graph cannot see:
- Inferred types. A type that another file's declaration emit infers through an exported value has no importer, but dropping its export fails that package's
tsconfig.build.jsonemit with TS4023/TS4058. Each such case gets an allowlist entry. - Modules loaded by path.
new URL("./x", import.meta.url),Bun.resolveSyncandimport.meta.resolvecount as uses of the whole module, and the gate already handles them. ui-sdk's worker entries useBun.resolveSyncheavily, so check that the handling covers them.
ui-sdk's ./internal entry names are tracked separately in #3412 and are not part of this issue.
Blocked by #2536
scripts/check-unused-exports.ts exists only in PR #3448 (for #2536), merged into epic/2542-dead-code but not yet on main. #2536 stays open until that epic's batch lands on main, so this issue starts from main after that.
Scope
- Add the packages above, plus
common,module-speakingandmodule-video, toSCANNED_PACKAGES, in one or more PRs. Suggested slices: the eleven small packages together, thenui-sdk, thencore. Each slice keepsbun run lintgreen on its own. - For each added package, drop the
exportfrom what the gate reports, or delete the declaration if its own file does not use it either. Add an allowlist entry with a reason only where declaration emit or a loader needs the name. - Run each package's declaration build after the clean-up.
Out of scope
- Entry-point exports, which
tests/api-surface.test.tsgoverns. - ui-sdk
./internalentry names (ui-sdk: 15 more internal entry names have no outside importer after #2534 #3412). scripts/,tests/,website/and other non-package code.
Acceptance criteria
-
SCANNED_PACKAGESlists every workspace package underpackages/that has asrc/, or the issue records a reason for each package left out. -
bun run lintpasses, and every allowlist entry carries a one-line reason. - Each PR carries the per-package finding counts before and after, from the reproduce command above at its base.
- ui-sdk modules that are loaded only by path (
Bun.resolveSync,new URL(..., import.meta.url),import.meta.resolve) are not reported. A test in the gate's suite shows aBun.resolveSync-loaded worker entry counted as used. - A planted
export function unusedProbe() {}inpackages/core/srcfailsbun run lint, naming the file and symbol. The mutation is recorded in the PR. - Each added package's
tsconfig.build.jsondeclaration emit passes, andbun run typecheck,bun run testandtests/api-surface.test.tspass.
Verification
bun run lint
bun run typecheck
bun run testContract impact
None. Only names outside every entry point change.
Filed from #2536.
Triage 2026-11-03: reproduced the 494 count at #3448's head f54c4b768 and found the three zero-finding packages. Declared #2536 as the blocker, because the gate script is not on main yet, plus acceptance criteria for per-PR counts and path-loaded ui-sdk modules. Set priority: p3, matching #2536 and #2542. #2542 bounds its outcome to the 2026-10-22 audited inventory and says a wider inventory is a new issue, so this one has no epic parent and no milestone. It is 494 findings across 13 packages, which is too large to commit to 0.45.0 alongside its blocker. Brief complete: agent-ready together with blocked.
Activity
schlessera commentedon Nov 3, 2026
Triage 2026-11-03: reproduced the 494 findings exactly at PR #3448's head
f54c4b768.common,module-speakingandmodule-videoreport 0 findings, and the body now includes them. #2536 is now the declared blocker, because the gate script exists only onepic/2542-dead-code. Added acceptance criteria for per-PR before/after counts and for path-loaded ui-sdk modules, plus the owningarea:labels.priority: p3matches #2536 and #2542. No milestone: 494 findings across 13 packages is too large to commit to 0.45.0. No epic parent: #2542 is bounded to the 2026-10-22 audited inventory and says a wider inventory is a new issue. Brief complete:agent-readyandblocked.schlessera commentedon Nov 3, 2026
Unblocked: its only blocker, #2536, closed when epic #2542 batch 1 landed on main in #3512 (merge
90aebd916).scripts/check-unused-exports.tsis now on main.