Skip to content

Commit 8c8c5b5

Browse files
refactor(ui)!: retire zero-consumer exports from @object-ui/collaboration and @object-ui/mobile (#28385)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuDNjQXVZgdT2wbAyWd5s4eX)_ Part of #25921 — the per-package zero-reference barrel batch for `@object-ui/plugin-gantt`, `@object-ui/plugin-designer`, `@object-ui/collaboration` and `@object-ui/mobile` (claim 6541128113). The card stays open: the other items it lists are untouched, and this PR does not finish the batch for gantt or designer (see Acceptance notes). Clause-②: no (narrowing) Metadata-protocol: none Skills-docs: none — no file under `skills/**` or `content/docs/**` names any of the eight retired exports (repo-wide `git grep -w`, zero hits each) ## 维护者速读 - 改了什么:从 `@object-ui/collaboration` 入口去掉 `useCommentSearch`(连同模块)、它的两个类型和 `createPresenceUpdater`;从 `@object-ui/mobile` 入口去掉 `useOfflineSync`(连同模块)、`OfflineSyncState`、`requestBackgroundSync` 和 `resolveResponsiveValue`。共 8 个名字,每包一个 `!` changeset。 - 为什么改:这 8 个名字在全仓(含 `examples/**`、`packages/console`、文档和技能)除自己包以外零引用,README 也没教;继续发布只是没人用的公开面。 - 风险与回滚:仓内没有任何消费者,Console 和其它 `@object-ui/*` 包不受影响;外部 npm 用户若用到会在升级时编译报错,changeset 里写了每个名字的替代写法。回滚就是 revert 本 PR。 - 先看:`ui/packages/mobile/src/index.ts`、`ui/packages/collaboration/src/index.ts`、`.changeset/25921-mobile-zero-consumer-exports.md`。 - 两分钟验证:`git grep -n -w -e useOfflineSync -e useCommentSearch -e requestBackgroundSync -e resolveResponsiveValue -e createPresenceUpdater -- ':!**/CHANGELOG.md' ':!.changeset/**'`,预期只剩 mobile/collaboration 自己的模块内定义与内部调用。 - 需要你做的:无,席位落地(入队前欠一次契约复审档的复审)。 ## What changes - `@object-ui/collaboration`: the entry stops exporting `useCommentSearch`, `CommentSearchConfig`, `CommentSearchReturn` and `createPresenceUpdater`. `src/useCommentSearch.ts` is deleted: the barrel was its only importer and it had no test. `createPresenceUpdater` stays in `usePresence.ts` (that module is also imported by `PresenceAvatars`), it only leaves the entry. - `@object-ui/mobile`: the entry stops exporting `useOfflineSync`, `OfflineSyncState`, `requestBackgroundSync` and `resolveResponsiveValue`. `src/useOfflineSync.ts` is deleted: the barrel was its only importer and it had no test. `requestBackgroundSync` stays in `serviceWorkerSource.ts` (beside the kept `getServiceWorkerSource`) and `resolveResponsiveValue` stays in `breakpoints.ts` (`useResponsive` calls it; `breakpoints.test.ts` imports it from the module, unchanged). - Two changesets, `patch` (`Metadata-protocol: none`), each with the `**BREAKING**` banner, the ADR-0087 `not-required (runtime-export-retired …)` marker naming every operand, and one FROM → TO line per name. ## How the set was chosen Every name each barrel exports was listed from the barrel's AST (35 / 38 / 38 / 51), then `git grep -l -w -F` ran for each over the whole tree at `origin/main` `a878ff6c` minus the package's own directory, `**/CHANGELOG.md`, `pnpm-lock.yaml`, `.changeset/**` and `ui/.changeset/**`. Positive controls with the same command: `useRecordPresence` 101 files, `ResponsiveContainer` 89, `ObjectGantt` 108. A name was retired only when all three hold: 1. zero hits outside its package (any hit, prose included, keeps the name); 2. the package's own `README.md` / `demo` / `docs` do not name it (`check-readme-exports` holds every README self-import to a real export, and the READMEs are outside this claim's surface); 3. no export that stays needs it: a prop, option or result type of a kept component or hook stays, and so does the offline queue family (`createOfflineQueue`, the two queue classes, `generateOpId`, `OfflineQueueBackend`, `OfflineOperation`), because the kept `createOfflineDataSource` requires `queue: OfflineQueueBackend`. | package | barrel names | zero hits outside | of those, named by the package README/demo | of those, needed by a kept export | retired here | |:--|--:|--:|--:|--:|--:| | `@object-ui/plugin-gantt` | 35 | 24 | 24 | — | 0 | | `@object-ui/plugin-designer` | 38 | 15 | 6 | 9 | 0 | | `@object-ui/collaboration` | 38 | 18 | 0 | 14 | 4 | | `@object-ui/mobile` | 51 | 24 | 1 | 19 | 4 | ## Tests Read at code head `1c0cadd8` (the later merge commit `b6c6ff29` brings 5 `origin/main` commits, none under the four packages; the derived command list re-computed on it is identical). - `pnpm --filter @object-ui/collaboration --filter @object-ui/mobile run type-check` → both `Done` (`tsc --noEmit && tsc -p tsconfig.test.json`); `pnpm --dir ui exec vitest run packages/collaboration packages/mobile` → 13 files, 133 tests passed (os-verify-lock `VERDICT command-exit 0`). - Public surface moved, so the direct importers were type-checked after the console closure build (`turbo run build --filter=@object-ui/console...` 71/71, then `--filter=./ui/packages/*` 73/73): `@object-ui/app-shell`, `plugin-calendar`, `plugin-grid`, `plugin-list`, `plugin-timeline` and `@object-ui/console` `type-check` all `Done`. - `pnpm --dir ui exec vitest run scripts/` → 169 files passed, 2 skipped; 4901 tests passed. - Full dogfood battery (the title carries `!`): closure `turbo run build --filter=@objectstack/dogfood^...` 68/68, then `pnpm --filter @objectstack/dogfood test` → Test Files 361 passed, 3 skipped (364); Tests 2917 passed, 28 skipped (2945); `VERDICT command-exit 0`, held the lock 1385 s. - No ablation: export lines removed and two untested modules deleted; no tested behaviour changed. ## Acceptance notes - **gantt and designer yield nothing under this claim's surface.** All 24 zero-hit gantt names (`QuickFilterBar`, `ResourceWorkload`, `computeWorkload`, the `shifts` helpers and their types, …) are taught in `ui/packages/plugin-gantt/README.md`; the 6 zero-hit designer values (`CollaborationProvider`, `ConnectionStatusIndicator`, `useClipboard`, `useMultiSelect`, `useCanvasPanZoom`, `PropertyEditor`) are taught in `ui/packages/plugin-designer/README.md`. Retiring them needs a README edit in the same PR, which is outside the claimed file surface; the other 9 designer names are the `…Props` types of components that stay exported. Whether documented exports are in scope at all is the seat's call. - `createPresenceUpdater` (in `usePresence.ts`) and `requestBackgroundSync` (in `serviceWorkerSource.ts`) are now exported by their modules only and read by nothing; deleting their bodies edits modules the claim does not cover, so they are left for the next pass. - `CommentSearchResult` in `@object-ui/types` loses its only code reader with `useCommentSearch` (a test in that package still names it); that is another package's batch. `CommentEntry` keeps `plugin-detail`'s `RecordComments` as a reader. ## Verification <details><summary>Derived gates — 28/28 run, 0 NOT-MEASURED</summary> `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack`: 28 commands; `--ran` with an exit code on every line: "28 derived famil(ies) accounted for — 28 run, 0 NOT-MEASURED (a DERIVED zero)". Every command exit 0, among them `check-adr-0087-registration --base origin/main` (re-run on `b6c6ff29`: exit 0), `check-empty-changeset --base origin/main`, `check-changeset-no-major`, `check-sdui-manifest`, `check:published-files`, `check:undeclared-dep-imports` and `vitest run scripts/`. Outside the derived set: `check-platform-checklist --changed-from origin/main` exit 0 (0 anchored files); `eslint` on the two changed barrels exit 0; `git merge-tree --write-tree HEAD origin/main` exit 0. `dispatch-gates --tier`: no path-derived mandate; 214 changed lines, under the 3000 threshold. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgTDDVJ8ZXyEBkyGSyv)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgTDDVJ8ZXyEBkyGSyv --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent fa74b48 commit 8c8c5b5

6 files changed

Lines changed: 39 additions & 175 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@object-ui/collaboration': patch
3+
---
4+
5+
refactor(collaboration)!: retire the zero-consumer `useCommentSearch` and `createPresenceUpdater` exports
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (runtime-export-retired @object-ui/collaboration#useCommentSearch, @object-ui/collaboration#CommentSearchConfig, @object-ui/collaboration#CommentSearchReturn, @object-ui/collaboration#createPresenceUpdater) the retired operands are a React hook, its two option and result types, and a plain helper factory in a published ui package's entry that nothing in the workspace imported; no packages/spec schema, no registered node type, no ADR-0087 conversion surface and no stored shape names them, so there is nothing for `objectstack migrate meta` to rewrite -->
11+
12+
**BREAKING** for a host that imports any of these four names from `@object-ui/collaboration`. None had an importer anywhere in the workspace, so the Console and every `@object-ui/*` package are unaffected. `useCommentSearch` is deleted with its module; `createPresenceUpdater` leaves the package entry only. Everything else the entry exports is unchanged, including `usePresence`, `PresenceProvider`, `CommentThread` and their types.
13+
14+
What leaves, and what to write instead:
15+
16+
- FROM `useCommentSearch` TO a `useMemo` over your own comment list that keeps the entries whose `text` or `author` contains the trimmed, lower-cased query.
17+
- FROM `CommentSearchConfig` TO `{ comments: CommentEntry[] }`, with `CommentEntry` from `@object-ui/types`.
18+
- FROM `CommentSearchReturn` TO the shape your own search state returns; the result rows can keep using `CommentSearchResult` from `@object-ui/types`.
19+
- FROM `createPresenceUpdater` TO a `Map<string, PresenceUser>` keyed by `userId` that you update from your realtime channel, or `PresenceProvider` with `useTenantPresence` / `useRecordPresence`, which the package keeps exporting.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@object-ui/mobile': patch
3+
---
4+
5+
refactor(mobile)!: retire the zero-consumer `useOfflineSync`, `requestBackgroundSync` and `resolveResponsiveValue` exports
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (runtime-export-retired @object-ui/mobile#useOfflineSync, @object-ui/mobile#OfflineSyncState, @object-ui/mobile#requestBackgroundSync, @object-ui/mobile#resolveResponsiveValue) the retired operands are a React hook, its state type and two plain helpers in a published ui package's entry that nothing in the workspace imported; no packages/spec schema, no registered node type, no ADR-0087 conversion surface and no stored shape names them, so there is nothing for `objectstack migrate meta` to rewrite -->
11+
12+
**BREAKING** for a host that imports any of these four names from `@object-ui/mobile`. None had an importer anywhere in the workspace, so the Console and every `@object-ui/*` package are unaffected. `useOfflineSync` is deleted with its module; `requestBackgroundSync` and `resolveResponsiveValue` leave the package entry only (`useResponsive` still resolves through the latter internally). The offline data source (`createOfflineDataSource`, `createOfflineQueue` and its queue classes), `getServiceWorkerSource`, `useResponsive` and `BREAKPOINTS` stay exported unchanged.
13+
14+
What leaves, and what to write instead:
15+
16+
- FROM `useOfflineSync(source)` TO your own effect on the `OfflineDataSource` that `createOfflineDataSource` returns: read `source.pending()` into state, call `source.replay()` on the window `online` event, and use `source.drop(opId)` / `source.clear()` for the queue controls.
17+
- FROM `OfflineSyncState` TO the state shape that effect keeps (`isOnline`, `pending: OfflineOperation[]`, `isReplaying`).
18+
- FROM `requestBackgroundSync(tag)` TO `(await navigator.serviceWorker.ready).sync?.register(tag)`, guarded for browsers without Background Sync.
19+
- FROM `resolveResponsiveValue(value, breakpoint)` TO `useResponsive(value)` inside a component, which reads the current breakpoint itself.

‎ui/packages/collaboration/src/index.ts‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export {
2929

3030
export {
3131
usePresence,
32-
createPresenceUpdater,
3332
type PresenceUser,
3433
type PresenceConfig,
3534
type PresenceResult,
@@ -69,12 +68,6 @@ export {
6968
type MentionNotificationsResult,
7069
} from './useMentionNotifications.js';
7170

72-
export {
73-
useCommentSearch,
74-
type CommentSearchConfig,
75-
type CommentSearchReturn,
76-
} from './useCommentSearch.js';
77-
7871
export {
7972
PresenceAvatars,
8073
type PresenceAvatarsProps,

‎ui/packages/collaboration/src/useCommentSearch.ts‎

Lines changed: 0 additions & 86 deletions
This file was deleted.

‎ui/packages/mobile/src/index.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,11 @@ export {
5050
type OfflineDataSourceOptions,
5151
type QueueableDataSource,
5252
} from './createOfflineDataSource.js';
53-
export { useOfflineSync, type OfflineSyncState } from './useOfflineSync.js';
5453
export {
5554
getServiceWorkerSource,
56-
requestBackgroundSync,
5755
type ServiceWorkerSourceOptions,
5856
} from './serviceWorkerSource.js';
59-
export { BREAKPOINTS, resolveResponsiveValue } from './breakpoints.js';
57+
export { BREAKPOINTS } from './breakpoints.js';
6058

6159
// Re-export types for convenience
6260
export type {

‎ui/packages/mobile/src/useOfflineSync.ts‎

Lines changed: 0 additions & 79 deletions
This file was deleted.

0 commit comments

Comments
 (0)