Repository navigation
feat(plugin-audit): a comment thread can be marked resolved and reopened - #36104
Conversation
Claude-Session: https://claude.ai/code/session_01L6bhgUJ3ExTXMikbrPFNqD Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgUJ3ExTXMikbrPFNqD Co-authored-by: Claude <noreply@anthropic.com>
…6071) Claude-Session: https://claude.ai/code/session_01L6bhgUJ3ExTXMikbrPFNqD Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgUJ3ExTXMikbrPFNqD Co-authored-by: Claude <noreply@anthropic.com>
… regenerated (#36071) Claude-Session: https://claude.ai/code/session_01L6bhgUJ3ExTXMikbrPFNqD Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 75 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 15 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 12 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin d9e4b23660d7d0ed2386f50bb2dc9a2f2369c0bc && git checkout d9e4b23660d7d0ed2386f50bb2dc9a2f2369c0bc
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 3543b51d37b41086275dacf91e7a29cb8c67da8b 5733151ebc8d9b9f727455e903f13068ff2f447f && git checkout -B drift-repro 3543b51d37b41086275dacf91e7a29cb8c67da8b && git merge --no-ff 5733151ebc8d9b9f727455e903f13068ff2f447f
node scripts/docs-audit/affected-docs.mjs --json 3543b51d37b41086275dacf91e7a29cb8c67da8b
|
…r reads it alone (#36071) A local named code was read by check:error-status-conformance's name-based resolution as the code of other files' code variables, reporting 403 and 422 VALIDATION_ERROR producers that are not. Claude-Session: https://claude.ai/code/session_01L6bhgUJ3ExTXMikbrPFNqD Co-authored-by: Claude <noreply@anthropic.com>
…an erase them (#36071) The query-options erasure ratchet holds the test surface at 236; the new rig's seven `as any` casts on engine options raised it to 242. The bags type-check as declared, so the casts go. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgUJ3ExTXMikbrPFNqD
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob Posted 2026-11-21T14:49Z. The brief handed to the isolated declaration-face reviewer for PR #36104 (owed by the claim's Contract review brief — PR #36104 @
|
|
repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U 席位核对 — REWORK (L1-a)维护者速读「已解决」的后端基本做对了。我对照了你 13:25 的裁定:能看到这条记录的人可以标记和取消已解决。代码给的权限没有比裁定更宽,在两处还更窄:
要改的是一处顺序问题,改动很小:拒绝「对回复标记已解决」的那一步,现在排在权限检查前面。应该挪到权限检查之后,这样看不到这条记录的人,得到的回答和平台其他地方一样。改完我再看一次,不涉及你的决定。 不属于受管面。声明了对外新增(三个新字段),座位还要在同一版本上跑一次 L2。 Head reviewed: S1 (small; ordering): the reply refusal runs ahead of the access gateIn
What holds: the gate against ruling 7063285032
To clear
|
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob Contract reviewServed-tier: Inputs read: card #36071 (body and all five comments: triage, claim, maintainer ruling 7063285032, os-dev-report 7063766421, its amendment 7064070077); epic #36062 and sibling #36075 (bodies, for context); the PR #36104 body, its file list (20 files) and the net diff against ① Derived judgmentsAccept-set and public-surface changes the diff implies:
Every card acceptance line has a pinned test: top-level resolve stamps; reply refused; non-reader refused; client-filled resolver ignored; reply reopens; both filters, including the mentioned-only case; count 3/1 gives 2; PR body lists the fields and queries. Nit, no effect on the verdict: the changeset's "Who may" bullet says "anyone who may comment on the record (who can read it)". It does not carry the create-without-edit permission-set caveat the PR body states. That bullet ships as the CHANGELOG line, so the caveat could be added there. It is not required. ② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
… gate (#36071) The rows are read in system context, so the 400 ahead of the gate told a caller who cannot see the record that the reply exists. The gate now answers first: a non-reader meets the not-visible refusal, and a reader, the reply's author or a record editor still gets the 400. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgUJ3ExTXMikbrPFNqD
…6071) Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgUJ3ExTXMikbrPFNqD
|
repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U 席位核对 — delta ACCEPT (L1-a)维护者速读上一轮要改的顺序问题已经改好:对回复标记已解决的拒绝,现在排在权限检查之后。看不到这条记录的人,得到的是和平台其他地方一样的「不可见」回答。新加了一条测试钉住这一点。changeset 补了一句,说明只有「新建评论」权限的人不能标记已解决。可以通过。 不属于受管面。座位的声明面 L2 增量和 CI 都绿了之后,按普通队列落地,合并后卡 #36071 关闭。 Head reviewed: S1: cleared (
|
|
repo:objectstack#1 · os-sales · session_01L6bhgUJ3ExTXMikbrPFNqD Test Core (6/10) on 0af5783 · 2026-11-21T15:48Z · judged a slow runner, one re-run Job 136884001753 (run 44916602322) failed with 9 × "Test timed out in 5000ms". The shard ran 14:59–15:41Z, while the other nine shards on the same head finished in 9–22 minutes.
Re-running the failed jobs of run 44916602322 once ( |
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob Seat note at 2026-11-21T16:00Z: the jobs this record lists as in progress have now finished on Contract reviewServed-tier: This is a delta review on top of the PASS record for head cf75b3f. Inputs: the net diff ① Derived judgments
② Semver levelNo declaration changes:
③ Boundary flagsCheck-runs on
Code verdict: PASS on the delta. The gate verdict is still owed by the in-progress jobs above. Merge should wait until Build Core, Test Core, the Type Check jobs, Lint and Check Changeset are green on this sha. Other flags:
Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob Regen-provenance: declaration-face record 7065315562 (delta PASS) ·
|
|
repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U 席位核对 — delta ACCEPT (L1-a, main merge)维护者速读这次只是把主干合进来,没有改这个 PR 自己的内容。主干带进来的「回复通知」(#36098)也改了同一个插件,但改的是不同位置,两边没有冲突。上一轮的通过结论照旧有效。CI 绿了、座位的 L2 跟上之后,按普通队列落地。 Head reviewed:
|
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob Seat landing · 2026-11-21T16:34Z · #36071, backend for resolving comment threads (epic #36062 phase 1). What changes:
Reviews:
Gates on this head:
The seat readies this PR and arms auto-merge in the same step. The PR carries |
…reads and counts the unresolved ones; ✓ and Edit on others' comments appear only where the server admits them (objectstack-ai#36075) (objectstack-ai#36178) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuKfHUa83V2ZjrX6UrED642U)_ repo:objectstack#1 · os-sales · session_01L6bhgT8AtWDue4oTFNAE6H Fixes objectstack-ai#36075 Clause-②: yes (widening): `@object-ui/react`'s `DiscussionContextValue` adds three optional members, `onResolveComment(itemId, resolved)`, `moderatesComments` and `updatesOthersComments`. `@object-ui/types`' `FeedItem` adds five optional members: `resolved`, `resolvedById`, `resolvedByName`, `resolvedAt`, `mentionsViewer`. `@object-ui/plugin-detail` adds exports `useRecordVerdict` (three-state; a definite allow is `allowed` with `record.visible`; `useRecordEditable` reads as before except that `allowed: false` beside a visible record now reads not editable), `threadResolvable`, `threadResolved`, `threadInvolvesViewer`, `filterCommentThreads`, `unresolvedThreadCount`, `DEFAULT_COMMENT_THREAD_FILTER` and the type `CommentThreadFilter`; `RecordCommentsData` adds `resolvable`, `onResolveComment`, `moderates` and `updatesOthers`, and its `count` is now the unresolved threads; `CommentItemActions` adds `onResolve` and `resolved`; `CommentHoverActionsProps` adds `resolved`; `RecordCommentThreadProps['comments']` may carry `onResolveComment`, `moderates` and `updatesOthers`. `@object-ui/i18n` adds ten `detail.*` keys to every pack. Nothing existing is removed or re-typed. Metadata-protocol: none ## 维护者速读 - 评论栏里,每串评论的第一条在鼠标移上去时多了一个对勾。点一下这一串就标成「已解决」,从列表里消失,头部评论图标上的数字减一。再点一次可以恢复成未解决。 - 谁能点对勾:自己发起的串,谁都能点。别人发起的串,只在服务器会接受时才显示对勾。现在只有管理员能点别人发起的串。原因是平台有一条底线规则:普通成员只能改自己创建的行,评论也算,而且这条规则在评论自己的规则之前执行。实测在开发环境里,普通成员标别人的串返回 403,标自己的返回 200。你 13:25Z 的裁定 A(能看记录的人都能标)要等后端单独一个 PR 才能真正生效,这个 PR 不改服务端。 - 评论栏右上角多了一个筛选按钮,里面两个勾选:「显示已解决」打开后,已解决的串也显示出来,上面一行灰字「已由 某某 解决」,再点它的对勾就恢复。「只看我参与的」只留我发起的、我回复过的、提到我的串。筛选不记在浏览器里。全部都已解决时,评论栏说「没有未解决的评论」,并给一个「显示全部评论」的按钮。 - 往已解决的串里再回复,这一串自动变回未解决。图标上的数字现在是未解决的串数。 - 「更多」里的编辑和删除: - 自己的评论照旧(普通成员默认只有编辑:平台默认不给成员删评论的权限,这是另一张决定卡)。 - 别人的评论:删除给能编辑这条记录、并且有评论删除权限的人。编辑还要服务器同意改别人写的行,现在也只有管理员。 - 判断都问服务器,只有明确说「可以」才显示,没回来或出错就不显示。所以普通成员不会看到点了会被拒的按钮。 - 服务端权限一行没改。老部署(评论表里没有「已解决」这一列)不显示对勾和筛选,数字数全部串,和以前一样。手写的记录页和手机端不变。 ## What changes **Resolved threads** (`@object-ui/plugin-detail` `src/comments/`, the backend is objectstack-ai#36071 / objectstack-ai#36104) - `commentThreads.ts`: `threadResolvable` (a real top-level comment, and the host set `resolved`: a reply whose parent is gone cannot be resolved, the server refuses it), `threadResolved`, `threadInvolvesViewer` (the viewer started the thread, replied in it, or is mentioned in it: objectstack-ai#36071's `threadsInvolvingUser` rule, read off the host's viewer-relative marks), `filterCommentThreads` with `DEFAULT_COMMENT_THREAD_FILTER` (`showResolved: false`, `onlyMine: false`), `unresolvedThreadCount`. - `useRecordComments`: `count` is the unresolved threads; `resolvable` says some thread here can be resolved; hands `onResolveComment` and `moderates` on from the context. - `CommentThread`: ✓ on the thread's first comment only (`onResolve`, reading 「恢复」 and pressed when resolved), on a thread the viewer started, and on anyone's only with `updatesOthers` (see the row floor below). A resolved thread carries `data-comment-thread-resolved` and a 「已由 X 解决」 line (`data-comment-resolved-mark`) above its first comment, the comment muted while collapsed. The resolver's name is the host's (`resolvedByName`), else the entry in a mention list the composer already loaded (never read for this), else plain 「已解决」. A refused resolve is swallowed here (the host has said so). - `CommentsPanel`: the filter menu (`ListFilter`, left of ✕) with two checkbox items, offered only while `resolvable`; held in state while the panel is open, never stored. With every thread filtered out it says 「没有未解决的评论」 (or 「没有你参与的评论」) and offers 「显示全部评论」. - `CommentHoverActions`: `resolved` turns the ✓ into the reopen control (`aria-pressed`). Its test hook changes value with it: `data-comment-action="resolve"` on an open thread, `"reopen"` on a resolved one. The panel's other new hooks are `data-comments-filter`, `data-comments-filter-option="show-resolved" | "only-mine"`, `data-comments-empty="filtered"` and `data-comment-thread-resolved`; they are test hooks and carry no contract. **Edit and Delete on other people's comments** (card item 6) - The comment hook (`plugin-audit` `comment-access-hooks.ts`, "Parent EDIT") lets a comment's author, or a caller whose by-id update of the parent record the explain engine admits, edit or delete a comment. The page asks the same question: `useRecordVerdict(object, id, 'update')`, a three-state reading of the verdict `useRecordEditable` fails open on (same cache, same in-flight sharing, same staling; `useRecordEditable` is now `useRecordVerdict(...) ?? true`). A definite allow is `allowed === true` together with `record.visible === true`, as the server admits a by-id write (L2 S3); an answer with `allowed: false` beside a visible record (an on-behalf-of session whose delegator is gone) now reads not editable for `useRecordEditable` too, which is the server's answer. `moderatesComments` is `true` only on a definite allow, and is asked once the panel is open, so a record whose object sets `userActions.edit: false` still sends no explain on open (objectstack-ai#13045). The page's own edit gates (approval lock, `userActions.edit`, predicates) are not the server's comment rule and do not join. - `CommentThread` offers Delete on a comment that is the viewer's own or, with `moderates`, anyone's; Edit on the viewer's own or, with `moderates` AND `updatesOthers`, anyone's; still only where the host hands `onEditComment` / `onDeleteComment` (the `sys_comment` grants). **The row floor (measured; the interim this PR ships)** - The platform's wildcard floor `owner_only_writes` (`default-permission-sets.ts`, `update`, `positions: ['org_member']`, `created_by == current_user.id`) runs before the comment hook. `sys_comment` widens it for `delete` only (`sys_comment_moderation`); `update` is left under the floor on purpose. So the hook's resolve rule (objectstack-ai#36104, ruling 7063285032) and its parent-editor rule are never reached for a rank-and-file member on someone else's row. - Readings on the CRM example with the security service on (one org, two `org_member` members; scripts and JSON in the evidence folder `floor/`): - a member who reads the record PATCHes `{ is_resolved: true }` on the admin's thread: **403** `PERMISSION_DENIED`; on another member's thread: **403**; on their own: **200**; - a member who may edit the record PATCHes `{ body }` on another member's comment: **403**; - explain `sys_comment` `update` by id answers `record.visible: false` for a member on another person's comment, `true` on their own and for the admin. - The interim: `RecordDetailView` asks ONE explain, `update` of the first top-level comment the viewer did not write (`updatesOthersComments`), when the reader first reaches into the open panel (pointer or focus), so opening the record and opening the panel still read nothing more (objectstack-ai#28470). The floor answers the same for every such row. ✓ and Edit on others' rows need its definite allow; pending, a refusal, an error, no explain service and a stale answer offer them on the viewer's own rows alone. Delete keeps its own gates (`feedCommentDelete` and `moderatesComments`), which the floor's delete widening already matches. - Not here: making ruling 7063285032 true for members is a server change (a resolve-only path past the floor), a separate backend PR after Sales answers the decision on editing others' comments. Delete was verified with a principal holding the `sys_comment` delete bit (the admin); `member_default` grants members none, so a member's More holds Edit only (a second decision card). **The record page** (`@object-ui/app-shell` `RecordDetailView`) - The comment read already returns every column (no select, on both the record-page payload and the fallback `find`), so the rows' `is_resolved`, `resolved_by`, `resolved_at` map onto the feed item (`commentResolutionOf`), only where the row carries `is_resolved`. The resolver is named from the viewer or an author of the same discussion; any other resolver is named by ONE `sys_user` read of exactly those ids (`$filter: { id: { $in } }`, `$select: ['id', 'name']`), sent after the discussion is drawn and never twice for an id (L2 S2: the record-page payload has no expand for it, and the 50-user mention roster missed resolvers past it). A refused read leaves 「已解决」. `mentionsViewer` comes from the row's stored `mentions` (`rowMentionsUser`: a JSON id list, ids or `{ id }` objects). - `handleResolveComment`: `dataSource.update('sys_comment', id, { is_resolved })` and nothing else (the one update ruling 7063285032 admits for any reader), offered under the `sys_comment` update grant; the row changes from the stored record the server answers with, a refusal toasts `detail.commentResolveFailed` and changes nothing. - A reply into a resolved thread shows its first comment reopened (`threadRootIdOf`), as the platform stores it; a new comment is unresolved where the deployment stores resolution. - The icon's count is `unresolvedThreadCount` over the rows the page already holds from its one open request (objectstack-ai#28470), not objectstack-ai#36104's `COUNT` read: that would be a second request for an answer already on the page. **Strings**: `detail.reopenThread`, `threadResolved`, `threadResolvedBy`, `filterComments`, `showResolvedComments`, `commentsInvolvingMe`, `noUnresolvedComments`, `noCommentsInvolvingMe`, `showAllComments`, `commentResolveFailed` in all eleven packs (zh-Hant regenerated) and the provider-less defaults. **Docs**: the plugin-detail README and `content/docs/frontend/plugins/plugin-detail.mdx` describe resolved threads, the filter, the count, and Edit / Delete for record editors. ## Why Card objectstack-ai#36075 items 3, 6, 7 and 8, owed by this second PR after objectstack-ai#36114 (the panel, `Part of objectstack-ai#36075`) and objectstack-ai#36104 (the resolved backend, objectstack-ai#36071) merged: resolve and reopen a thread, the 「显示已解决」 / 「只看我参与的」 filter, the icon counting unresolved threads, and Edit / Delete 「只对自己的评论,或有权限的人」. ## Side effects reviewers should know - No server change and no permission change. Resolving rides the backend objectstack-ai#36104 shipped, and moderating uses the server's existing parent-editor rule, each offered only where the server's row floor admits it today (above). - A deployment without the explain service shows ✓ and Edit on the viewer's own rows only, administrators included. - The moderation verdict fails CLOSED where `useRecordEditable` fails open: a deployment whose explain engine does not answer (501, network) shows Edit / Delete on the viewer's own comments only, though its degraded server mode might admit more. A permitted moderator there loses an affordance, never sees a refused one. - The old `RecordActivityTimeline` (hand-written pages, the phone) is unchanged: own Edit / Delete only, no resolve. - Overlap: `overlap-check.mjs` against main and 5 open PRs that share a file: clean, except objectstack-ai#36136, which already conflicts with main on `RecordDetailView.tsx`'s `@object-ui/plugin-detail` import line; this PR adds its two names on a separate import so it adds nothing to that conflict. - Not in this PR: 「复制链接」 in the More menu (in the mock, not in the card's items), and reactor names on hover. ## Verification **New tests (all pass)** - `plugin-detail/src/comments/CommentsPanel.resolved-36075.test.tsx` (16): resolved threads hidden by default; ✓ on a top-level comment only; 「显示已解决」 with 「Resolved by Ada」 and the reopen control; 「只看我参与的」 keeps started / replied / mentioned; without `updatesOthersComments`, ✓ only on the viewer's own threads; the resolver named from a mention list already loaded, never read for it; all resolved → the note and 「Show all comments」; no ✓ and no filter where rows carry no `resolved`; no ✓ without the write; a moderator's Edit / Delete on another's comment; a moderator whose update of others' rows is refused gets Delete, not Edit; `updatesOthersComments` alone is not moderating; the CONTROL without moderation; none without the host's writes; the count is unresolved threads, and every thread with no resolution stored. - `plugin-detail/src/useRecordVerdict-36075.test.tsx` (6): true / false; `allowed: false` beside a visible record reads false, a visible record with no `allowed` reads `undefined`; `undefined`, never true, while pending, on non-OK, offline, and no record verdict; nothing asked when disabled; CONTROL `useRecordEditable` still fails open; one shared question. - `app-shell/src/views/RecordDetailView.commentsResolved-36075.test.tsx` (15), the real `RecordDetailView`: the icon counts 1 of 2 threads and the resolved one appears under 「显示已解决」 named; a resolver the page cannot name read by id, once, and named; no user read when every resolver is named; ✓ writes exactly `{ is_resolved: true }` on the top-level row, the thread leaves, the count goes; a refused ✓ toasts and changes nothing; reopen writes `{ is_resolved: false }` and the count returns; a reply into a resolved thread reopens it; another member's comment offers Edit / Delete on an explain allow, not on a refusal, not on an answer with no record verdict; ✓ on another member's thread beside a moderation refusal (N3); the row floor: ONE `sys_comment` explain, only once the reader reaches into the open panel; refused → no ✓ and no Edit on others' rows, Delete still, own rows unchanged; admitted → ✓ and Edit; no answer → own threads alone. - Reverse checks: with the moderation gate made fail-open (`!== false`), 「not offered on a guess」 fails; with the row-floor gate made fail-open, 「not on a guess: no answer offers ✓ on the viewer's own threads alone」 fails; with the old `record.visible`-only reading, the `allowed: false` case fails. - `RecordDetailView.recordOpenOneRequest-28470` pins that opening the panel reads nothing more; the probe waits for the reader to reach into the panel for that reason. **Local runs** (at `c268e113`, base main `6aacad95`): every `app-shell/src/views/RecordDetailView.*`, `recordDrawer*`, `recordCommentsPanel*` file and the whole `plugin-detail/src` (504 files, 4,517 tests): all pass but one at the first reading, `hiddenAffordanceVerdicts-13045` (the moderation verdict was asked on open where `userActions.edit: false` asks none); fixed by asking it once the panel opens, then that file and the comment files re-run green (7 files, 65 tests). `type-check` (src and tests) clean for types, react, plugin-detail and app-shell; ESLint on every changed file: 0 errors; `check:i18n-keys`, `check:i18n-drift`, `check:i18n-stale-fill`, `check:new-line-citations` pass; `check:i18n` / `check:i18n-coverage` answer exit 3 locally (they need a full `pnpm build`), CI reads them. **Local runs at the new head**: `plugin-detail/src` and every `app-shell/src/views/RecordDetailView.*`, `recordDrawer*`, `recordCommentsPanel*` file: 504 files, 4,509 passed; the one failure (`recordOpenOneRequest-28470`, the probe on panel open) is fixed by asking on engagement, and those files plus `plugin-detail/src/comments` re-ran green (104 files, 837 tests). `type-check` clean for react, plugin-detail and app-shell; ESLint 0 errors on the changed files. **Browser evidence** (seat-side folder `/mnt/project-files/build-seat1/36075/pr2/`): - the first set (`README.md`, light and dark: the panel, the filter, the count, 「已由 林晓 解决」, admin's Edit / Delete on a member's comment); - `floor/`: the row-floor readings above; - `interim/` (`README.md`, light and dark), on the CRM example with the security service on: - a reading member on another member's thread: Reply and emoji only; on their own: ✓, and More → 编辑; - a record-editing member on another member's thread: Reply and emoji only; - the admin: ✓, and More → 编辑 / 删除; - E1: a member resolves their own thread, count 2 → 1, after reload 1, 「已由 林晓 解决」, reopen → 2; - S2: 「已由 Dev Admin 解决」 from one `sys_user?filter=["id","in",[…]]&select=id,name&top=1` read. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes. - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: n/a. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English (the 维护者速读 block is the maintainer's summary, in the maintainer's language). - [x] The *Before Submitting* list in CONTRIBUTING.md is done. Branch name is the harness-assigned `claude/project-thread-5vdwwn`. --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgT8AtWDue4oTFNAE6H)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgT8AtWDue4oTFNAE6H <!-- signed: repo:objectstack#1 · os-sales · session_01L6bhgT8AtWDue4oTFNAE6H --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…s their own comments, through two server doors (objectstack-ai#36186, objectstack-ai#36191) (objectstack-ai#36200) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuQDMVvYbduXkDz6CEaA8Q1G)_ repo:objectstack#1 · os-sales · session_01L6bhgUH1jEKbDzYRc4nghq Fixes objectstack-ai#36186 Fixes objectstack-ai#36191 Clause-②: yes (widening) — `@objectstack/plugin-audit`'s `AuditPlugin` mounts two new HTTP routes, `PUT /api/v1/comments/:id/resolution` and `DELETE /api/v1/comments/:id`, and the resolution stamp reads a system write's `provenance.attributedUserId`. `@objectstack/core`'s `OwnRowDeleteDoor` adds the optional `refuseRemoval(row, engine, context)` (step 7, after the owner check). `@object-ui/react`'s `DiscussionContextValue` adds the optional `ownCommentDeletesOnly`; `@object-ui/plugin-detail`'s `RecordCommentsData` adds the optional `ownDeletesOnly`, which `RecordCommentThreadProps['comments']` may carry; `@object-ui/core`'s affordance-to-grant map adds the row `feedCommentDeleteOwn`. Nothing existing is removed or re-typed. Metadata-protocol: none ## 维护者速读 - 普通成员现在能给**任何**自己看得到、也能在上面发评论的评论串点对勾(标成已解决),也能恢复。以前只能点自己发起的串,别人发起的只有管理员能点。点了以后「已由 某某 解决」写的是点的人。这就是你 13:25Z 的裁定 A(能看记录就能解决,门槛和发评论一样)真正生效。 - 普通成员现在能**删自己的评论**。以前成员的「更多」里只有编辑。删别人的评论还是不行,能编辑记录也不行;管理员照旧。 - **自己的评论下面已经有回复(不管是谁回的,自己回的也算),就不能删**(可以改文字)。原因:平台删一条顶层评论时会把下面的回复各自变成独立的串,等于改动了别人的评论,这不符合你 21:59Z 的裁定(别人的评论删不了)。座位核过,认为这是裁定本身的结论,不再单独问你。管理员有删除权限,删法和以前一样。 - 评论的文字照旧只有作者能改。平台的底线规则、删除权限一行没动:两个新的服务端入口各只做一件事(一个只改「已解决」,一个只删自己的那一行)。走原来的数据接口,成员改别人评论、改别人的「已解决」、删任何评论,仍然是 403。 - 只能看评论、不能发评论的人(比如只给了只读权限的外部成员),**点不了对勾**,控制台也不显示对勾。审核指出裁定 A 里同时写了「能看记录的人」和「和发评论同一道门槛」,座位定了按后者,较窄。普通成员都能发评论,所以对他们没有区别;能发评论的外部成员照样能点。 - 已知限制:删评论时「下面有没有回复」的检查和真正删除是两步。如果恰好在这一瞬间有人发了回复,这条回复会变成独立的串,和今天管理员用数据接口删评论时一样。平台的数据引擎没有「条件删除」可以把两步并成一步,套一层事务在默认隔离级别下也挡不住别的请求插进来的回复,所以先写明,不在这次改。 ## What changes **The resolution door** (`plugin-audit` `comment-routes.ts`, objectstack-ai#36186) - `PUT /api/v1/comments/:id/resolution`, body exactly `{ "resolved": boolean }`. Order: caller (the own-row doors' one composition, `ownRowDeleteCallerResolver`), anonymous `401`, held sign-in `403`, any query parameter or other body `400 VALIDATION_ERROR`, the comment read AS THE CALLER (object grant + organization wall + the comment read gate; unreadable and unknown both `404 RECORD_NOT_FOUND`), the posting gate (the security service's `canWriteObject('sys_comment', 'insert', caller)`: a caller who reads comments but may not post one is `403 PERMISSION_DENIED`, a check that throws refuses, and a deployment with no security service has no posting gate either; ruling 7063285032 names "the same gate as posting a comment", contract review F1), a reply `400` (`refuseResolutionOnReply`, the data door's sentence), then a system write of `{ is_resolved }` alone by id, `attributedUserId` = caller, the caller's organization kept. Answers `200 { id, is_resolved, resolved_by, resolved_at }` read back as stored. - `stampCommentResolution` (`comment-resolution.ts`): on a system write the resolver is `provenance.attributedUserId` (the audit writer's own read of the attribution), so `resolved_by` names the door's caller. A non-system write still stamps its session user; a system write with no attribution still stamps `null`. - Untouched: `owner_only_writes`, `sys_comment_moderation`, `member_default`, the data door's resolve limb (objectstack-ai#36104). No `sys_comment` update twin: a row policy cannot scope a column, so one would also admit a member's edit of a colleague's words, which ruling 7069889899 keeps author-only. **The own-comment delete door** (same file, objectstack-ai#36191) - `DELETE /api/v1/comments/:id` on `@objectstack/core`'s shared own-row delete door; owner column `author_id`. Another member's comment `403 PERMISSION_DENIED`, even for a record editor (the moderator's delete stays the data door's, behind the delete grant). - Step 7, new in the kit: `OwnRowDeleteDoor.refuseRemoval`, asked after the owner check. The comment door's refuses a comment with any reply under it (a system read of `parent_id = id`), `409 DELETE_RESTRICTED`: `parent_id` is a lookup that clears on delete, so the removal would turn each reply into a thread of its own, a rewrite of other members' rows. The other three doors on the kit declare none and are unchanged. Known limit (contract review F2): the reply check and the removal are two engine calls and the data engine offers no conditional delete to join them (wrapping both in a transaction would not close it either: at the stores' default isolation another request's reply insert still lands between the probe and the delete), so a reply posted within that one request is promoted to a thread of its own, the same result as an administrator's data-door delete today; stated in the module doc. - Both doors mount beside the unreact door (`mountCommentDoors`, renamed from `mountUnreactDoor`); one `warn` names all three routes when no HTTP server is registered. Ledger rows in `comment-route-ledger.ts` (`gap`: the console is the consumer, the SDK has no method), with their conformance test; `scripts/check-route-envelope.mjs` declares the module. **Console** (`RecordDetailView`, `plugin-detail`, `react`, `core`) - ✓ calls the resolution door and is offered on every thread, the viewer's and anyone else's, under the `sys_comment` create grant (the door's posting gate), wherever the rows store resolution; it no longer depends on `updatesOthersComments`. The explain probe of a foreign `sys_comment` update stays, and gates Edit on someone else's comment alone. - Delete: with the `sys_comment` delete grant, the data door as before (others' comments included where the viewer moderates). Without it, the new affordance row `feedCommentDeleteOwn` (`grant: 'create'`, as `feedReactionRemove`) hands Delete over, it calls the own-comment door, and the host sets `ownCommentDeletesOnly`: `CommentThread` and the legacy `CommentBody` then offer Delete on the viewer's own comments with no reply and on nobody else's, whatever `moderatesComments` says. So the panel offers exactly what the doors admit. - `handleResolveComment`'s jsdoc says what the write is now (L2 S-D1 on objectstack-ai#36178). `affordanceGrantMap-12082`: `handleResolveComment` is no longer a data-source write site (its row is gone); `feedCommentDeleteOwn` is in the grant table. **Prose**: `plugin-detail.mdx` (Delete wording; ✓ on every thread; the own-comment door). The two unreleased notes of objectstack-ai#36104 (`36071-comment-threads-resolved.md`) and objectstack-ai#36178 (`36075-comments-resolved.md`) stay as written; the new changeset `36186-36191-comment-doors.md` ends with one sentence for each, naming the line it replaces. ## Why Ruling 7063285032 (any reader may resolve) never reached a rank-and-file member: the row floor runs before the comment hook (L1-c HOLD 7068026256, readings in objectstack-ai#36178). Ruling 7069889899 kept comment text author-only, which rules out loosening the floor for `update`, and added the own-comment delete (`member_default` may carry no delete bit, ADR-0090 D5). Shape agreed in the premise read and the seat's claims 7069978538 / 7069989751. ## Verification - `plugin-security` `comment-doors.integration.test.ts` (16 cases, real kernel + `SecurityPlugin` with the shipped sets + `AuditPlugin` + the real caller resolution, SQLite, two plain `org_member` principals, an `org_admin` and two `org_external` principals with explicit grants): member resolves and reopens a colleague's thread (200, `resolved_by` = member, cleared on reopen); data door unchanged (member's `body`, `is_resolved`, `{ is_resolved, body }` on a colleague's comment all 403); reply 400; unreadable = unknown 404; anonymous 401, query and every malformed body 400; own delete 200; colleague's 403 and stays; own comment with a reply 409, root and reply unchanged; own reply 200; own comment on an unreadable record 404; an external who reads the thread but may not post is 403 on resolve and still reads the comment, an external who may post resolves (200); member's data-door delete of their own still 403; admin resolves through the data door (floor does not bind) and the comment rule still decides edits. - `plugin-audit`: `comment-routes.test.ts` (mount, pre-engine answers, the write's exact shape and context; +4 for the posting gate: refused 403 with no write, a throwing check refuses, an unreadable comment still 404 before the gate, a poster resolves), `comment-resolution.test.ts` (+2: attribution stamps a system write; never outranks a session user), `comment-route-ledger.conformance.test.ts`; unreact ledger unchanged. `core`: `own-row-delete-routes.test.ts` (+3: step 7 refuses before any removal, runs only after the owner check, resolving admits). - UI: `RecordDetailView.commentsResolved-36075` also pins no ✓ for a viewer without the `sys_comment` create grant. `CommentsPanel.resolved-36075` (✓ on others' threads without the floor verdict; own-door Delete matrix), `RecordDetailView.commentsResolved-36075` (✓ → door URL and body, no data-source update; refused ✓; member without delete grant deletes through the door, none on others', none on own-with-reply; refused door delete), `RecordDetailView.feedCommentEditDelete-12268` (the no-delete-grant pin now asserts the door, plus own-with-reply). Local: app-shell comment/feed/discussion/reaction/explain RecordDetailView files + all of `plugin-detail` + `react` context: 437 files, 4067 passed. - Typecheck: `plugin-audit`, `core`, `plugin-security` clean. `check-route-envelope`, `check-single-authz-resolver` green. `check-governed-merges --test` on the file list: not governed. - Rig readings, CRM dev server (`objectstack dev --fresh`). Before: the objectstack-ai#36178 hold readings at `a2dc85896` (reader and a record editor, both plain org members). After: this branch at `dd9f5571`; a fresh rig is `invite_only` now, so the admin creates both members through `POST /api/v1/auth/admin/create-user`, the reader with `viewer_readonly` and the record editor with `crm_sales_user`. | Reading | Before | After | |---|---|---| | Member resolves the admin's thread | data API `403 PERMISSION_DENIED` | door `200`, `resolved_by` = the member | | Member resolves a colleague's thread / reopens it | data API `403` | door `200` / `200`, `resolved_by` and `resolved_at` cleared | | Member resolves a reply | n/a | door `400 VALIDATION_ERROR` | | Member's data-API `is_resolved` on the admin's thread | `403` | `403` (unchanged) | | Record editor edits a member's comment (data API) | `403` | `403` (unchanged) | | Member edits the admin's comment | `403` | `403` (unchanged) | | Member deletes own comment, data API | `403` | `403` (unchanged) | | Member deletes own comment, door | n/a | `200 { deleted: true }` | | Member deletes a colleague's comment, door | n/a | `403 PERMISSION_DENIED` | | Member deletes own comment with a reply, door | n/a | `409 DELETE_RESTRICTED`, root and reply kept | | Colleague deletes that reply, door; member then deletes the root | n/a | `200`, then `200` | | Admin edits / resolves / deletes a member's comment (data API) | `200` | `200` / `200` / `200` (unchanged) | Rows left on the record afterwards: the admin's thread (resolved by the member), the record editor's thread (reopened); nothing else. Script and report: `build-seat1/36186-36191/rig/doors.cjs`, `doors-report.json` in the project files. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (No `packages/spec` change.) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes. (eslint on the touched files: 0 errors.) - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. (Two folded cards, one `Fixes` line each.) - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (Not touched.) - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. (The 维护者速读 section is the maintainer's Chinese summary, as on this seat's other PRs.) - [x] The *Before Submitting* list in CONTRIBUTING.md is done. ## Follow-ups - None filed. A "comment deleted" placeholder that would let an author remove a comment that has replies is a product question of its own (needs a stored marker), not in scope. Contract review F3 (the console asks the create grant for own-comment Delete while the door asks none) is left as is, consistent with `feedReactionRemove`. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgUH1jEKbDzYRc4nghq <!-- signed: repo:objectstack#1 · os-sales · session_01L6bhgUH1jEKbDzYRc4nghq --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Sales · project thread
Fixes #36071
repo:objectstack#1 · os-sales · session_01L6bhgUJ3ExTXMikbrPFNqD
Clause-②: yes (widening)
Metadata-protocol: none
Flow: dev-thread rule (maintainer 2026-11-20 09:22:50Z 「所有 p1 都按照新规则执行」): the card thread builds itself; L1 and the isolated L2 run in parallel at hand-back.
维护者速读
What changes
sys_commentgains the resolution of a thread. A thread is one top-level comment (noparent_id) together with its replies; its state lives on the top-level row.is_resolvedfalseresolved_bysys_user,readonlyis_resolvedturnstrue, cleared when it turnsfalseresolved_atreadonlyPATCHthe top-level comment through the data API with{ "is_resolved": true }orfalse. Resolving an already-resolved thread changes nothing (the first resolver stays).is_resolved(beside the row id and the platform stampsupdated_at,updated_by,resolved_by,resolved_at) is authorized by the rule that admits a new comment — the caller can read the record the thread is on — instead of the author-or-record-editor rule. This is the one, deliberate widening. Any other field beside it still needs the comment's author or an editor of the record. A caller who cannot read the record gets the platform's not-visible refusal (PERMISSION_DENIED/ 403); a thread naming no record is resolvable by its author only.is_resolvedon a reply is refused,VALIDATION_ERROR/ 400 (fieldis_resolved), its author and a record editor included. The refusal runs after the access gate, so a caller who cannot read the record meets the not-visible refusal (PERMISSION_DENIED/ 403) instead, and the 400 never confirms that a reply exists. A reply's own fields stay editable as before.is_resolved: falseand clearsresolved_by/resolved_atover a client's values.afterInsert), when its thread's top-level comment is resolved, the platform updates it back tois_resolved: false(system write; the stamp clears the resolver and time). A historical import (preserveAudit) does not reopen. A reopen that fails is logged aterrorwith the consequence and the fix; the reply stands.false(applyDeclaredColumnDefault), so existing rows read unresolved, andis_resolved: { $ne: true }also matches a row with no value (pinned below with a NULL row).packages/plugins/plugin-audit/src/comment-resolution.tsholds the stamp, the reply refusal, the resolution-only predicate, the reopen hook and the "involving me" rule;comment-access-hooks.tswires them (the resolution limb of the update gate, the create-side clear, the registrations).audit-writers.tschanges by one word:parseCommentMentionsis exported so the involving-me rule readsmentionsexactly as the mention notifier does.For the comment panel (#36075): field names and query shapes
All through the existing comment read gate, as the caller:
discussionpart, "no page size"; orGET /data/sys_commentwiththread_id=OBJECT:ID). Group byparent_id; the top-level rows carryis_resolved,resolved_by,resolved_at.{ object_name: OBJECT, record_id: ID, parent_id: null, is_resolved: { $ne: true } }— one statement. Resolved only: same withis_resolved: true.countof that same filter — oneCOUNT. For 3 threads with 1 resolved it answers 2 (pinned).{ parent_id: { is_resolved: … } }to fetch replies of open threads:sys_commentcarries an object-scoped read middleware, so the engine reads ids under a cap instead of a subquery. Filter the loaded replies by their thread instead.threadsInvolvingUser(rows, userId)and pinned incomment-resolution.test.ts: a thread (identified by its top-level comment's id) involves the user whenauthor_idis the user (started it), orauthor_idthe user (replied), ormentionsof the top-level comment or of any reply (a JSON array of ids, or of{ id }objects; unparseable reads as none) — including a user who never wrote in the thread.A reply belongs to the thread reached by following
parent_idthrough the loaded rows; a reply whose chain leaves the loaded set is in no thread. The rule ignores resolution; compose it with the resolved filter.Tests
comment-resolution.integration.test.ts(new; real kernel, ObjectQL, AuditPlugin, SQLite): stamp and clear with the server clock; a client's resolver/time replaced by the stamp, or stripped and reported indroppedFieldswithout one; first resolver kept; new comment unresolved; reply refusal on the wire (mapDataError→ 400VALIDATION_ERROR, nothing written); a reply reopens a resolved thread; a reply into an open thread and a new top-level comment change nothing; filter + count (3 threads, 1 resolved → 2); a NULL row reads unresolved; no new row on the record's activity stream. Its engine options are typed, not erased toany.comment-access-hooks.test.ts(new top-leveldescribe, sharing double that denies edit): a reader resolves and reopens another user's thread without the parent-edit question; the stamps beside it keep it resolution-only; the same reader withbodyormentionsbesideis_resolved(and a bare body edit) is refused 403RECORD_NOT_ACCESSIBLE; a non-reader gets 403PERMISSION_DENIED; a dangling thread is its author's only; a multi-row resolution needs every row; reply refusal for author, editor and reader, and the not-visible refusal (not the 400) for a non-reader on a reply; create clears a client's resolution.comment-resolution.test.ts(new): the involving-me rule (started, replied, nested reply, mentioned on root, mentioned in a reply only, others' threads, orphan reply, unknown user);isResolutionOnlyUpdate; the stamp's import, system and non-boolean arms; the reopen failure logged aterror; an import does not reopen.Readings (implementation at 77b2fb8; gate fixes through cf75b3f; L1-a S1 at e062ef2)
pnpm --filter @objectstack/plugin-audit testat 77b2fb8: Test Files 106 passed (106), Tests 1761 passed (1761). The two later commits touch only the reply refusal's error-code constant and the new rig's option casts; at cf75b3f the three resolution suites pass (21 unit/hook + the rig), tsc andcheck:test-typecheckexit 0.scripts/ablation-replace.mjsand restored (git diff HEADempty after): gate limb off → 2 red; reopen registration deleted → 1 red; reply refusal deleted → 2 red; stamp registration deleted → 3 red. Tests importsrcdirectly, so nodistleg applies.node scripts/check-i18n-bundles.mjs --filter=audit: in sync (21 bundles); the three fields carry real text in all ten locales, so no source-hash record is written for them.comment-access-hooks.test.ts+ resolution suites: 98 passed; ablation (refusal put back ahead of the gate) turns the new case red, file restored; plugin-audit typecheck exit 0;check:error-status-conformanceexit 0. 0af5783 adds the create-without-edit sentence to the changeset.node scripts/pm/overlap-check.mjsat e062ef2: clean against main and feat(plugin-audit): a reply in a comment thread notifies the thread's starter and earlier repliers #36098 (sharesaudit-writers.ts).node scripts/pm/check-governed-merges.mjs --teston the file list: 0 governed paths.check:error-status-conformance(CI job "Lint · docs & code guards" on 77b2fb8). An earlier version of this body called its findings pre-existing; that was wrong — it exits 0 on main. The cause was this PR: a localconst code: StandardErrorCode = 'VALIDATION_ERROR'in the reply refusal, which the status deriver resolves by name across files, so other files'codereadings landed on it. Fixed at 79ad713 by naming the code once at module level (RESOLUTION_ON_REPLY_CODE); the gate exits 0, unresolved count back to main's.check:query-options-erasure: the new rig's sevenas anycasts on engine options raised the test surface 236 → 242. Fixed at cf75b3f (the bags type-check as declared); the ratchet holds at 236.check:tenant-audit-census: red on the new reopen write; green after regeneratingdocs/audits/…/plugins/plugin-audit.md(one new elevatedupdateofsys_comment).check:logger-receiver-detach: green after the reopen's error log calls through the property.check:dts-closureandcheck:dual-build-cjs-loads(need a whole-repo build, PREREQUISITE NOT MET),check-plugin-teardown-shape --self-test(shallow clone cannot reach its pinned fixture commit).Acceptance notes
createbut noteditonsys_commentcan post but not resolve: resolving is an update at the object level.member_defaultgrants edit.parent_idinto a resolved thread does not reopen it; only an inserted reply does.Verification
pnpm --filter @objectstack/plugin-audit exec vitest run src/comment-resolution.integration.test.ts— 10 passed, including "a reply posted into a resolved thread reopens it" and the 3-threads-1-resolved count of 2.Generated by Claude Code