Skip to content

feat(plugin-audit): a reply in a comment thread notifies the thread's starter and earlier repliers - #36098

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-apylxb
Nov 21, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-apylxb

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

repo:objectstack#1 · os-sales · session_01L6bhgT5fpDCjJ7voXxj1ge

Fixes #36074

Part of epic #36062, phase 1 (area b1-CM). Seat claim 7063189874. Flow: dev-thread rule (the card thread builds itself; L1 at L1-a).

What changes

Before, only an @mention notified anyone about a comment. Now a reply notifies the thread's starter and the people who replied in it before.

  • How "the people in the thread" is found (audit-writers.ts, readThreadParticipants). On a new comment whose parent_id is set, the writer follows parent_id up to the top-level comment (bounded at 16 hops and cycle-safe; the Console only replies to a top-level comment, so this is one read). The author of each comment on that chain is a participant, and the top-level comment's author is the starter. Then every distinct author of a reply to the top-level comment comes from ONE grouped read, engine.aggregate('sys_comment', { where: { parent_id: root, thread_id }, groupBy: ['author_id'] }), i.e. SELECT author_id … WHERE parent_id = ? AND thread_id = ? GROUP BY author_id on the existing parent_id index. The thread's rows are never read into memory (Prime Directive 5, SQL first). Both reads are held to the reply's own thread_id (its record): the walk stops at a parent on another record's thread, and the grouped read carries thread_id in its where, so a parent_id written across records through the API draws nobody from the other thread (L1-a N1). Both reads run in system context: they only produce candidates.
  • Who is skipped. The reply's author; everyone this reply's mentions name, as written and as the mention gate resolved them (they get the mention notice, not two). The mention writer now returns that set, and one afterInsert handler (writeCommentNotices) runs the mention notice, then the reply notice.
  • Who can see it. Each remaining candidate passes the mention recipient gate (admitMentionRecipients): they must READ the record and this reply, judged in their own envelope (grants, vetted organization claim, the comment read gate). The gate gains one optional input, notice: 'reply', that only changes its log line to [audit] reply notification withheld. The reply's author is never told who was withheld (that answer stays the mention's, whose author named the people).
  • What arrives. A new topic, collab.reply, through the same messaging.emit ingress (ADR-0030): an inbox notice per reply and person (dedupKey collab.reply:{replyId}:{uid}, source = the record, so it opens /{object}/{id}), and an e-mail in the mention e-mail's shape (channels: ['email'], the comment preview, then the line that opens the record). Payload: title, body (240-character preview), actorName, and mentionUrl on the e-mail (the member name is shared so one template shape serves both topics).
  • Titles in the recipient's language: messages.repliedToYourComment ("Bob replied to your comment") for the starter, messages.repliedInYourThread ("Bob replied in a comment thread you are in") for the others, messages.repliedAnonymous when the reply names no author. Added in all 11 locales of translations/messages.ts.
  • E-mail rate. At most one reply e-mail per person per 10-minute window: the mention e-mail's window under its own key (replyEmailDedupKey → collab.reply.email:{org}:{uid}:{bucket}; mentionEmailDedupKey is byte-identical to before). So within one window a person can get one mention e-mail plus one reply e-mail; a reply never holds back a mention e-mail. Inbox notices are not limited, as for mentions.
  • Templates. REPLY_EMAIL_TEMPLATES (the mention templates under collab.reply, one per catalog locale), registered by AuditPlugin at kernel:ready in a call of its own, so one refusal leaves the other.
  • Not notified: an edit of a reply (afterUpdate), a top-level comment, a reply whose parent cannot be found on its own record's thread.
  • Known cost (L1-a N2, not owed here): each participant is judged by the gate and emitted to one after another inside the reply's write, so a thread with many participants makes posting a reply slower in proportion. The mention writer has the same shape for many mentions.
  • Docs: content/docs/kernel/contracts/data-engine.mdx (onMentionsWithheld names only mentioned users; reply participants the gate withholds are not reported) and content/docs/ui/translations.mdx (reply bell titles localize to the reader, like mention titles), from the Docs Drift Check's list.
  • The topic pickers offer it (service-messaging, preference-options.ts): collab.reply joins PLATFORM_NOTIFICATION_TOPICS beside collab.mention, so GET /api/v1/messaging/preference-options offers it in the preference and template topic pickers before an organization has stored a reply notice (preference-options-routes.integration.test.ts loops over the list). Changeset gains '@objectstack/service-messaging': patch.
  • Not changed: mention notifications (topic, keys, title, e-mail, gate verdict), comment permissions, notification preferences (none added; a (collab.reply, email, enabled: false) or (*, email) row mutes the reply e-mail like any topic).

Why

Card #36074, phase 1 of #36062 (the maintainer agreed to bring reply notifications forward: 「同意」). Someone who started a thread, or replied in it, heard nothing when another person answered.

Item 3's "which record" in the title: the card asks the title to say who replied on which record's comment. The title names who replied; the record is reached by opening the notice, exactly like "X mentioned you", which does not name the record either. That clause, like the "earlier repliers" in item 1, was the coordinating seat's own addition, not the maintainer's words. Putting the record's name in the title would need a second, per-recipient field-level read of the record's title field. Seat accepted this reading before the build.

