Skip to content

docs: fix index.ts as the only public surface (ADR-0006) - #293

Closed
diegolmello wants to merge 4 commits into
mobilefrom
adr/public-surface
Closed

docs: fix index.ts as the only public surface (ADR-0006)#293
diegolmello wants to merge 4 commits into
mobilefrom
adr/public-surface

Conversation

@diegolmello

@diegolmello diegolmello commented Aug 13, 2026

Copy link
Copy Markdown
Member

Proposed changes

The package ships TypeScript source with main at index.ts, no exports map and no files list, so every path in the repository resolves for a consuming app while index.ts names only settings and Rocketchat. No line was drawn between the two, so no change to a module under lib/ could be judged as breaking or not — deleting an unused helper was answerable only by grepping the consuming app.

ADR-0006 draws it: index.ts is the only public surface, and anything not exported from it is internal. No exception is written for Rocket.Chat.ReactNative's remaining deep imports of lib/drivers/ddp — whether one still held is a fact about the other repository that nothing here can observe. The ADR states the expectation instead, and the exports map is what would make it true.

CONTEXT.md gains the two terms the ADR introduces, Public surface and Deep import.

clients/Rocketchat.ts is deleted with the same change. It is a one-line export * over a module whose only export is a default, so it forwards nothing, and no file in this repository imports it — it exists only to serve the deep path @rocket.chat/sdk/clients/Rocketchat, which is the practice the ADR bans.

The ADR is explicit that this is unenforced convention until an exports map exists, and gives the order that would make it real: widen index.ts with the realtime contracts, move the consuming app onto that path, then add the map.

Merge #257 first. The ADR cites the debounce deletion from lib/util.ts as the change that had no rule to judge it, and that deletion lands in #257 — until it merges, the sentence describes something the base branch has not seen yet.

Steps to reproduce

  • grep -rn "clients/Rocketchat" over this repository matches the deleted file itself and one more line: index.ts importing the default from lib/clients/Rocketchat. Nothing imports the root-level file.
  • The module it re-exported has a default export and no named ones, so export * forwarded nothing at all.

Tests

No tests added — the deleted file has no importer and no runtime behaviour.

  • Suite unchanged and green: 146 tests across 10 suites.
  • npm run typecheck clean.

The file is a one-line re-export that forwards nothing and has no importer in
this repository. It exists only to serve a deep path, which is the practice the
ADR bans, so it belongs in the Decision rather than unmentioned.

Also states the consumer exception as an invariant — deep imports from test
files only — instead of two hardcoded paths in another repository.
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.

1 participant