Skip to content

ui-react: default-root wrappers left by the export cut have no caller or only test callers #2535

Closed

Description

@schlessera

Context

The public-export cut (docs/decisions/public-export-boundary.md) removed ui-react's default-root wrappers from its public entry, and the decision lists them as removed. The wrapper functions themselves were left in src, and most now have no caller at all:

name defined at importers
sendClientMessage packages/ui-react/src/hooks/use-websocket.ts:10 none
reconnectWebSocketNow packages/ui-react/src/hooks/use-websocket.ts:11 none
recheckVpnStatus packages/ui-react/src/hooks/use-vpn-status.ts:50 none
loadSessionActivityHistory, loadSpanPayloads packages/ui-react/src/stores/activity-store.ts:13-14 none (the same names elsewhere are store methods, not these bindings)
getWsUrl, getBackendUrl packages/ui-react/src/lib/backend.ts:45-46 none; root.ts:6 and the tests use the …For(config) variants
handleServerMessage, flushChatDeltas packages/ui-react/src/hooks/use-websocket.ts:8-9 tests only (10 files, e.g. packages/ui-react/tests/delta-batching.test.ts:7, tests/session-demux.test.ts:4, tests/render/streaming-bench.tsx:62)

Each wrapper forwards to the module-level defaultRoot, so the tests that use handleServerMessage/flushChatDeltas drive the default root through a back door instead of root.connection.*, which is what the app uses.

Five more ui-react exports are used only in their own file (selectBackendForProvider, normalizeDirPath, isUnconfirmed, CountBadge, ViewerError). #2536 owns dropping their export along with its unused-export gate; they are not part of this issue.

git grep -nE "import[^;]*\b(sendClientMessage|reconnectWebSocketNow|recheckVpnStatus|loadSessionActivityHistory|loadSpanPayloads|getWsUrl|getBackendUrl)\b[^;]*from" -- packages tests scripts   # nothing
git grep -nE "import[^;]*\b(handleServerMessage|flushChatDeltas)\b[^;]*use-websocket" -- packages tests scripts       # tests only

Scope

  • Delete the nine wrappers listed in the table.
  • Point the tests that import handleServerMessage/flushChatDeltas at a root they create (or the default root's connection), as tests/root-isolation.test.ts already does.
  • Update docs/decisions/public-export-boundary.md and docs/decisions/design-kit/state-architecture.md if they name a deleted function as existing.

Out of scope

  • The default root itself and useWebSocket/useVpnStatus hooks.
  • Test-only logic in src that is not a default-root wrapper (ToolCallTimeline, inlineRenderedFences and similar; tracked separately).
  • The five own-file exports and the gate for unused exports (ci: no gate catches an export that no other file imports #2536).

Acceptance criteria

  • None of the nine wrapper names is defined in packages/ui-react/src.
  • No test imports from src/hooks/use-websocket anything other than useWebSocket and runStateForFrame.
  • The tests that used the wrappers still pass, and each still fails when the frame handling it covers is broken. Record one mutation per converted file group in the PR, for example dropping delta batching for delta-batching.test.ts.
  • bun run typecheck and bun run test packages/ui-react pass; api-report/ui-react.txt is unchanged (none of these names is public).

Verification

bun run test packages/ui-react
bun run typecheck
bun run test tests/api-surface.test.ts

Contract impact

None. None of the names is exported from a ui-react entry point.

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

2026-10-24: moved the five own-file export removals to #2536, which now owns them; this issue keeps wrapper deletion and the test conversion to root-owned connections.

Activity

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

    @schlessera
    OwnerAuthor

    Claiming (token claim-2535-d2d0). Branch chore/2535-default-root-wrappers, targeting the epic integration branch epic/2542-dead-code. Collision check: PR #3368 also touches docs/decisions/public-export-boundary.md; other reports are dependency-closure only.

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

    @schlessera
    OwnerAuthor

    PR #3411 (base epic/2542-dead-code @ ac3cab77a, head 85fe98a65) deletes all nine wrappers. The test importers now call defaultRoot.connection, with one mutation receipt per file group. The api-report is unchanged and local preflight passed. The PR is ready; hosted proof is pending. This issue closes when the epic batch lands on main.

  6. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Delivered to epic/2542-dead-code as 9df9192f3 via #3411, after ready-candidate proof passed on the exact epic base. This issue closes when the epic batch lands on main.

  7. removed their assignment
    on Nov 3, 2026
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: ui-reactpriority: p3type: chore

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions