Skip to content

Commit 3eeb81d

Browse files
refactor(collaboration, types)!: retire the zero-consumer useMentionNotifications hook and MentionNotification (#29732)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9Ubb8SWuZMeMAGh31P7H2NJ3R7)_ Part of #25921. The umbrella stays open; this is one batch of it. Clause-②: no (narrowing) Metadata-protocol: none ## 维护者速读 - 改了什么:删除 `@object-ui/collaboration` 里没有任何使用者的 `useMentionNotifications` 钩子(连同两个配置/结果类型),以及 `@object-ui/types` 里只被它读取的 `MentionNotification` 接口。 - 为什么改:控制台的 @提及 铃铛读的是服务端通知(`sys_notification`,经 `useInboxBell`),这个前端内存版钩子从未被接上;留着它会让人(和 AI)误以为提及通知走的是它。 - 风险与回滚:对外是 breaking 收窄,只影响直接 import 这几个名字的外部宿主;仓内与 hotcrm 零引用。回滚即 revert 本 PR。 - 先看:`.changeset/25921-collab-mention-notifications.md`(迁移说明)、`ui/packages/types/src/views.ts`(删除的接口)、`ui/packages/collaboration/src/index.ts`(barrel 行)。 - 两分钟验证:`git grep -w -e useMentionNotifications -e MentionNotification -- ui packages apps examples content` 应只剩 changeset 与 QA 清单里的历史文字,无代码命中。 - 需要你做的:无,席位落地。 ## What changes - Delete `ui/packages/collaboration/src/useMentionNotifications.ts` (97 lines) and its barrel lines (`useMentionNotifications`, `MentionNotificationsConfig`, `MentionNotificationsResult`). - Delete the `MentionNotification` interface from `ui/packages/types/src/views.ts` and its barrel line in `ui/packages/types/src/index.ts`. - `ui/packages/types/src/__tests__/record-id-string-survivors-10078.test.ts`: doc comment only. It named `MentionNotification.recordId` while recounting which ids an earlier ruling covered; it now describes that interface as retired. The test pins `RecordSubscription.recordId` and `DataSourceMutationEvent.id` only, so no assertion moves. - One new changeset, `.changeset/25921-collab-mention-notifications.md`: patch for both packages, BREAKING paragraph, one FROM/TO line per retired name, ADR-0087 marker `not-required (runtime-export-retired ...)` naming all four operands. ## Tests Premise census on `origin/main` 1c1a5d4 (`git grep -l -w -F NAME`, excluding `**/CHANGELOG.md`, lockfiles and `.changeset/**`): | Name | Files repo-wide | Outside `ui/packages/collaboration` | |:---|---:|:---| | `useMentionNotifications` | 3 | `docs/qa/platform-checklist/areas/records-forms.json` only (prose) | | `MentionNotificationsConfig` | 2 | none | | `MentionNotificationsResult` | 2 | none | | `MentionNotification` | 4 | `ui/packages/types` definition, barrel and the 10078 test comment only | | `useRealtimeSubscription` (positive control) | 72 | 71 | hotcrm and docs.objectos.ai: 0 hits for `MentionNotification` (case-insensitive substring). No string or dynamic `import()` of the module path, and neither package README names the hook or the type. After the change (head 4d64f54). Two later merges of main brought no file of `collaboration` or `types`: d6bab30 none under `ui/`, 9be84e1 only `ui/packages/fields` (lookup cell). Readings: - `turbo run type-check` for `@object-ui/types`, `@object-ui/collaboration`, `@object-ui/app-shell`, `@object-ui/console` with their `^build` closure: 74 of 74 tasks successful (lock VERDICT command-exit 0, 12m23s). - `vitest run packages/collaboration/ packages/types/ --maxWorkers=2` from `ui/`: Test Files 394 passed (394), Tests 10545 passed (10545). - Reverse check on the rebuilt `.d.ts`: a temporary probe in app-shell importing the retired names answered `TS2305 Module '"@object-ui/types"' has no exported member 'MentionNotification'` and `TS2305 ... '"@object-ui/collaboration"' has no exported member 'useMentionNotifications'`, while `CommentEntry` from the same entry still resolved. Probe deleted. - `pnpm --dir ui run check:readme-exports`: census line `0 fabricated, 0 stale omission(s)`; exit 1 only on the known prerequisite (`packages/cli` dist unbuilt: `@object-ui/cli` imports `serve` / `init`). - On 9be84e1 the census reads `MentionNotificationsConfig` 0, `MentionNotificationsResult` 0, `MentionNotification` 0, `useMentionNotifications` 1 (the QA checklist prose), control `useRealtimeSubscription` 72. ## Acceptance notes - `docs/qa/platform-checklist/areas/records-forms.json` L3265 (a `source[]` line saying the hook "is exported but the console does not consume it") is now stale: the hook is no longer exported. Left untouched per the claim's file surface; L3299 is a history row and stays as written. - The pending precedent changeset `.changeset/25921-types-comment-search-result.md` says `MentionNotification` "stay[s] exported unchanged". This PR makes that sentence untrue for the release that consumes both. Not edited here (editing a pending `25921-*` changeset reds Check Changeset); the seat may want to amend it in a docs-only follow-up before the release. - A director contract review is owed (narrowing batch); the seat routes it. ## Verification <details><summary>Derived gates (dispatch-gates --commands, head 4d64f54): 35 commands</summary> 33 of 33 run in a loop exited 0, among them `check-adr-0087-registration --base origin/main`, `check-changeset-no-major --base origin/main`, `check-sdui-manifest` (and `--self-test`), `check-comment-mask-corpus`, `check-empty-changeset`, `check:published-files`, `check:type-check-coverage`, `check:undeclared-dep-imports`, `check:test-source-alias`, `check:cross-package-test-inputs`, `check:nul-bytes`. The other two ran under the verify lock: `pnpm --dir ui exec vitest run scripts/` (Test Files 170 passed, 2 skipped; Tests 4977 passed, 2 skipped; VERDICT command-exit 0) and `pnpm check:type-check-debt` (VERDICT command-exit 0). Against this PR body: `check-changeset-no-major` exit 0, `check-adr-0087-registration` exit 0 (all four `runtime-export-retired` operands verified as retired from their entries), `check-closing-keyword-parity` exit 0, `check-partof-closing-keyword` exit 0. `check-platform-checklist --changed-from origin/main`: 0 anchored files in the change set. </details> <details><summary>Dogfood battery (head d6bab30)</summary> Closure build plus `pnpm --filter @objectstack/dogfood test` under the verify lock: Test Files 401 passed, 3 skipped (404); Tests 3310 passed, 28 skipped (3338); VERDICT command-exit 0. The final head 9be84e1 adds only the main merge described under Tests. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01QsR2jSoUd7Uhw6ei5FFLD1)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 11c4eb5 commit 3eeb81d

6 files changed

Lines changed: 20 additions & 133 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@object-ui/collaboration': patch
3+
'@object-ui/types': patch
4+
---
5+
6+
refactor(collaboration, types)!: retire the zero-consumer `useMentionNotifications` hook and the `MentionNotification` interface
7+
8+
Clause-②: no (narrowing)
9+
Metadata-protocol: none
10+
11+
<!-- adr-0087: not-required (runtime-export-retired @object-ui/collaboration#useMentionNotifications, @object-ui/collaboration#MentionNotificationsConfig, @object-ui/collaboration#MentionNotificationsResult, @object-ui/types#MentionNotification) the retired operands are a React hook that kept an in-memory list of mention notifications, its two TypeScript config and result interfaces, and the `MentionNotification` interface of `@object-ui/types` that only the hook read; nothing in the workspace or in hotcrm imports any of them (the console bell reads the server inbox through `useInboxBell`), and no packages/spec schema, registered node type, conversion surface or stored shape names them, so there is nothing for `objectstack migrate meta` to rewrite -->
12+
13+
**BREAKING** for a host that imports `useMentionNotifications`, `MentionNotificationsConfig` or `MentionNotificationsResult` from `@object-ui/collaboration`, or the type `MentionNotification` from `@object-ui/types`. The hook held a client-side list of mention notifications with read flags; no console surface used it, because mention notifications are server records (`sys_notification`, topic `collab.mention`) that the console bell reads from the inbox feed. `CommentEntry` and `ActivityEntry` stay exported unchanged. The `CommentSearchResult` entry of this release said `MentionNotification` stays exported; it leaves here.
14+
15+
- FROM `useMentionNotifications` TO a local hook in your own code, or read the server inbox (`GET /api/v1/notifications`) as the console bell does.
16+
- FROM `MentionNotificationsConfig` TO a local interface in your own code: `{ currentUserId: string; initialNotifications?: MentionNotification[]; onDeliver?: (notification: MentionNotification) => void | Promise<void> }`.
17+
- FROM `MentionNotificationsResult` TO a local interface in your own code, typed by what your own hook returns.
18+
- FROM `MentionNotification` TO a local interface in your own code: `{ id: string; type: 'mention'; recipientId: string; commentId: string | number; mentionedBy: string; commentText: string; objectName?: string; recordId?: string; createdAt: string; read?: boolean; channels?: Array<'in_app' | 'email' | 'push'> }`.

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@ export {
6262
type CollaborationTranslate,
6363
} from './useCollaborationTranslation.js';
6464

65-
export {
66-
useMentionNotifications,
67-
type MentionNotificationsConfig,
68-
type MentionNotificationsResult,
69-
} from './useMentionNotifications.js';
70-
7165
export {
7266
PresenceAvatars,
7367
type PresenceAvatarsProps,

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

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

‎ui/packages/types/src/__tests__/record-id-string-survivors-10078.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
*
1515
* Director batch #195 item 1, letter A (objectui#9511) made a record id a
1616
* `string` wherever METADATA names one, and extended it as "the same
17-
* principle" to `CommentEntry.recordId` / `MentionNotification.recordId`. The
17+
* principle" to `CommentEntry.recordId` and to the `recordId` of a mention
18+
* notification interface that has since been retired with its only reader. The
1819
* two below are runtime / API shapes that ruling did not name; carrying the
1920
* rule to them is the `domain:spec` seat's inheritance decision in the claim on
2021
* objectui#10078. Each carried the same id with the old `string | number`

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,6 @@ export type {
10701070
DetailSectionNodeSchema,
10711071
ViewComponentSchema,
10721072
CommentEntry,
1073-
MentionNotification,
10741073
ActivityEntry,
10751074
// Feed / Chatter Protocol Types
10761075
FeedItemType,

‎ui/packages/types/src/views.ts‎

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -479,34 +479,6 @@ export interface CommentEntry {
479479
recordId?: string;
480480
}
481481

482-
/**
483-
* Mention notification - delivered when a user is @mentioned in a comment
484-
*/
485-
export interface MentionNotification {
486-
/** Unique notification ID */
487-
id: string;
488-
/** Type of notification */
489-
type: 'mention';
490-
/** ID of the user being notified */
491-
recipientId: string;
492-
/** The comment that contains the mention */
493-
commentId: string | number;
494-
/** Author who mentioned the recipient */
495-
mentionedBy: string;
496-
/** The comment text (or excerpt) */
497-
commentText: string;
498-
/** Object name the comment belongs to */
499-
objectName?: string;
500-
/** Record ID the comment belongs to. A string, per the one record-id rule (objectui#9511). */
501-
recordId?: string;
502-
/** When the mention was created */
503-
createdAt: string;
504-
/** Whether the notification has been read */
505-
read?: boolean;
506-
/** Delivery channels */
507-
channels?: Array<'in_app' | 'email' | 'push'>;
508-
}
509-
510482
/**
511483
* Activity Entry - represents a single activity/field change on a record
512484
*/

0 commit comments

Comments
 (0)