Skip to content

Commit ba4648d

Browse files
fix(plugin-audit): describe sys_comment reactions and mentions by the shape they store (#20558) (#20605)
Fixes #20558 Clause-②: no The `description` of two `sys_comment` fields is served metadata (field help, and what an AI client reads before it seeds a comment). Both named a shape no producer writes. They now name the stored shape, and the `en` translation bundle is regenerated from the source. | Field | Description was | Description is now | | --- | --- | --- | | `reactions` | `JSON array of emoji reaction objects` | `JSON object mapping each emoji to the list of user ids who reacted` | | `mentions` | `JSON array of @mention objects` | `JSON array of the user ids @mentioned in the comment` | Files: `packages/plugins/plugin-audit/src/objects/sys-comment.object.ts` (2 lines), `packages/plugins/plugin-audit/src/translations/en.objects.generated.ts` (regenerated), `.changeset/20558-comment-reactions-mentions-description.md` (patch on `@objectstack/plugin-audit`). Landing point is the one the card names; no producer lives in another package of this repository. ## Measurement (premise check, before the edit) Trees read: objectstack `c876a742` (this PR's base) and objectui `bf7ab35c` (a read-only shallow clone made through the session git proxy; the REST API answers 403 for that repository, plain git does not). - `reactions`, this repository: no producer or reader. `git grep -i reactions` over the tree, minus CHANGELOGs and generated bundles, finds only the field declaration, ADR and docs prose, and unrelated `enableReactions` UI props. - `reactions`, objectui `packages/app-shell/src/views/RecordDetailView.tsx`: `parseReactions` reads a JSON object of `emoji -> string[]`, and the click handler writes `JSON.stringify(storedReactions(...))`, the same map (`storedReactions` returns a string-keyed map of string arrays). `packages/collaboration/src/CommentThread.tsx` types it as a string-keyed map of string arrays. The card's premise holds. - `mentions`, producer: the same file's `handleAddComment` and `handleAddReply` (the only two `sys_comment` creates in objectui) write `mentions: JSON.stringify(mentionIds)`, and `extractMentions` in `packages/plugin-detail/src/extractMentions.ts` returns a de-duplicated `string[]` of user ids. No objects. This disagrees with the old sentence, so per the triage rule `mentions` rides in this PR. - `mentions`, consumer in this repository: `writeCommentMentions` in `packages/plugins/plugin-audit/src/audit-writers.ts` reads the JSON and accepts an array of id strings or an array of objects with an `id` key. Every in-repo test value is an id string (`'["user-2"]'`). The description names only the one shape the producer writes; the consumer's object tolerance is not advertised (one strict contract, not two dialects). - Not measured: any producer outside objectstack and objectui (the `cloud` repository was not read); a runtime probe of what the console shows for the old array shape (the card marks that step as read inference, and it stays so). ## Translations `node scripts/check-i18n-bundles.mjs --write` rewrote only `en.objects.generated.ts`. The other eight packages regenerated with no diff. The `zh-CN`, `ja-JP` and `es-ES` bundles keep their hand-written values (merge mode), and `pnpm check:i18n` and `pnpm check:i18n-stale-fill` are green without touching them, so per the dispatch they are not hand-translated here. Six strings therefore still say "array of ... objects" and now contradict the English: `mentions` and `reactions` `help` in each of the three locales (`zh-CN` lines 218 and 222, `ja-JP` lines 218 and 222, `es-ES` lines 218 and 222). This is listed in the report as an open question for the PM seat. ## Verification (final head e83328b) - Derived gate list: `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` gives 57 commands (the seat's 50 plus 7 that the changeset file adds). All 57 were run one by one with the exit code captured first; all exit 0 at `e83328b6`. `--ran` reconciliation with exit codes: 57 derived, 57 run, 0 NOT-MEASURED, 0 UNRUN. One first attempt of `pnpm check:dual-build-cjs-loads` exited 3 (PREREQUISITE NOT MET: nine unrelated packages had no `dist/`); after building those nine it exited 0 (104 entry points, 66 packages). - `pnpm --filter @objectstack/plugin-audit test`: 25 files, 363 tests passed. `pnpm --filter @objectstack/plugin-audit typecheck`: exit 0 (both run at `236bae38`; the one later commit changes only the changeset text). - One-time ablation (nothing kept): with the `en` bundle put back to the base text, on-disk mutation confirmed by grep (old text 1, new text 0), `node scripts/check-i18n-bundles.mjs --filter=audit` exits 1 with `plugins/plugin-audit DRIFTED (1)`. Restored with `git checkout HEAD -- path`; the blob hash matches HEAD (`7c457527...`) and `git diff HEAD` is empty. Direction observed: red, as expected. - Line budget: 20 additions, 4 deletions, 3 files; no `skills/**` file touched. ## Acceptance notes - The one open item is the three stale translated locales above; nothing else is left out of scope. ## Seat append — patch round 1 (head `0cebc286`, the dev's text, appended by the `domain:services` seat) The seat answered the open question above with option A, so the six translated help strings are rewritten on this branch. This section supersedes the Translations and Acceptance notes paragraphs above where they call the three locales stale. Values only: no key added or dropped, no `label` and no other string touched. Exactly six `help` values changed (two per file, 6 additions and 6 deletions): | Locale | `mentions` help | `reactions` help | | --- | --- | --- | | `zh-CN` | `评论中被 @ 提及的用户 ID 的 JSON 数组` | `将每个表情映射到对其做出回应的用户 ID 列表的 JSON 对象` | | `ja-JP` | `コメント内で @メンションされたユーザー ID の JSON 配列` | `各絵文字を、リアクションしたユーザー ID のリストに対応付ける JSON オブジェクト` | | `es-ES` | `Matriz JSON de los id de usuario mencionados con @ en el comentario.` | `Objeto JSON que asigna cada emoji a la lista de id de usuario de quienes reaccionaron.` | Wording follows each bundle's own habits: the terms for a user id match the existing `user_id` help in the same file, `es-ES` keeps its trailing period as 20 of its 23 help strings do, and `zh-CN` and `ja-JP` stay period-free. The faithfulness of the translations was read by the author only, with no native-speaker review. The changeset gains one clause saying the translated help texts follow; the level stays `patch`. Proof the tool keeps them: after the edit was committed, `node scripts/check-i18n-bundles.mjs --write` regenerated all nine packages and left `git status --porcelain` empty and `git diff HEAD` at zero lines. Against the previous head, the diff of the three translation files is those six `help` lines and nothing else. At head `0cebc286`: `pnpm check:i18n`, `pnpm check:i18n-stale-fill` and `pnpm check:nul-bytes` exit 0, `pnpm --filter @objectstack/plugin-audit test` passes (25 files, 363 tests), and all 57 derived gate commands exit 0 (the derived list is unchanged by this round; `--ran` reconciliation: 57 run, 0 NOT-MEASURED). Whole-PR diff: 6 files, 26 additions, 10 deletions. ### Seat append — Acceptance notes (added at the at-tier review's request, record `5885205176`) - **Noted, not filed:** the in-repo consumer `writeCommentMentions` (`plugin-audit` `audit-writers.ts`) also accepts array entries that are objects with an `id` key, a lenient-consumer tolerance that no producer in this repository writes. This PR deliberately does not advertise it: the new description names only the id-string array. No public door answers wrong today, so it is not a card. Dedupe words: `writeCommentMentions object entries` · `sys_comment mentions id objects tolerance` · `collab.mention parse leniency`. --- _Generated by [Claude Code](https://claude.ai/code/session_01XY5uCwTjZj7884yYtyur4H)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent c96beb2 commit ba4648d

6 files changed

Lines changed: 26 additions & 10 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@objectstack/plugin-audit': patch
3+
---
4+
5+
`sys_comment.reactions` and `sys_comment.mentions` now describe the shape they actually store (#20558)
6+
7+
The two field descriptions are served metadata (field help in the console, and what an AI client reads before it seeds a comment), and both named a shape no producer writes:
8+
9+
| Field | Description was | Description is now | Stored value |
10+
| --- | --- | --- | --- |
11+
| `reactions` | `JSON array of emoji reaction objects` | `JSON object mapping each emoji to the list of user ids who reacted` | `{"👍":["usr_1","usr_2"]}` |
12+
| `mentions` | `JSON array of @mention objects` | `JSON array of the user ids @mentioned in the comment` | `["usr_1","usr_2"]` |
13+
14+
The console's record discussion panel reads and writes `reactions` as that map, and writes `mentions` as that list of ids; the `collab.mention` notification hook reads the ids.
15+
16+
Description text only: no stored value, validation rule or hook changes, and nothing to migrate. The English translation bundle is regenerated from the source description, and the zh-CN, ja-JP and es-ES help texts for both fields are rewritten to match (values only, no key added or dropped).

‎packages/plugins/plugin-audit/src/objects/sys-comment.object.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,14 @@ export const SysComment = ObjectSchema.create({
118118
mentions: Field.textarea({
119119
label: 'Mentions',
120120
required: false,
121-
description: 'JSON array of @mention objects',
121+
description: 'JSON array of the user ids @mentioned in the comment',
122122
group: 'Body',
123123
}),
124124

125125
reactions: Field.textarea({
126126
label: 'Reactions',
127127
required: false,
128-
description: 'JSON array of emoji reaction objects',
128+
description: 'JSON object mapping each emoji to the list of user ids who reacted',
129129
group: 'Body',
130130
}),
131131

‎packages/plugins/plugin-audit/src/translations/en.objects.generated.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,11 @@ export const enObjects: NonNullable<TranslationData['objects']> = {
215215
},
216216
mentions: {
217217
label: "Mentions",
218-
help: "JSON array of @mention objects"
218+
help: "JSON array of the user ids @mentioned in the comment"
219219
},
220220
reactions: {
221221
label: "Reactions",
222-
help: "JSON array of emoji reaction objects"
222+
help: "JSON object mapping each emoji to the list of user ids who reacted"
223223
},
224224
is_edited: {
225225
label: "Edited"

‎packages/plugins/plugin-audit/src/translations/es-ES.objects.generated.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,11 @@ export const esESObjects: NonNullable<TranslationData['objects']> = {
215215
},
216216
mentions: {
217217
label: "Menciones",
218-
help: "Matriz JSON de objetos @mention."
218+
help: "Matriz JSON de los id de usuario mencionados con @ en el comentario."
219219
},
220220
reactions: {
221221
label: "Reacciones",
222-
help: "Matriz JSON de objetos de reacción emoji."
222+
help: "Objeto JSON que asigna cada emoji a la lista de id de usuario de quienes reaccionaron."
223223
},
224224
is_edited: {
225225
label: "Editado"

‎packages/plugins/plugin-audit/src/translations/ja-JP.objects.generated.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,11 @@ export const jaJPObjects: NonNullable<TranslationData['objects']> = {
215215
},
216216
mentions: {
217217
label: "メンション",
218-
help: "@メンションオブジェクトの JSON 配列"
218+
help: "コメント内で @メンションされたユーザー ID の JSON 配列"
219219
},
220220
reactions: {
221221
label: "リアクション",
222-
help: "絵文字リアクションオブジェクトの JSON 配列"
222+
help: "各絵文字を、リアクションしたユーザー ID のリストに対応付ける JSON オブジェクト"
223223
},
224224
is_edited: {
225225
label: "編集済み"

‎packages/plugins/plugin-audit/src/translations/zh-CN.objects.generated.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,11 @@ export const zhCNObjects: NonNullable<TranslationData['objects']> = {
215215
},
216216
mentions: {
217217
label: "提及",
218-
help: "@mention 对象的 JSON 数组"
218+
help: "评论中被 @ 提及的用户 ID 的 JSON 数组"
219219
},
220220
reactions: {
221221
label: "回应",
222-
help: "表情回应对象的 JSON 数组"
222+
help: "将每个表情映射到对其做出回应的用户 ID 列表的 JSON 对象"
223223
},
224224
is_edited: {
225225
label: "已编辑"

0 commit comments

Comments
 (0)