Verification

  • New comment-reply-notice.integration.test.ts (10 cases; real ObjectQL over SQLite, so the grouped read runs as SQL; real MessagingServicePlugin with outbox, dispatcher, preference filter and template tier): Alice comments, Bob replies → Alice one inbox notice + one e-mail ("Bob replied to your comment", preview, absolute record link), Bob nothing; Bob then Carol → Alice and Bob one each, Carol none, Bob's title "replied in a comment thread you are in"; a reply mentioning Alice → only the mention notice; zh-CN reader → zh-CN subject and link line; three replies in one window → three inbox notices, one e-mail; a reply e-mail and a mention e-mail in one window both send; (collab.reply, email) muted → inbox only; a top-level comment and an edit of a reply notify nobody; a reply to a reply walks up to the starter and reaches everyone up the chain and every replier; a reply whose parent_id names a comment on another record notifies nobody from that thread (fails with the thread_id bound removed).
  • mention-recipient-gate.integration.test.ts (real kernel, AuditPlugin, real gate) gains 3 cases: the participant who reads the record and the reply is notified while the other organization's user and the one without comment read are withheld; a starter whose record became unreadable gets nothing; the withheld line says reply.
  • mention-email.test.ts: reply templates equal the mention templates under collab.reply in every catalog locale; the reply key shape and window; the plugin registers both template sets; a refused registration warns once for each.
  • @objectstack/plugin-audit full suite: 105 files, 1746 passed (at c83ad1d); after the N1 and topic-list commits the reply, gate and mention-email files re-run green (4 files, 56 passed), and service-messaging preference-options-routes.integration.test.ts 9 passed; typecheck clean for both packages. pnpm typecheck (src, scripts, test layer): clean. eslint on the 8 touched source files: clean.
  • overlap-check.mjs before each push: clean against main (no open PR shares these files yet; 评论(二)后端:一串评论可以标记「已解决」,可恢复,可按已解决和「我参与的」筛选 #36071 edits the same plugin in parallel, the second to land merges main).

Clause-②: yes (widening) — @objectstack/plugin-audit emits a new notification topic, collab.reply (inbox and e-mail), and loads three new messages.* keys (repliedToYourComment, repliedInYourThread, repliedAnonymous) in all eleven locales into the host i18n service; @objectstack/service-messaging offers collab.reply in its platform topic list; nothing removed or refused
Metadata-protocol: none

Clause-② re-read on the final diff: yes (widening), by CONTRIBUTING.md Human Minimum 5 ("widen … what a published package … exposes") and the precedent of new translation keys declared as widening. No spec, protocol, SDK or door request/response shape changes. The new topic is registered where the platform lists its fixed topics, PLATFORM_NOTIFICATION_TOPICS in service-messaging (declaration L2 7063833407 ① 7); the mention-email.ts constants are package-internal (not exported from index.ts). Both packages ship patch (a non-protocol widening).

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (not touched)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; eslint on the touched files is clean (the full pnpm lint is left to CI).
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (not touched)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L6bhgT5fpDCjJ7voXxj1ge

… starter and earlier repliers

A new reply (`parent_id` set) notifies the author of each comment up its
`parent_id` chain (the top-level comment's author is the starter) and every
distinct author of a reply to the top-level comment, read in one grouped
query. The reply's author and anyone this reply mentions are skipped; each
remaining participant passes the mention recipient gate (reads the record and
the reply in their own envelope).

Topic `collab.reply`: an inbox notice per reply and person, plus an e-mail
in the mention e-mail's shape and 10-minute window under its own key. Titles
in all 11 catalog locales. Mention notifications are unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgT5fpDCjJ7voXxj1ge
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 21, 2026
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/plugin-audit, @objectstack/service-messaging, touching 29 documentable anchor(s).

22 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 493ad095d40ece94fe25d822566138fd01f5d4c3.

⛔ 9 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 8 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 15 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 493ad095d40ece94fe25d822566138fd01f5d4c3 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 2b22846f5bad2b2017906cfd80aa86c22ac2d24f — the merge of head 920db11e64204a453a7ed6d479ced57caaa4d506 into base 493ad095d40ece94fe25d822566138fd01f5d4c3, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 2b22846f5bad2b2017906cfd80aa86c22ac2d24f && git checkout 2b22846f5bad2b2017906cfd80aa86c22ac2d24f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 493ad095d40ece94fe25d822566138fd01f5d4c3 920db11e64204a453a7ed6d479ced57caaa4d506 && git checkout -B drift-repro 493ad095d40ece94fe25d822566138fd01f5d4c3 && git merge --no-ff 920db11e64204a453a7ed6d479ced57caaa4d506

node scripts/docs-audit/affected-docs.mjs --json 493ad095d40ece94fe25d822566138fd01f5d4c3

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 493ad095d40ece94fe25d822566138fd01f5d4c3 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

Posted 2026-11-21T14:02Z. The brief handed to the isolated declaration-face reviewer for PR #36098 (owed by the changeset's Clause-②: yes (widening) line, claim amendment on #36074). The record follows as its own comment.

Contract review brief — PR #36098 @ c83ad1dc3704566bbc09d6b02a62b947e40f3ed2 (card #36074)

You review at TIER_DEFAULT. Render ONE ## Contract review record on this head — its shape is
node scripts/pm/record-recognisers.mjs --template --face declaration — with a PASS or FAIL verdict, and post it as ONE comment
on the PR or its card.

Inputs — these and nothing else:
· card #36074: its body and EVERY comment (rulings and earlier records included)
· also epic #36062 (body, and comments 7062530606 and 7062566069) and sibling card #36071 (resolved state, same plugin, in parallel): bodies only, for context
· PR #36098: its body, its file list, and the net diff against main at c83ad1dc3704566bbc09d6b02a62b947e40f3ed2
· the check-runs on c83ad1dc3704566bbc09d6b02a62b947e40f3ed2: their conclusions ARE the gate verdicts
⛔ Not the dispatch order, ⛔ not the dispatching seat's own conclusions — this brief is adversarial by design.

⛔ READ-ONLY. No worktree, no checkout, no build, no test run, no gate re-run, no ablation: the check-runs
on the head already answered every derived gate family, and a local run costs more than it returns.
If ONE probe is unavoidable, the record's Local-runs: line says probe — REASON; otherwise none.
Scratch space is /tmp/claude-0/-home-user/3d3cbaf6-4903-5fed-92d4-c2b94a45e868/scratchpad/pr-36098/ alone; nothing there you did not write this round is read.

Judge, in the record's own sections:
① Derived judgments — every accept-set and public-surface change the diff implies, each named right or wrong.
② Semver level — the changeset (or skip-changeset) matches what the diff publishes, and the Clause-②: line.
③ Boundary flags — every dev flag and every open_questions entry answered, or escalated.
On every face, SQL push-down: a new id materialisation or in-app join where SQL could push down is a
finding unless a reason is given (AGENTS.md, Prime Directive 5: SQL first).
Sign Implemented-by: with the dev's branch and Reviewed-by: with your session id — the value is the FIRST
thing after each colon.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U

席位核对 — ACCEPT (L1-a)

维护者速读

这个 PR 做的是:有人在一串评论里回复时,通知这一串的发起人,以及之前在这一串里回复过的人。卡上的几条规则都做到了:

  • 回复的人自己不收通知。
  • 这条回复里已经被「提到」的人只收提到的那一条通知,不会再收一条。
  • 看不到这条记录或这条回复的人,不收通知。判断用的是和「提到」完全同一道权限检查。

通知的样子、语言、邮件每人每 10 分钟最多一封,都和「提到」一致。「提到」原来的通知完全没动。

判断「参与过的人」的方式在正文里写清楚了:顺着回复往上找到这一串的第一条评论,再用一条分组查询找出所有回复过的人,不把整串评论读进内存。

没有需要修的问题。下面两条小建议不挡合并:

  • 找「这一串的人」时,建议再核对一下上级评论确实属于同一条记录。
  • 一串里人很多时,每发一条回复要逐个判断并发通知,会让发评论这一步变慢,可以以后观察。

不属于受管面,声明了对外新增(新通知类型和三个文案),所以座位还要在同一版本上跑一次 L2,本记录不替代它。

Head reviewed: c83ad1dc3704566bbc09d6b02a62b947e40f3ed2. Three commits, 11 files, +779/−33. git merge-tree onto current main is clean. check-governed-merges --pr 36098 (PR-head register) reads NOT governed, 0 of 11 paths, 812 lines, under the 3000-line threshold. reviewFace with Clause-②: yes (widening) gives face declaration → TIER_DEFAULT, so the seat's declaration L2 on this head is the review that face owes. CI is as the thread reported. vitest was not run here (no node_modules).

What holds

  • Candidates vs recipients.
    • readThreadParticipants reads in system context, and only to produce candidates. Every candidate then goes through admitMentionRecipients, the same gate a mention uses, judged in the candidate's own envelope.
    • Record read comes first, then the comment read gate on this reply's id (readableIn(… COMMENT_OBJECT, commentId)), then the organisation claim.
    • notice: 'reply' only changes the log line; the verdict is untouched.
    • The author is never handed the reply's withheld set, and onMentionsWithheld still names only mentioned users, so nothing about un-named people reaches the author. The data-engine.mdx paragraph states this.
  • Skips.
    • The author is removed before the gate, and again in the emit loop.
    • named collects the mentions as entered and both halves of the gate's answer (userIds and withheld), so a mentioned user never gets a second notice. A withheld mention would fail the same gate here anyway.
    • writeCommentNotices runs the mention writer first, and it is the only afterInsert registration on sys_comment. afterUpdate keeps writeCommentMentions alone, so an edit notifies no participant.
  • SQL first.
    • The ancestry walk reads one row per hop, bounded at 16 and cycle-safe.
    • Repliers come from one aggregate(… { where: { parent_id }, groupBy: ['author_id'] }) on the parent_id index (sys-comment.object.ts:315). No thread rows are materialised.
    • A missing parent returns null, which means no notice.
  • Topic and e-mail.
    • collab.reply goes through the same messaging.emit ingress.
    • The inbox dedupKey is per reply and person.
    • replyEmailDedupKey shares the mention's 10-minute bucket under its own prefix, and mentionEmailDedupKey is byte-identical to before (commentEmailDedupKey(MENTION_TOPIC, …)).
    • REPLY_EMAIL_TEMPLATES is the same generator under the reply topic, registered in its own try.
    • None of the new constants is exported from index.ts.
  • Strings. There are three keys in all eleven locales of translations/messages.ts, with English fallbacks inline.
  • Clause-② yes (widening) is right. A new emitted topic and new host i18n keys are added, and nothing is removed or refused. patch matches the precedent the body cites.
  • Acceptance coverage. Each of the card's six acceptance lines maps to a named case in comment-reply-notice.integration.test.ts (real ObjectQL over SQLite, real messaging pipeline) or mention-recipient-gate.integration.test.ts (starter who lost record read). The body explains how participants are found, which is the sixth line.

Nits (do not block)

  • N1: the parent chain is not held to the reply's own thread. readThreadParticipants follows parent_id and groups on parent_id = root without comparing thread_id, and nothing on insert checks that a reply's parent hangs off the same record (comment-access-hooks.ts authorises thread_id only).
    • Through the Console the two always agree. A reply written through the API with a parent from another record would draw its candidates from that other thread.
    • Every candidate still has to read this record and this reply, so no notice goes to someone who cannot see it.
    • The cheap hardening is to read thread_id on each hop, stop when it differs from the reply's, and add thread_id to the aggregate's where. "The thread" then means this record's thread by construction.
  • N2: fan-out cost grows with the thread.
    • Per candidate, the gate resolves the user, builds their context and runs two read checks. The writer then resolves a locale and makes two emits, all sequentially inside the reply's afterInsert.
    • Mentions were bounded by what an author types, while a reply's fan-out is bounded by how many people have replied.
    • That is fine for phase 1. If long threads appear, a cap, or moving the reply notice after the write's response, is the lever.

Observation (no change asked)

  • In a deeper chain, which the Console does not write, the author of the comment directly replied to is not the starter, so they get "replied in a comment thread you are in" rather than "replied to your comment". The body already states that the Console writes one level.

Landing terms

  • Not governed. After the seat's declaration L2 on this head, it lands through the ordinary queue. Fixes #36074 closes the card on merge.
  • A new push needs a delta L1 unless it is a clean main merge.
  • This review does not approve, mark ready, enqueue or request review.

A parent_id that names a comment on another record's thread no longer draws
that thread's people as candidates: the parent walk stops at a comment whose
thread_id differs, and the repliers' grouped read is held to the reply's
thread_id. Pinned (fails without the bound).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgT5fpDCjJ7voXxj1ge
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

Contract review

Served-tier: TIER_DEFAULT
Head-sha: c83ad1dc3704566bbc09d6b02a62b947e40f3ed2
Local-runs: none

Inputs: card #36074 (body, triage 7062833356, claim 7063189874, amendment 7063394639); epic #36062 body with 7062530606 and 7062566069; sibling #36071 body; PR body, file list (11 files) and the net diff against merge-base 493ad095d4; the check-runs on the head. Every check-run on the head is success or skipped, except one cancelled run of PR-body guards whose rerun on the same head is success. Gate families are taken as answered.

① Derived judgments

  1. New notification topic collab.reply (inbox and e-mail, through messaging.emit). Named right as a widening: a new value in sys_notification.topic and sys_inbox_message.topic, plus a new messaging.registerBuiltinTemplates set (REPLY_EMAIL_TEMPLATES, one per catalog locale), registered by its own call at kernel:ready.

  2. Three new messages.* keys (repliedToYourComment, repliedInYourThread, repliedAnonymous), present in all 11 locales of translations/messages.ts. Named right as a widening. The #36070 precedent applies.

  3. MentionGateInput.notice?: 'mention' | 'reply'. Optional, and it changes only the log line. mention-recipient-gate.ts is not exported from index.ts, so the change is internal. With the field absent, the line reads exactly as before. Named right: no surface change.

  4. mention-email.ts. REPLY_TOPIC, replyEmailDedupKey and REPLY_EMAIL_TEMPLATES are package-internal. mentionEmailDedupKey and MENTION_EMAIL_TEMPLATES are byte-identical in output, because the refactor goes through commentEmailDedupKey and commentEmailTemplates with the same shape. Named right.

  5. writeCommentMentions now returns ReadonlySet. It is still registered on afterUpdate. The engine's triggerHooks ignores handler return values (engine-hooks-and-functions.ts), so the edit path is unchanged. Named right.

  6. The accept set is unchanged. No spec, protocol, REST or SDK shape moves, and no sys_comment field or permission changes. Named right.

  7. ⛔ Named wrong: the platform topic list served by the preference-options door. packages/services/service-messaging/src/preference-options.ts PLATFORM_NOTIFICATION_TOPICS is the platform's measured list of fixed topics. It is served as the platform source of GET /api/v1/messaging/preference-options, which feeds the notification-topic widget on sys_notification_preference.topic and on the template topic. Its jsdoc states the rule: "a feature that starts sending a new fixed topic adds it here". #35789 followed that rule for messaging.slack_link_removed. This diff starts sending a new fixed platform topic but does not add collab.reply to the list. The PR body's Clause-② re-read justifies that with "no topic registry exists". That holds for ADR-0030's defineTopic() catalog, but it is wrong for the list this door serves.

    • Effect: the changeset's own Preferences bullet tells an administrator to write a (collab.reply, email, enabled: false) row. In an organization that has no stored reply notice yet, the console's topic picker does not offer collab.reply, and the template picker does not offer it either. The topic is still legal as free text, so nothing is refused.
    • Required fix:
      • add 'collab.reply' to PLATFORM_NOTIFICATION_TOPICS, kept sorted, right after 'collab.mention';
      • name it in that jsdoc's plugin-audit parenthesis;
      • add an '@objectstack/service-messaging': patch entry to the changeset, with a bullet that says the preference and template topic list now offers collab.reply;
      • correct the PR body sentence.

    The existing preference-options-routes.integration.test.ts loop over the list then covers it. #36071 does not touch service-messaging.

② Semver level

.changeset/36074-comment-reply-notice.md: '@objectstack/plugin-audit': patch, with Clause-②: yes (widening) and Metadata-protocol: none in both the PR body and the changeset body. That is right for what the diff publishes:

  • the new topic and message keys are a non-protocol widening;
  • no key, value or metadata type that an author can write is added, narrowed or changed in meaning;
  • under AGENTS.md Post-Task Checklist step 3, a non-protocol widening ships patch;
  • no BREAKING banner or ADR-0087 marker is owed.

The amendment 7063394639 moved the claim's Clause-②: no to yes (widening) on the final diff. I agree with it.

The fix in ① 7 adds a second package to the changeset, '@objectstack/service-messaging': patch. It is the same kind of change (a value added to a served suggestion list) and keeps the same declarations.

Clause-②: yes (widening). Confirmed for the head as reviewed. It stays yes (widening) once ① 7 lands.

③ Boundary flags

  • Dev flag: item 3's "which record" in the title. Answered: accept. The title names the actor only, as "X mentioned you" does. The notice's source is the record and opens /{object}/{id}. Naming the record would need a per-recipient read of the title field. The card lists item 3 under 协调席自己加的, so it was not the maintainer's words. The claim stated this reading before the build, and the PR body states it again. No escalation is needed. If the coordinator wants the record name, that is a follow-up card.
  • Dev flag: e-mail rate "沿用现有的". Answered: accept. The reply e-mail uses the mention window (10 min, per organization and person) under its own key, so the card's acceptance holds: three replies in one window send one e-mail. A side effect is that one mention e-mail and one reply e-mail can both arrive in the same window. That is disclosed in the PR body and changeset, and it never holds back a mention. A reply that mentions the recipient sends only the mention, so the case the card names is never doubled.
  • Dev flag: "participants" = starter plus everyone up the chain plus distinct authors of direct replies to the root. Answered: accept, with a nit. For a reply to a reply, the authors of other nested replies under intermediate comments are not found, because only the root's direct children are grouped. The Console writes one level, so today this is unreachable. Nit, no change required.
  • Card acceptance. Each line is covered by the new integration cases:
    • the starter is notified and the replier is not;
    • in an A, B, C chain, A and B are notified and C is not;
    • a mention suppresses the reply notice;
    • a starter who lost read access gets nothing;
    • three replies in one window send one e-mail;
    • the PR body says how participants are found.
  • open_questions. The card has none beyond its 没有核对的 section. Landing the click on the reply itself depends on 评论(一), and this card asks only for opening the record, which is met.
  • SQL push-down.
    • The participant read is ONE grouped engine.aggregate (WHERE parent_id = ? GROUP BY author_id, on the existing parent_id index). The thread's rows are never materialised. This is pushed down.
    • The ancestry walk is one find per hop, bounded at 16 and cycle-safe. Reason given: the Console writes one level, so this is one read, and the engine offers no recursive query. Accepted.
    • The per-candidate gate is the existing admitMentionRecipients, reused. It is per-envelope by necessity, because each recipient is judged under their own grants. It adds no new id materialisation or in-app join. Accepted.
    • No finding.
  • Nit (no effect): in writeCommentReplyNotices, if (uid === actorId) continue; is redundant, because the candidates already exclude the actor and the gate drops the actor too.

Implemented-by: claude/project-thread-apylxb
Reviewed-by: session_01L6bhgUkbQqRUUFSiu2HGob (isolated L2 sub-agent of the seat)

VERDICT: FAIL

… collab.reply

The reply notice is a new fixed platform topic, so it joins
PLATFORM_NOTIFICATION_TOPICS beside collab.mention; the preference-options
door then offers it before an organization has stored one. Also drops a
redundant actor check in the reply writer (the candidates already exclude
the actor).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgT5fpDCjJ7voXxj1ge
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U

席位核对 — delta ACCEPT (L1-a)

维护者速读

这一轮有两处改动,都可以通过:

  • 上一轮我提的建议已经做了。 找「这一串的人」时,现在只认同一条记录上的评论。万一有一条回复挂到了别的记录的评论下面,不会去通知那边的人。新加了一条测试钉住这一点。
  • 座位 L2 要求的补充也做了。 通知设置和模板的话题列表里,现在会列出「评论回复」。即使这个组织还没收到过回复通知,管理员也能直接在设置里关掉回复邮件。

另外删掉了一处重复的判断,不影响结果。不属于受管面,按普通队列落地。CI 绿了再落地;L2 这一轮是否要复核由座位定。

Head reviewed: 920db11e64204a453a7ed6d479ced57caaa4d506. The delta is c83ad1dc..920db11e, two commits (6c5503f0, 920db11e), 4 files, +36/−12. git merge-tree onto current main is clean. check-governed-merges --pr 36098 reads NOT governed, 0 of 12 paths. reviewFace with Clause-②: yes (widening) still gives declaration → TIER_DEFAULT. The prior ACCEPT 7063795484 stands for everything outside this delta.

N1: cleared (6c5503f0)

  • readThreadParticipants now takes the reply's thread_id and returns null when it is empty. Each hop reads thread_id and stops when it differs, so a parent on another record yields no root and no notice at all.
  • The grouped read's where is { parent_id: rootId, thread_id: threadId }, so sibling replies are held to the same record too.
  • The new case writes a reply on t1 whose parent_id names a comment on t2. It asserts that no collab.reply delivery and no send come from it, and the thread reports that it fails with the bound removed.

920db11e (seat L2 7063833407 item ①7)

  • collab.reply joins PLATFORM_NOTIFICATION_TOPICS in sorted position, after collab.mention. That satisfies the route test's sorted-order assertion and its every-platform-topic-offered loop (preference-options-routes.integration.test.ts:205-208). The doc line names the send site.
  • The changeset adds @objectstack/service-messaging: patch, and its Clause-② line names the list widening. The new value in an exported list and in the preference-options answer is a widening, so yes (widening) still holds.
  • The removed if (uid === actorId) continue; was redundant. Candidates drop the actor before the gate, and the gate only admits ids it was given (each raw id resolves to itself), so the actor cannot come back.

N2

  • It is stated in the body as a known cost, as asked. Nothing more is needed here.

Landing terms

  • Not governed: the seat lands it through the ordinary queue on this head's green. Fixes #36074 closes the card on merge. Whether the declaration L2 needs a delta read for 920db11e is the seat's call; this record does not replace it.
  • At the time of this record CI on 920db11e is still running, per the card thread.
  • A new push needs a delta L1 unless it is a clean main merge.
  • This review does not approve, mark ready, enqueue or request review.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 920db11e64204a453a7ed6d479ced57caaa4d506
Local-runs: none

Delta review of c83ad1dc..920db11e. It covers two commits, 6c5503f06 (L1-a N1) and 920db11e6 (the fix this reviewer required), and the updated PR body. Everything in the earlier FAIL record on c83ad1dc3704566bbc09d6b02a62b947e40f3ed2 that is not named here stands unchanged. The merge-base is still 493ad095d4.

① Derived judgments

  1. The required fix (the earlier record's ① 7) holds.
    • 'collab.reply' is now in PLATFORM_NOTIFICATION_TOPICS, sorted right after 'collab.mention'.
    • The list's jsdoc now names it in the plugin-audit parenthesis.
    • The changeset gains '@objectstack/service-messaging': patch and a bullet saying GET /api/v1/messaging/preference-options offers it before an organization has stored a reply notice.
    • The PR body's "no topic registry exists" is gone. The body now points at the list.
    • With this, preference-options-routes.integration.test.ts, which loops over the list, covers the topic.
    • Named right: the platform-source answer of the door widens, and nothing is removed.
  2. N1: the thread is held to its own record (readThreadParticipants, which now takes threadId).
    • The parent walk reads thread_id and stops at a parent on another record's thread.
    • The grouped aggregate adds thread_id to its where.
    • An empty threadId returns null, so nobody is notified.
    • New pin: a reply on t1 whose parent_id names a comment on t2 notifies nobody from t2. The PR body says the pin fails with the bound removed.
    • Named right as a change to who the producer picks. It changes no accept set: sys_comment still stores a cross-record parent_id exactly as before, nothing is refused, and no field, permission or shape moves. The reply notice only reaches fewer people in a case the Console never writes. The notice is unreleased, so no published behaviour narrows.
  3. The redundant uid === actorId check is removed. The candidates already exclude the actor, and the gate drops the actor too. No behaviour change.

② Semver level

  • Changeset: '@objectstack/plugin-audit': patch and '@objectstack/service-messaging': patch.
  • Declarations: Clause-②: yes (widening), now also naming the platform topic list, and Metadata-protocol: none, both in the PR body and the changeset body.
  • Why patch: both packages carry a non-protocol widening, and AGENTS.md Post-Task Checklist step 3 sends that to patch.
  • N1 changes no declaration. It adds no authorable key or value, refuses nothing, and narrows no published accept set. It refines the candidate set of a topic that this same PR introduces.

Clause-②: yes (widening). Confirmed for this head. Metadata-protocol: none and both patch levels are unchanged by N1.

③ Boundary flags

  • SQL push-down still holds. The participant read is still ONE grouped aggregate, now WHERE parent_id = ? AND thread_id = ? GROUP BY author_id, still led by the parent_id index. The walk adds one column to its bounded per-hop find. No new id materialisation or in-app join.
  • N2 (each participant judged and sent to one after another, inside the reply's write) is answered: accept as a known cost. The PR body names it. It has the same shape as the existing mention writer. Judging each participant under their own grants is required, so the gate cannot be batched across envelopes. If a thread grows large enough for this to show, that is a follow-up card, not this one.
  • Nit, no change required: the PR body's "How the people in the thread is found" bullet still quotes where: { parent_id: root } in its code span, then explains the added thread_id in the next sentence. Updating the span would make the body match the code.
  • Earlier flags still answered: the title naming who replied, the e-mail window, and the definition of participants all stand as answered in the earlier record.
  • Check-runs on 920db11e64204a453a7ed6d479ced57caaa4d506, read at review time:
    • green or skipped: PR-body guards (2 runs), Test UI, Spec property liveness, Lint · scoped · tooling self-tests, Lint · PM dispatch-gates, Governed Surface Queue Guard, Flag docs affected by code changes, Dogfood Regression Gate, Check PR Size, Check Documentation Links, Auto Label, filter;
    • still in_progress: Build Core, Build Docs, Check Changeset, the Type Check jobs (workspace, source gates, debt ledger, consumer gates), the Lint jobs (CI, release & engine gates; ESLint; docs & code guards; repo & tooling gates; scoped query-options erasure; scoped slot lookup & corpus), Plan Test Core shards (so the Test Core shards have not started) and Live E2E UI.
    • The verdict below is on the code and declarations. It is adoptable only once every one of these runs concludes success or skipped on this head. A red run voids it.

Implemented-by: claude/project-thread-apylxb
Reviewed-by: session_01L6bhgUkbQqRUUFSiu2HGob (isolated L2 sub-agent of the seat)

VERDICT: PASS

Seat note: when this record was written 15 check-runs were still running; they have all ended since — on 920db11e 44 check-runs are success, 19 skipped, none failed — so this PASS is adopted.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

Seat landing · 2026-11-21T14:35Z · #36074 reply notifications (epic #36062 phase 1). A reply to a comment notifies the thread's participants under the new platform topic collab.reply, through the existing per-recipient gate, with its own e-mail window; collab.reply is listed in PLATFORM_NOTIFICATION_TOPICS so the preference and template pickers offer it. Seat declaration L2: FAIL 7063833407 on c83ad1dc (topic missing from that list), delta PASS 7064197778 on 920db11e (this head; the fix holds, N1's thread bound changes no declaration). L1-a delta ACCEPT 7063908706 on this head. Clause-②: yes (widening), Metadata-protocol: none, patch for both packages. check-governed-merges --pr 36098 reads NOT governed (+804/−34). The seat read K by hand: 11 first-parent commits since the merge base, under 15, no translations/ or skills/ paths on either side. On this head 44 check-runs are success, 19 skipped, none failed; mergeable clean. The seat readies this PR and arms auto-merge in the same step. The PR carries Fixes #36074.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 21, 2026 14:35
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit 00ae570 Nov 21, 2026
64 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-apylxb branch November 21, 2026 15:01
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 22, 2026
…ned (objectstack-ai#36104)

<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuMsy8fpTCu5kQmHrvVyhAmE)_

Fixes objectstack-ai#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.

## 维护者速读

-
用户能看到什么变化:后端准备好了「已解决」:一串评论可以标记已解决、再恢复,记下谁解决的、什么时候;往已解决的串里回复会自动恢复。界面在评论栏卡里做,这个改动本身用户看不到。
- 为什么做:评论重做专题第一阶段,评论栏的未解决数字和「显示已解决」「只看我参与的」筛选都靠它。
- 出错会怎样:最坏是一串讨论被误收起,可以再点恢复,任何人回一句也会自动恢复;评论的文字不受影响;能直接撤回这个改动。
- 要你做什么:无(「能看记录的人就能标记」已在 13:25 选定)。

## What changes

`sys_comment` gains the resolution of a thread. A **thread** is one
top-level comment (no `parent_id`) together with its replies; its state
lives on the top-level row.

| Field | Type | Written by |
|---|---|---|
| `is_resolved` | boolean, default `false` | the caller, on a top-level
comment only |
| `resolved_by` | lookup `sys_user`, `readonly` | the platform: the
session user when `is_resolved` turns `true`, cleared when it turns
`false` |
| `resolved_at` | datetime, `readonly` | the platform: the server clock,
same rule |

- **Resolve / reopen** = `PATCH` the top-level comment through the data
API with `{ "is_resolved": true }` or `false`. Resolving an
already-resolved thread changes nothing (the first resolver stays).
- **Who may** (maintainer ruling record 7063285032, option A, reviewed
before the decision in the project's fable review): **anyone who may
comment on the record may resolve and reopen its threads**. An update
that changes nothing but `is_resolved` (beside the row id and the
platform stamps `updated_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.
- **Only a thread is resolved**: an update naming `is_resolved` on a
reply is refused, `VALIDATION_ERROR` / 400 (field `is_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.
- **A new comment is unresolved**: on create the platform sets
`is_resolved: false` and clears `resolved_by` / `resolved_at` over a
client's values.
- **A reply reopens its thread**: after a reply is inserted
(`afterInsert`), when its thread's top-level comment is resolved, the
platform updates it back to `is_resolved: false` (system write; the
stamp clears the resolver and time). A historical import
(`preserveAudit`) does not reopen. A reopen that fails is logged at
`error` with the consequence and the fix; the reply stands.
- **Activity**: resolving or reopening writes no entry on the record's
activity tab. The comment's own update is recorded as every comment
write is (audit ledger plus an activity row whose parent is the comment,
per the maintainer ruling on objectstack-ai#30213), and the record timeline never
draws those.
- **Stored rows**: no migration. The SQL column default is `false`
(`applyDeclaredColumnDefault`), so existing rows read unresolved, and
`is_resolved: { $ne: true }` also matches a row with no value (pinned
below with a NULL row).
- **Where**: the new
`packages/plugins/plugin-audit/src/comment-resolution.ts` holds the
stamp, the reply refusal, the resolution-only predicate, the reopen hook
and the "involving me" rule; `comment-access-hooks.ts` wires them (the
resolution limb of the update gate, the create-side clear, the
registrations). `audit-writers.ts` changes by one word:
`parseCommentMentions` is exported so the involving-me rule reads
`mentions` exactly as the mention notifier does.

### For the comment panel (objectstack-ai#36075): field names and query shapes

All through the existing comment read gate, as the caller:

- **The record's threads** — the panel already reads the record's whole
discussion in one read (the record page's `discussion` part, "no page
size"; or `GET /data/sys_comment` with `thread_id` = `OBJECT:ID`). Group
by `parent_id`; the top-level rows carry `is_resolved`, `resolved_by`,
`resolved_at`.
- **Unresolved threads only (top-level rows)**: `{ object_name: OBJECT,
record_id: ID, parent_id: null, is_resolved: { $ne: true } }` — one
statement. Resolved only: same with `is_resolved: true`.
- **Unresolved-thread count** (the icon's number): `count` of that same
filter — one `COUNT`. For 3 threads with 1 resolved it answers 2
(pinned).
- ⛔ Not `{ parent_id: { is_resolved: … } }` to fetch replies of open
threads: `sys_comment` carries 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.
- **"Involving me"** — no server query in phase 1 (the review's
implementation choice: the panel holds the whole thread set, and the
query engine serves no condition that selects a parent row by its
children). The rule, exported as `threadsInvolvingUser(rows, userId)`
and pinned in `comment-resolution.test.ts`: a thread (identified by its
top-level comment's id) involves the user when
  1. the top-level comment's `author_id` is the user (started it), or
  2. any reply in the thread has `author_id` the user (replied), or
3. the user's id is in the `mentions` of 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_id` through
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.
- Phase 2's cross-record "involving me" query (the view-wide feed) needs
its own decision: an engine condition selecting parents by children, or
a platform-kept participant list.

## 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 in
`droppedFields` without one; first resolver kept; new comment
unresolved; reply refusal on the wire (`mapDataError` → 400
`VALIDATION_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 to `any`.
- `comment-access-hooks.test.ts` (new top-level `describe`, 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 with `body` or `mentions` beside
`is_resolved` (and a bare body edit) is refused 403
`RECORD_NOT_ACCESSIBLE`; a non-reader gets 403 `PERMISSION_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 at `error`; an import does not reopen.

<details><summary>Readings (implementation at 77b2fb8; gate fixes
through cf75b3f; L1-a S1 at e062ef2)</summary>

- `pnpm --filter @objectstack/plugin-audit test` at 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 and `check:test-typecheck` exit 0.
- Ablation, each with the implementation committed, mutated on disk by
`scripts/ablation-replace.mjs` and restored (`git diff HEAD` empty
after): gate limb off → 2 red; reopen registration deleted → 1 red;
reply refusal deleted → 2 red; stamp registration deleted → 3 red. Tests
import `src` directly, so no `dist` leg 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.
- L1-a S1 (7064443655), e062ef2: the reply refusal moved below the
access gate, plus the non-reader case. `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-conformance` exit 0. 0af5783 adds the
create-without-edit sentence to the changeset.
- `node scripts/pm/overlap-check.mjs` at e062ef2: clean against main
and objectstack-ai#36098 (shares `audit-writers.ts`).
- `node scripts/pm/check-governed-merges.mjs --test` on the file list: 0
governed paths.
- Gates this PR had turned red, each fixed on this branch and
re-measured green locally:
- `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 local `const code: StandardErrorCode = 'VALIDATION_ERROR'` in the
reply refusal, which the status deriver resolves by name across files,
so other files' `code` readings 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 seven `as any` casts 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
regenerating `docs/audits/…/plugins/plugin-audit.md` (one new elevated
`update` of `sys_comment`).
- `check:logger-receiver-detach`: green after the reopen's error log
calls through the property.
- Not measurable in this checkout, left to CI: `check:dts-closure` and
`check: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).

</details>

## Acceptance notes

- A custom permission set that grants `create` but not `edit` on
`sys_comment` can post but not resolve: resolving is an update at the
object level. `member_default` grants edit.
- Portal or guest users who can read a record and comment can also
resolve its threads under option A (named in the review; not measured
whether such deployments exist).
- Re-pointing a reply's `parent_id` into a resolved thread does not
reopen it; only an inserted reply does.
- Resolving is recorded on the comment's own audit trail, by the
resolver; the reopen a reply triggers is a system write.

## 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](https://claude.ai/code/session_01L6bhgUJ3ExTXMikbrPFNqD)_

<!-- signed: repo:objectstack#1 · os-sales ·
session_01L6bhgUJ3ExTXMikbrPFNqD -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

评论(五)后端:有人回复时通知这一串的发起人和参与过的人(现在只有被提到才通知)

2 participants