Repository navigation
Commit b98173c
feat(console): a comments column on the list page, with the threads of the records the view shows (#39157)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBTXKtrYYWM5CrtT3nwCLimA)_
Fixes #39085
Clause-②: yes (widening)
Metadata-protocol: none
## 维护者速读
- 用户看到什么:对象列表页(表格、看板)头部多了一个评论图标,点开后右侧出现 380px
评论栏,列表随之变窄;栏里是当前视图这些记录上的评论串,最新在前,可以就地展开回复、解决、表情、编辑、删除,开关状态浏览器会记住。
- 为什么:专题 #39077 的 U3,用 S3(#39084)的一次性读取口,范围是视图已保存的筛选加上读者未保存的筛选,搜索框不算。
-
出错会怎样:只按读者自己的权限读;筛选发不出去、没权限、读取失败、服务器不支持时,栏里分别说明,不会退回到列出全部记录的评论;关着的时候不发任何请求。
- 要你做什么:无。
## What changes
- **`@object-ui/types`** — optional
`DataSource.queryCommentThreads(request)`; its presence is the
capability. Re-exports `CommentThreadsQueryRequest` /
`CommentThreadsQueryResponse` from `@objectstack/spec/api` (not
`CommentThread`, which collides with the collaboration component's
name).
- **`@object-ui/data-objectstack`** —
`ObjectStackAdapter.queryCommentThreads` calls
`client.comments.queryThreads` (`POST /api/v1/comments/threads/query`);
a refusal passes through as the client threw it.
- **`@object-ui/plugin-list`** — `ListView` host prop
`onEffectiveFilterChange` (new sibling module `listEffectiveFilter.ts`;
`ListView.tsx` gets one call). It reports
`buildEffectiveFilter(authored, panel, filter bar, queue, drops)`, the
`$filter` the list's own read sends, on every layout (a board answers
`onFindParamsChange` with `null`, so that channel could not serve
kanban). The search term and a calendar window are not in it. A
`FilterOperatorError` reports `{ kind: 'unlowerable' }`, never "no
filter". Built only while a host listens and after the object definition
loads; reported only when the filter changes by content.
- **`@object-ui/plugin-detail`** — presentational `ViewCommentsPanel`
(cards, filter menu, load-more, the seven states, Esc/✕),
`splitCommentMentions` for the mention highlight.
- **`@object-ui/i18n`** — seven `detail.viewComments*` keys in all 11
locales (zh-Hant from the generator), mirrored in
`DETAIL_DEFAULT_TRANSLATIONS`.
- **`@object-ui/app-shell`** (private) — `objectViewComments.tsx` (the
icon and the offer: desktop, grid or kanban, `enable.feeds !== false`,
the door present), the lazily loaded `objectViewCommentsColumn.tsx` (the
column, and an expanded card as the record's live discussion through
`useRecordDiscussion` + `DiscussionContextProvider` + `CommentThread
mode="expand"`), and `useViewCommentThreads.ts` (one request per page,
keyed by content; a `sys_comment` write announced re-reads the loaded
pages in one request up to 50; stale answers dropped; refusals mapped to
states). `ObjectView.tsx`, `objectViewListRenderer.tsx`,
`objectViewPageHeader.tsx` and `PageHeader.tsx` get calls and
pass-throughs only: `PageHeader` takes `comments` into the shell group's
first slot (or after the page actions outside the shell).
`useCommentsPanelOpen` takes a key; `commentResolutionOf` /
`rowMentionsUser` are exported for the card mapping.
- Docs: `content/docs/frontend/plugins/plugin-detail.mdx` § The list
page's comments column; plugin-detail and plugin-list READMEs; changeset
(patch on the five published packages).
## Tests
-
`ui/packages/app-shell/src/views/ObjectView.commentsColumn-39085.test.tsx`
(8): through the real `ObjectView` and `ListView` — icon on a grid, none
read while closed; pressed, the column sits in the content row beside
the list (`w-[380px] shrink-0`, not `absolute`), reads ONE page with the
view's filter; the record name opens the record through the row-click
path; ✕ closes and is remembered, no read after; open state remembered
and a `sys_comment` write announced re-reads once; icon on a board; no
icon with feeds off or without the door.
- `ui/packages/app-shell/src/views/useViewCommentThreads-39085.test.tsx`
(24): first page once with scope + toggles; nothing before the list
reports and nothing for `unlowerable`; re-read on scope/toggle change,
none for an equal scope; load-more appends with dedupe; failed next
page; write announced re-reads the loaded pages in one request (`limit:
30`); a superseded answer is dropped; cards past the 50-thread re-read
ceiling kept with their cursor; a failed re-read keeps the cards and
releases a superseded load-more; retry; no door ⇒ `unavailable`;
error-to-state table; row mapping.
- `ui/packages/plugin-detail/src/comments/ViewCommentsPanel.test.tsx`
(14): cards, mention highlight, replies summary, no new-thread box;
open-record vs expand; expanded via host; ✕/Esc; load-more and its
retry; filtered-empty with show-all; empty; loading, failed + retry;
denied/unscoped/unavailable with no filter menu; `splitCommentMentions`.
- `ui/packages/plugin-list/src/__tests__/ListView.harness.test.tsx` new
block `ListView.onEffectiveFilterChange-39085` (4): grid reports exactly
the read's `$filter`, once; a board reports too; the search term is left
out; a malformed filter reports `unlowerable` and nothing else.
- `ui/packages/data-objectstack/src/queryCommentThreads-39085.test.ts`
(4): the filter is normalised as `find` normalises `$filter` (rule list
lowered, empty sent as no filter); a filter `find` refuses is refused
before any request; answer and refusal pass through.
- `ui/e2e/list-frame-geometry-35548.spec.ts`: its source-text pin on
`<ObjectViewPageHeader …/>` admits the new `comments={…}` prop (the pin
went red on 489710f).
## Acceptance notes
- **Filter scopes the threads; view switching changes the column.** The
list reports its effective filter (saved + unsaved panel/bar/queue
conditions, no search) and the column keys its read on it by content
(ObjectView test 2, hook test 3, harness block). A view switch remounts
the list, which reports its own filter.
- **Narrower access sees fewer threads.** Server side (#39135 runs the
filter as the caller); the client sends nothing that widens it, and an
unlowerable filter is never sent as "no filter" (harness test 4, hook
test 2).
- **Replying raises the count; resolving with 「显示已解决」 off removes the
thread and clears the row dot.** Writes in an expanded card go through
the record page's own unit (`useRecordDiscussion`), which announces
`sys_comment`; the column re-reads (ObjectView test 5, hook test 6) and
U1's dot re-reads on the same announcement (pinned in #39106).
- **「只看我参与的」 keeps a thread where I'm mentioned.** Sent as `onlyMine:
true`; the server's participants include mentions (#39081 / #39135).
- **No new top-level control.** The icon sits in the shell's button
group via `PageHeader`'s `comments`; `useShellPageActionsSlot` was
already shaped for it.
- **Grid narrows at 1440 px; kanban the same.** The column is a
`shrink-0` flex sibling in the content row for both layouts (ObjectView
tests 2 and 6). Not measured in a browser.
- **Feeds off ⇒ no icon. The drawer has no comments.** ObjectView test
7; the drawer is untouched.
- **One threads request per page; none while closed.** ObjectView tests
1, 2, 4, 5; hook tests 1, 4.
- Deviation: where the server lacks the threads read (the hosted
dispatcher, #39134), the adapter still has the method, so the icon shows
and the column says the server cannot list a view's comments (a
404/405/501 maps to `unavailable`), per the claim's premise.
- Files to read first:
`ui/packages/app-shell/src/views/useViewCommentThreads.ts` (request
keying, re-read and stale-drop),
`ui/packages/plugin-list/src/listEffectiveFilter.ts` (what is reported
and when), `ui/packages/app-shell/src/views/objectViewComments.tsx` (the
offer and the scope's lifetime).
- Two-minute check: open any feeds-on object list on a self-hosted
console, press the speech-bubble icon top right: a 380 px column opens
beside the grid listing the comment threads of the rows the view shows;
change the filter and the column re-reads.
## Verification
- Typecheck (`tsc --noEmit`): types, data-objectstack, plugin-list,
plugin-detail, i18n, app-shell — all clean.
- New tests: 54 passed across the five files above (the harness block
run with `-t`).
- Neighbouring suites: PageHeader ×4, ShellPageActions ×2,
ConsoleLayout.noTopBar, ObjectView.shellPageActions / headerFold /
rowCommentDot, objectViewPageHeader ×2, defaults-maps-mirror-en-pack,
RecordDetailView.harness and every `plugin-detail/src/comments` file —
22 files, 301 tests passed. `@object-ui/i18n` suite 110 files, 1874
passed.
- Eager closure budget after a console build: `i18n-locale-en` 70.2 KB
of 78.7 KB; every ceiling green.
- `node scripts/pm/dispatch-gates.mjs --commands`: 74 commands; 72 exit
0. Two NOT MEASURED locally, left to CI: `pnpm --dir ui exec vitest run
scripts/` was killed by the container's memory limit (re-run with
`--maxWorkers=2`: 172 files, 5159 tests passed), and
`check:skill-examples` refused its prerequisite (no `client-react`
build; exit 3, nothing measured).
- L2 (contract review) PASS on f51a85d with S1 and S2 should-fix; fixed
in 669406b (re-read keeps cards past 50, failed re-read keeps cards;
adapter filter normalised as `find`) and 0a8ba35 (nits N6, N7). Delta
record PASS on 0a8ba35: S1 and S2 closed. After the fixes: the three
touched test files 36 passed, `tsc` clean for types, data-objectstack,
app-shell.
- CI on 489710f: `Build & E2E UI` red on the source pin fixed in
f51a85d; `console-service-worker` was flaky there (passed on retry).
https://claude.ai/code/session_01WGufzgJzS4DfAbhGoRzv5o
---
_Generated by [Claude Code](https://claude.ai/code)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent a294369 commit b98173c
42 files changed
Lines changed: 2585 additions & 14 deletions
File tree
- .changeset
- content/docs/frontend/plugins
- ui
- e2e
- packages
- app-shell/src
- layout
- views
- data-objectstack/src
- i18n/src/locales
- plugin-detail
- src
- comments
- plugin-list
- src
- __tests__
- types/src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
354 | 390 | | |
355 | 391 | | |
356 | 392 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
313 | | - | |
| 313 | + | |
| 314 | + | |
314 | 315 | | |
315 | 316 | | |
316 | 317 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
185 | 191 | | |
186 | 192 | | |
187 | 193 | | |
| |||
233 | 239 | | |
234 | 240 | | |
235 | 241 | | |
| 242 | + | |
236 | 243 | | |
237 | 244 | | |
238 | 245 | | |
| |||
283 | 290 | | |
284 | 291 | | |
285 | 292 | | |
286 | | - | |
| 293 | + | |
| 294 | + | |
287 | 295 | | |
288 | 296 | | |
289 | 297 | | |
| |||
295 | 303 | | |
296 | 304 | | |
297 | 305 | | |
298 | | - | |
| 306 | + | |
| 307 | + | |
299 | 308 | | |
300 | 309 | | |
301 | 310 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
0 commit comments