Skip to content

ui-sdk: 71 internal entry names have no consumer outside the package #2534

Description

@schlessera

Context

@schlessera/brain-ui-sdk/internal (packages/ui-sdk/src/internal.ts, 96 lines, 227 names) exists only so first-party packages in the same product group can share code (docs/decisions/public-export-boundary.md; the 2026-10-09 ruling on #1345). At dcf5341aa, 68 of those 227 names have no importer outside ui-sdk. ui-sdk's own tests import these symbols from their source modules (for example packages/ui-sdk/tests/outward-actions.test.ts:2 imports classifyOutwardCall and outwardTarget from ../src/server/outward-actions), so the re-exports serve nobody. They still add rows to api-report/ui-sdk.txt and to the dist-types check, and they make ./internal look like a wider dependency surface than it is.

Three more names in ./internal/client (packages/ui-sdk/src/internal-client.ts) have no importer outside ui-sdk either: isShareTargetRequest, ShareTargetError, LinkEdit.

How the list was produced: take every name listed under export "./internal" in api-report/ui-sdk.txt, then run, for each name,

git grep -lw -- "$NAME" -- packages tests scripts website template evals experiments \
  ':!packages/ui-sdk/**' ':!api-report/**' ':!**/*.md'

and keep the names with no hit. A whole-word match anywhere, including a relative import from another package's tests, counts as a use, so the list errs towards keeping names.

The 68 names

ARCHIVING_UPDATE_REASON, brainGitSync, BUILTIN_OUTWARD_MCP_DESCRIPTORS, classifyOutwardCall, createWorkerStartupView, DEFAULT_MAINTENANCE_TEMP_BUDGET_BYTES, DEFAULT_MAINTENANCE_TEMP_BYTES, DEFAULT_OUTPUT_STAGING_BYTES, DEFAULT_WORKER_STATE_BYTES, describeLimitHits, EgressProxyOptions, InferenceRelayOptions, linkedTurnTempPaths, MaintenanceEnvelope, MaintenanceResult, MAINTENANCE_TEMP_BUDGET_ENV, MAINTENANCE_TEMP_BYTES_ENV, MaintenanceWorker, MAX_INFERENCE_REQUEST_BYTES, NativeBrainDeltaCandidate, NativeBrainDeltaError, NativeBrainRootIdentity, NativeFileVersion, OUTPUT_STAGING_BUDGET_ENV, OUTPUT_STAGING_BYTES_ENV, OutwardClassification, OutwardPlan, outwardTarget, PrepareWorkerSandboxOptions, probeMaintenanceWorker, PROMOTED_SCRATCH_DIR, PROMOTION_FILE_MAX_BYTES, PROMOTION_TURN_MAX_BYTES, PROMOTION_TURN_MAX_FILES, purgeTurnTemp, ReplayReceipt, resolveOutputStagingLimits, RestrictedEnvelope, SessionPromptFacts, STALE_NATIVE_WRITE, TURN_TEMP_BUDGET_ENV, TURN_TEMP_BYTES_ENV, turnTempFullMessage, turnTempPath, TurnTempPromoterOptions, TurnTempPurgeResult, TurnTempSpace, turnTempUsage, TURN_TEMP_WARN_RATIO, validWorkerStateBytes, VisibleOutwardAction, WorkerArea, WorkerAreaName, WORKER_AREAS, WorkerCommandRule, WORKER_EGRESS_SOCKET, WorkerHome, WorkerHostProbeOptions, WORKER_INFERENCE_DIR, WorkerLimitHit, WORKER_LIMITS_ENV, WorkerMount, WorkerOutputStorage, WorkerOutwardRule, WorkerProfile, WORKER_STATE_BUDGET_ENV, WorkerStateConfigError, WORKER_STATE_PAGE

This is narrower than #1401, which deletes whole ./internal entry points nobody imports. ui-sdk's ./internal entry stays: ui-server and both backends use the other 159 names.

Scope

  • Remove the 68 names from packages/ui-sdk/src/internal.ts, and the three from internal-client.ts. Each symbol stays exported from its source module if ui-sdk code or tests still import it there.
  • Regenerate api-report/ui-sdk.txt.

Out of scope

Acceptance criteria

  • For each of the 71 listed names, the PR records its grep result at its base and whether removing it keeps declaration emit clean in every package that imports ./internal or ./internal/client. The PR removes each name that has no importer, does not reach an emitted declaration and is not imported by an open PR. It keeps every other name and names the reason. The per-name output is attached to the PR. Names that entered ./internal after the review are ui-sdk: 15 more internal entry names have no outside importer after #2534 #3412's.
  • api-report/ui-sdk.txt no longer lists the 71 removed names under ./internal or ./internal/client.
  • bun run typecheck, bun run test and tests/api-surface.test.ts pass.

Verification

bun run typecheck
bun run test packages/ui-sdk packages/ui-server packages/ui-backend-claude packages/ui-backend-pi
bun run test tests/api-surface.test.ts

Contract impact

None. Internal entries carry no compatibility promise (docs/decisions/public-export-boundary.md).

Found by a repository review on 2026-10-22.

2026-11-03: corrected the first acceptance criterion. A grep miss is not enough. WorkerOutputStorage, SessionPromptFacts and LinkEdit have no grep hit, but ui-server, the Claude backend and ui-react reach them through inferred return types, and removing them breaks those packages' declaration emit (TS2742). At the PR base, NativeBrainDeltaCandidate has an importer in ui-server, and open PR #3393 adds an import of MaintenanceResult. Names that became consumer-less after the review moved to #3412, so the original "every name still exported" criterion no longer bounds this issue.

Blocked by #3417

Activity

  1. added
    type: chore
    area: ui-sdk
    priority: p3
    agent-ready
    on Oct 21, 2026
  2. self-assigned this
    on Nov 2, 2026
  3. schlessera commented on Nov 2, 2026

    @schlessera
    OwnerAuthor

    Claiming (claim-2534-1793663600). Branch chore/2534-ui-sdk-internal-names, based on epic/2542-dead-code at ac3cab77a; the PR targets the epic integration branch.

  4. added this to the 0.45.0 milestone on Nov 3, 2026
  5. added
    blocked
    on Nov 3, 2026
  6. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Unblocked: #3417 is closed, so scripts/sync-project.ts is removing the blocked label.

  7. removed
    blocked
    on Nov 3, 2026
  8. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Blocker #3417 is closed; its fix, #3426, merged to main as 9a0fc4889. #3417 was this issue's only blocker, so blocked is removed. PR #3413 is refreshed onto epic/2542-dead-code (d6a36882f) and origin/main (559fe7b41), now at head 03cdfcb71. The refresh also fixes the epic's unused-export gate against main's new code. Typecheck, build, lint, 154 focused tests and check:pr --base origin/epic/2542-dead-code pass (1346 pass, 0 fail), and a fresh ready proof is requested.

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

Metadata

Metadata

Assignees

Labels

agent-readyarea: ui-sdkpriority: p3type: chore

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions