Skip to content

ci: the unused-export gate scans only ui-server, ui-kit and ui-react #3438

Open

Description

@schlessera

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.json emit with TS4023/TS4058. Each such case gets an allowlist entry.
  • Modules loaded by path. new URL("./x", import.meta.url), Bun.resolveSync and import.meta.resolve count as uses of the whole module, and the gate already handles them. ui-sdk's worker entries use Bun.resolveSync heavily, 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-speaking and module-video, to SCANNED_PACKAGES, in one or more PRs. Suggested slices: the eleven small packages together, then ui-sdk, then core. Each slice keeps bun run lint green on its own.
  • For each added package, drop the export from 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

Acceptance criteria

  • SCANNED_PACKAGES lists every workspace package under packages/ that has a src/, or the issue records a reason for each package left out.
  • bun run lint passes, 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 a Bun.resolveSync-loaded worker entry counted as used.
  • A planted export function unusedProbe() {} in packages/core/src fails bun run lint, naming the file and symbol. The mutation is recorded in the PR.
  • Each added package's tsconfig.build.json declaration emit passes, and bun run typecheck, bun run test and tests/api-surface.test.ts pass.

Verification

bun run lint
bun run typecheck
bun run test

Contract 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

  1. added
    type: chore
    area: ci
    priority: p3
    blocked
    area: core
    area: ui-sdk
    area: modules
    area: backends
    on Nov 3, 2026
  2. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Triage 2026-11-03: reproduced the 494 findings exactly at PR #3448's head f54c4b768. common, module-speaking and module-video report 0 findings, and the body now includes them. #2536 is now the declared blocker, because the gate script exists only on epic/2542-dead-code. Added acceptance criteria for per-PR before/after counts and for path-loaded ui-sdk modules, plus the owning area: labels. priority: p3 matches #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-ready and blocked.

  3. added
    agent-ready
    and removed
    blocked
    on Nov 3, 2026
  4. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Unblocked: its only blocker, #2536, closed when epic #2542 batch 1 landed on main in #3512 (merge 90aebd916). scripts/check-unused-exports.ts is now on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: backendsarea: ciarea: corearea: modulesarea: ui-sdkpriority: p3type: chore

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions