Skip to content

refactor(runtime-host): trim dead export surface from barrels - #3095

Merged
Astro-Han merged 2 commits into
apache:mainfrom
CxHsin:refactor/runtime-host-trim-dead-exports
Aug 16, 2026
Merged

refactor(runtime-host): trim dead export surface from barrels#3095
Astro-Han merged 2 commits into
apache:mainfrom
CxHsin:refactor/runtime-host-trim-dead-exports

Conversation

@CxHsin

@CxHsin CxHsin commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Trim the consumed API surface of the @maka/runtime-host server, client, protocol, and adapter barrels. Package-internal consumers of removed exports now import directly from their leaf modules, so runtime behavior is unchanged.

Fixes #3087

Verification

  • npm --workspace @maka/runtime-host run build passed.
  • npm --workspace @maka/runtime-host run typecheck passed.
  • Focused runtime-host protocol tests passed: 127/127.
  • npm run build passed.
  • npm run typecheck passed.
  • npm run lint passed.
  • npm run format:check passed.
  • npx knip --workspace apps/desktop --workspace packages/ui passed.
  • The full runtime-host test command was started and passed its initial suites, then stopped after Windows shell/PTY cases produced known environment-level failures and a prolonged no-output hang. No UI changes are included.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Codex performed the implementation, test updates for leaf imports, verification, and code review. The commit includes the required Generated-by: Codex trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

Remove unconsumed server, client, protocol, and adapter barrel exports while moving package-internal consumers to their leaf modules.

Generated-by: Codex
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 949b2133-9820-4aaa-a324-f9d34f58097e

📥 Commits

Reviewing files that changed from the base of the PR and between c0829ec and 083cdc8.

📒 Files selected for processing (1)
  • packages/runtime-host/src/__tests__/host-kernel.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/runtime-host/src/tests/host-kernel.test.ts

Included review availability: Your plan includes up to 3 reviews per rolling hour; 2 remain after this review.


📝 Walkthrough

Summary

This PR reduces the advertised API surface of the private @maka/runtime-host package. It removes unused re-exports from the server, client, protocol, and adapter barrel files. Internal consumers now import directly from leaf modules.

The PR extends the existing module structure. It does not create a parallel implementation or change runtime behavior.

The changes are the smallest coherent solution. They remove only unconsumed barrel exports and update dependent imports. No additional abstraction or runtime path was added.

No further deletion or simplification is identified without reducing API regression coverage. The import-only test changes preserve existing protocol, transport, server, and client coverage. The formatting fix restores Biome-approved wrapping for three assert.rejects calls.

Risks and validation

  • Removing barrel exports changes the package module contract. Consumers that import removed names from barrel files may fail. The package is private, but this contract change requires review.
  • The current diff shows no apparent changes to user-visible runtime behavior, security behavior, licensing, release processes, or governance.
  • Build, typecheck, lint, formatting, focused protocol tests, and workspace verification passed according to the provided results.
  • The full runtime-host test command remains unverified because it encountered known Windows shell/PTY failures and a prolonged no-output hang.

Review-relevant risks

The current diff changes the exported API contract of @maka/runtime-host, including server, client, protocol, and adapter barrel exports. Material changes to package contracts require independent human review under repository policy.

No other protected-area effect was identified in the current diff. The person performing the merge must review the final diff, and a maintainer makes the final determination.

Walkthrough

The change narrows runtime-host barrel exports and updates internal tests and runtime modules to use direct imports. Test assertions and runtime behavior remain unchanged.

Changes

Runtime-host barrel cleanup

Layer / File(s) Summary
Narrow barrel export surfaces
packages/runtime-host/src/client/index.ts, packages/runtime-host/src/protocol/index.ts, packages/runtime-host/src/server/index.ts
Unused client, protocol, and server exports are removed. Selected entrypoints remain exported.
Use direct runtime module imports
packages/runtime-host/src/server/session-catalog-coordinator.ts, packages/runtime-host/src/transport/*
RuntimeHostProtocolError is imported from protocol/errors.js instead of the protocol barrel.
Update tests for narrowed barrels
packages/runtime-host/src/__tests__/*
Tests import protocol errors, server services, kernel APIs, and readiness helpers from dedicated modules. Test behavior is unchanged.

Estimated code review effort: 2 (Simple) | ~15 minutes

Merge Risk: ⚪ Minimal · up to 083cd

This PR trims unused barrel exports and updates internal imports without changing runtime behavior; no actionable merge-blocking risk remains after normal checks and review.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: reducing unused exports from runtime-host barrel modules.
Description check ✅ Passed The description covers the required summary, issue reference, verification results, AI use, checklist, and behavior assessment.
Linked Issues check ✅ Passed The changes remove the specified dead barrel exports, update internal imports, preserve behavior, and include the required verification evidence.
Out of Scope Changes check ✅ Passed All changes are limited to trimming runtime-host barrel exports and updating affected internal test and source imports.
Ai Use Disclosure ✅ Passed The PR selects generative tooling, names Codex and its scope, and both introduced commits contain standalone Generated-by: Codex trailers.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed against #3087.

The deleted server / client / protocol / adapter names have no external importers in cli, desktop, eval, ui, or runtime. The kept server exports are used. Package-internal imports that went through those barrels now point at leaf modules. RuntimeHostProtocolError is no longer re-exported from the protocol barrel; its remaining importers use protocol/errors.js. OAUTH_PRESENTATION_SERVICE_ID / VERSION left the client barrel and still come from the protocol barrel, which is the right owner.

This does not stop the same dead surface growing back: knip.json still only covers apps/desktop and packages/ui. That was optional in the issue; it is the actual gate. Also revert the unrelated assert.rejects rewraps in host-kernel.test.ts.

Approve. The knip follow-up should be its own PR.

AI-assisted review: Grok 4.6 drafted the first pass. A second pass on opencode-go/deepseek-v4-flash:max enumerated the deleted names and grepped consuming workspaces; it found no leftover importer and no behavior change in host-kernel.test.ts beyond the formatter reflow. I grepped the deleted export names from the consuming workspaces and checked knip.json. Unverified by me: I did not rerun the runtime-host suite.

@Astro-Han

Copy link
Copy Markdown
Contributor

Approve stands. Cannot merge yet: the typecheck job fails on Biome format in packages/runtime-host/src/__tests__/host-kernel.test.ts.

That is the unrelated assert.rejects rewrap I flagged in the review. Revert those three call sites to the previous wrapping (or run npx biome check --write on that file and commit the formatter output). After CI is green I can merge.

Fast path would apply once checks pass: barrel-only export trim, no runtime behavior change, easy to revert.

Restore the Biome-approved wrapping for three assert.rejects calls so the PR typecheck workflow can pass.

Generated-by: Codex
@Astro-Han
Astro-Han merged commit ded2dcd into apache:main Aug 16, 2026
12 checks passed
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.

refactor(runtime-host): trim dead export surface from server/client/protocol barrels

2 participants