Repository navigation
feat(spec): a comment's author is told which mentioned users will not be notified, and a mention added by editing notifies - #28174
Conversation
…thheld Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxkM6EsYLMNr5Vc8zP
…transport Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxkM6EsYLMNr5Vc8zP
…d-mention answer Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxkM6EsYLMNr5Vc8zP
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxkM6EsYLMNr5Vc8zP
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxkM6EsYLMNr5Vc8zP
📓 Docs Drift CheckThis PR changes 5 package(s): 34 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 12 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 178 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 7f4c840e4d651abdb9434258cce9c7d85a14c797 && git checkout 7f4c840e4d651abdb9434258cce9c7d85a14c797
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 35f205514ce93e1871ff2e238529d7da5423c893 51450e766c971ee903fccf2cfb3c5b3a2188f5d7 && git checkout -B drift-repro 35f205514ce93e1871ff2e238529d7da5423c893 && git merge --no-ff 51450e766c971ee903fccf2cfb3c5b3a2188f5d7
node scripts/docs-audit/affected-docs.mjs --json 35f205514ce93e1871ff2e238529d7da5423c893
|
|
domain:spec#2 · os-tesla · session_01L9qibx5r5nhDMwpRs4SL6D Contract-review-claim: session_01L9qibx5r5nhDMwpRs4SL6D · head 9a38b6c · 2026-10-30T15:19Z |
|
domain:spec#2 · os-tesla · session_01L9qibx5r5nhDMwpRs4SL6D Contract reviewServed-tier: Governing ruling: card comment 6523848208 (maintainer 「27703 同意」, letter A). Judged against: a response-only member on the ① Derived judgmentsEach accept-set or public-surface change the net diff implies, named right or wrong against the ruling and the live tree.
Check runs on ② Semver level
Clause-②: yes — a new served key on the data-write answer (「协议新增定 p1」), stated identically in the changeset body, the PR body and the claim 6524736722; ③ Boundary flags
④ Design judgment
Cited code the hits make claims about (read, not reviewed; findings named where they bear on the contract):
Must-fix: none. Should-fix 1 — Should-fix 2 — Should-fix 3 — Observations (no fix owed under the ruling): when the gate throws, no gate or no Implemented-by: VERDICT: PASS |
…y 'withheld by the gate' and 'the requester'; mirror withheldMentions in the client SDK Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxkM6EsYLMNr5Vc8zP
…27703 patch round Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxkM6EsYLMNr5Vc8zP
|
domain:spec#2 · os-tesla · session_01L9qibx5r5nhDMwpRs4SL6D Contract-review-claim: session_01L9qibx5r5nhDMwpRs4SL6D · head 51450e7 · 2026-10-30T16:27Z |
|
domain:spec#2 · os-tesla · session_01L9qibx5r5nhDMwpRs4SL6D Contract reviewServed-tier: Delta review of record 6526608625 (PASS on ① Derived judgments
Check runs on ② Semver levelChangeset now lists ③ Boundary flags
④ Design judgment
Cited code — the actor change (
Must-fix: none. Should-fix: none. (Three carried from 6526608625, all landed as described in ①.) Observations (no fix owed): changeset heading still says "author"; the editor case is admitted through the degraded Implemented-by: VERDICT: PASS |
|
domain:spec#2 · os-tesla · session_01L9qibx5r5nhDMwpRs4SL6D 维护者速读
席位核对 · ACCEPT ·
|
domain:spec#2 · os-tesla · session_01L9qibxkM6EsYLMNr5Vc8zP
Requested by Tesla · project thread
Fixes #27703
Clause-②: yes
Metadata-protocol: added
Skills-docs: none — a response-only answer member and an in-process listener, nothing a metadata author writes; the docs teach it here (
content/docs/api/data-api.mdx,content/docs/kernel/contracts/data-engine.mdx)Ruling-ref: 6523848208
维护者速读
sys_comment)的新建和编辑应答多了一个只读成员withheldMentions,列出这次 @ 了、但被提及闸门扣下通知的人的 id(多半因为读不到评论或记录);编辑评论时新加的 @ 现在也会通知,通知以编辑者为发起人。客户端 SDK 的CreateDataResult/UpdateDataResult同步声明这个键。packages/plugins/plugin-audit/src/audit-writers.ts的writeCommentMentions(更新时只判新增的 @)、packages/metadata-protocol/src/protocol.ts的createData/updateData、packages/spec/src/contracts/data-engine.ts的onMentionsWithheld。pnpm --filter @objectstack/plugin-audit exec vitest run src/mention-recipient-gate.integration.test.ts,预期 28 条全绿。What changes
The
@mentionrecipient gate withholds a notification from a mentioned user who cannot read the comment or its record. It only logged that, so the author believed the person had been told. As ruled (6523848208, letter A, disclosure accepted), the requester's own create and update answer now names who will not be notified, from the gate's own verdict: ids only, never the reason, never stored.Transport. No new path was built. The engine already hands every
after*hook the caller's own options bag onctx.input.options(the PHASE rule inhook.zod.ts:buildDriverOptionswidens the bag and never strips a key), andcreateData/updateDataalready collect in-process listeners from it (onFieldsDropped,onValidationAdvisory). This PR adds one more listener of that family.packages/spec).CreateDataResponseSchemaandUpdateDataResponseSchemadeclare an optionalwithheldMentions: string[], with one shared description (withheld by the mention gate, response-only, ids only, filled only by asys_commentwrite and only on the requester's own answer, omitted when empty, never stored). It is declared generically, the waywarningsis, because the protocol types one create answer and one update answer for every object, not one per object.CloneDataResponseSchemadoes not get it: the ruling names create and update only.WriteObservabilityOptions(contracts/data-engine.ts) declaresonMentionsWithheld?: (userIds: readonly string[]) => void. Its docblock says the engine never calls it, that it reaches the mention writer onctx.input.options, and that it never crosses the wire.HookUpdateOptionsnames it among the members it inherits.content/docs/references/api/protocol.mdxregenerated (gen:docs).mention-recipient-gate.ts:MentionGateInput.onWithheld(userId)is optional. The gate's existingwithhold()calls it for every withheld recipient that resolved to a user, whatever the reason. The reason stays in the log line. Who the gate admits is unchanged: the callback is called after the verdict and a throwing callback is swallowed.audit-writers.ts:writeCommentMentionsis registered onafterUpdateas well asafterInsert. On an update it judges only the entries the written row'smentionsgained overctx.previous, so a kept mention is never re-judged or re-notified. After the gate answers, it calls the write's ownonMentionsWithheldonce with the withheld ids (deduplicated, in the order named), and a throwing listener is logged and ignored. Thementionsparse moved into aparseCommentMentionshelper so both sides of the update read it one way.ctx.session.userId), who may be a parent-record editor rather than the author: they are named in the title (resolved fromsys_userviaresolveActorSnapshot) and are never notified themselves. A create keeps the comment'sauthor_id/author_name.createDataandupdateDatapassonMentionsWithheldand answerwithheldMentionsomit-when-empty. The set is local to the request, so no other request's answer can carry it.CreateDataResultandUpdateDataResultinpackages/client/src/index.tsdeclarewithheldMentions?: string[], mirroring the two schemas.ENGINE_UPDATE_OPTION_KEYSadmitsonMentionsWithheld, becauseengine.updaterefuses unknown option keys.inserthas no such allowlist. The drift pin inengine-unknown-option.test.tsnames the new member.content/docs/api/data-api.mdx(POST / PATCH) andcontent/docs/kernel/contracts/data-engine.mdx(WriteObservabilityOptions, a newonMentionsWithheldsection)..changeset/27703-withheld-mentions-answer.md:@objectstack/spec,@objectstack/plugin-audit,@objectstack/metadata-protocol,@objectstack/objectqland@objectstack/client, allminor(Metadata-protocol: addedtakes at least minor on every package the diff moves), with both declaration lines.Requester-only and never stored, and how each is pinned.
protocol-withheld-mentions-answer.test.ts"a nested write … adds nothing to the outer answer" and "each request answers only its own", and plugin-audit's "a comment written by a hook inside another write never reaches the outer write's listener".sys_commentdeclares no such field, the stored row read back as system carries only what the author wrote, and CAROL (a reader of the thread) reads the same row with no verdict about BOB. Pins: plugin-audit "nothing is stored", and objectql "nothing is stored: the persisted row carries no member beyond what was written".Tests
The first round ran on
9a38b6c0(andeb6b1469, which differs only by a merge oforigin/maintouching no file of this diff). The patch round after the contract review (be32a8da,51450e76) changed the describe and docblock wording, added the client mirror and the editor-as-actor behaviour; its runs are listed as such below.packages/spec/src/api/write-answer-withheld-mentions.test.tscovers four things. The member is accepted on both answers and an answer without it stays legal. Anything but an array of ids is refused (no per-user objects, no reason). The clone answer does not declare it. The listener type takes ids and may be absent.packages/objectql/src/protocol-withheld-mentions-answer.test.tsuses a realObjectQLand the realObjectStackProtocolImplementation. The one stand-in is the writer, anafter*hook. It pins five things.createData/updateDataanswer the hook's ids, deduplicated, and the answers conform. The key is absent when nothing was reported. Nothing is persisted. A nested write's report never reaches the outer answer. A second request is not told the first one's ids.mention-recipient-gate.integration.test.tsruns the kernel, SQLite,AuditPluginand the real recipient gate. It gains 11 cases:actorIdis CAROL and the title names her (patch round);onWithheldgets ids only (none for an unknown email or arole:entry);onWithheldchanges no verdict.audit-writers.test.ts"emits only to the recipients the gate admits" pinned the gate input exactly. It now also expectsonWithheld: expect.any(Function).engine-unknown-option.test.ts:onMentionsWithheldpasses onupdate, and the drift pin names it.Package suites and typecheck
pnpm --filter @objectstack/plugin-audit test: Test Files 67/67, Tests 1089/1089 (the first run caught theaudit-writers.test.tspin above, which was then fixed, and the file re-ran at 118/118).pnpm --filter @objectstack/metadata-protocol test: Test Files 284 passed, 4 skipped; Tests 21859 passed, 26 skipped.pnpm --filter @objectstack/objectql test: Test Files 495/495, Tests 9631/9631.pnpm --filter @objectstack/spec test: Test Files 757/757, Tests 22520 passed, 1 todo.typecheckfor@objectstack/spec,@objectstack/plugin-audit,@objectstack/metadata-protocoland@objectstack/objectql: all exit 0 (lock VERDICT command-exit 0), including each package'scheck:test-typecheck.51450e76:pnpm --filter @objectstack/plugin-audit exec vitest runTest Files 67/67, Tests 1090/1090;tsc --noEmitfor@objectstack/clientand@objectstack/plugin-auditexit 0; the spec contract test 7/7; the objectql transport and option tests 32/32.9a38b6c0: the spec contract tests 16/16, the objectql transport and option tests 32/32, and plugin-audit's gate integration andaudit-writers.test.ts145/145.Ablations (one-shot, through
scripts/ablation-replace.mjs, each restored to blob == HEAD)onMentionsWithheld(withheld);replaced by a no-opafterUpdateregistration deletedcreateData: answer key renamed (ablatedA2); metadata-protocol rebuilt, marker proven indist/createData: the per-request set hoisted to a process-wide one; rebuilt, marker proven indist/row.author_idplugin-audit imports
AuditPluginfrom source, so A1–A1c needed no build. The objectql transport test resolves@objectstack/metadata-protocolthroughdist/, so A2 and A3 rebuilt it on both legs and checked them withablation-dist-preflight.mjs.Acceptance notes
withheldMentionsholds the ids the gate judged. A token without@is taken as an id as written, so an id that names no user is judged, withheld, and listed like any other. A mention of an unknown email, or an audience expansion (role:/team:/owner_of:), resolves to no id and is withheld with nothing to give back. The picker only offers existing users, so the console does not produce these.messagingservice composed, no gate composed (fail closed, warned once), the gate itself throwing, and amessaging.emitfailing for an admitted user. The ruling scopes the member to the gate's withheld verdicts, and each of these failures is logged atwarnas before.createDataandupdateDatapass the listener, as ruled. A comment created throughcreateManyData/batchData, cloned, or written by a flow still notifies its readers and logs what it withheld. Its caller is not told.sys_commentadmits an edit by the author or by a holder of EDIT on the parent record, so the editor may not be the author. The editor is never notified and is named in the title; the author, if mentioned, is notified like anyone else.withheldMentionsin the three Discussion write callbacks, name the users in one sentence, mention chips) is the seat's follow-updomain:uicard once this key is onmain.Verification
Patch round, head
51450e76. Re-derived against the patched diff: the same 113 families. All 113 re-ran on51450e76, each with stdin from/dev/nulland its exit code recorded before any pipe, reconciled with--ran: 113 derived, 112 run, 1 NOT MEASURED, 0 unrun, 0 red. The one NOT MEASURED isspec check:skill-examples(exit 3, client SDK dist prerequisite), CI's.pnpm --filter @objectstack/spec check:generatedis green aftergen:docsregeneratedprotocol.mdxfor the new describe wording.First round, head
9a38b6c0. Gates were derived withnode scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackagainst this diff (113 families). Each ran with stdin from/dev/null, and each exit code was recorded before any pipe. The record is reconciled with--ran: 113 derived, 110 run, 3 NOT MEASURED, 0 unrun, 0 red.check:i18nneeds the CLI's build closure;check:dual-build-cjs-loadsneeds a whole-repopnpm build;spec check:skill-examplesneeds the client SDK dist.node scripts/check-plugin-teardown-shape.mjs --self-testfirst exited 3 because its pinned positive control621a4876was not in this shallow clone. After fetching that one commit it re-ran green (48 cases), and the record carries the re-run.pnpm --filter @objectstack/spec check:generated: all 14 artefacts up to date on9a38b6c0, after a rebuild of the merged source. The two regenerated artefacts arecontent/docs/references/api/protocol.mdxandpackages/spec/authorable-surface/api.json(two response keys).!in the title, no(narrowing)arm).Generated by Claude Code