Skip to content

feat(spec): a comment's author is told which mentioned users will not be notified, and a mention added by editing notifies - #28174

Merged
objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/project-thread-z0obcm
Oct 30, 2026
Merged

objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/project-thread-z0obcm

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

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 同步声明这个键。
  • 为什么改:以前闸门只在服务器日志里记一笔,作者以为对方已被通知,其实没有;编辑时加的 @ 谁也不通知。
  • 风险与回滚:只告诉发起这次请求的人本人,只给 id、不给原因,不落库;谁能收到通知的判定没变。回滚即 revert 本 PR,不读这个键的客户端不受影响。
  • 先看: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 @mention recipient 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 on ctx.input.options (the PHASE rule in hook.zod.ts: buildDriverOptions widens the bag and never strips a key), and createData / updateData already collect in-process listeners from it (onFieldsDropped, onValidationAdvisory). This PR adds one more listener of that family.

  • Spec (packages/spec).
    • CreateDataResponseSchema and UpdateDataResponseSchema declare an optional withheldMentions: string[], with one shared description (withheld by the mention gate, response-only, ids only, filled only by a sys_comment write and only on the requester's own answer, omitted when empty, never stored). It is declared generically, the way warnings is, because the protocol types one create answer and one update answer for every object, not one per object. CloneDataResponseSchema does not get it: the ruling names create and update only.
    • WriteObservabilityOptions (contracts/data-engine.ts) declares onMentionsWithheld?: (userIds: readonly string[]) => void. Its docblock says the engine never calls it, that it reaches the mention writer on ctx.input.options, and that it never crosses the wire. HookUpdateOptions names it among the members it inherits.
    • content/docs/references/api/protocol.mdx regenerated (gen:docs).
  • plugin-audit.
    • mention-recipient-gate.ts: MentionGateInput.onWithheld(userId) is optional. The gate's existing withhold() 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: writeCommentMentions is registered on afterUpdate as well as afterInsert. On an update it judges only the entries the written row's mentions gained over ctx.previous, so a kept mention is never re-judged or re-notified. After the gate answers, it calls the write's own onMentionsWithheld once with the withheld ids (deduplicated, in the order named), and a throwing listener is logged and ignored. The mentions parse moved into a parseCommentMentions helper so both sides of the update read it one way.
      • On an edit, the actor is the editor (ctx.session.userId), who may be a parent-record editor rather than the author: they are named in the title (resolved from sys_user via resolveActorSnapshot) and are never notified themselves. A create keeps the comment's author_id / author_name.
  • metadata-protocol. createData and updateData pass onMentionsWithheld and answer withheldMentions omit-when-empty. The set is local to the request, so no other request's answer can carry it.
  • client. CreateDataResult and UpdateDataResult in packages/client/src/index.ts declare withheldMentions?: string[], mirroring the two schemas.
  • objectql. ENGINE_UPDATE_OPTION_KEYS admits onMentionsWithheld, because engine.update refuses unknown option keys. insert has no such allowlist. The drift pin in engine-unknown-option.test.ts names the new member.
  • Docs. content/docs/api/data-api.mdx (POST / PATCH) and content/docs/kernel/contracts/data-engine.mdx (WriteObservabilityOptions, a new onMentionsWithheld section).
  • Changeset. .changeset/27703-withheld-mentions-answer.md: @objectstack/spec, @objectstack/plugin-audit, @objectstack/metadata-protocol, @objectstack/objectql and @objectstack/client, all minor (Metadata-protocol: added takes at least minor on every package the diff moves), with both declaration lines.

Requester-only and never stored, and how each is pinned.

  • The listener exists only on the options of the request that wrote the comment. A nested write that a hook makes carries its own options. Pins: 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".
  • Nothing is stored. sys_comment declares 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".
  • The listener is a function in an in-process bag. A function cannot be serialized, so no REST or SDK caller can pass one or receive one. The only thing on the wire is the answer member.

Tests

The first round ran on 9a38b6c0 (and eb6b1469, which differs only by a merge of origin/main touching 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.

  • New contract pins. packages/spec/src/api/write-answer-withheld-mentions.test.ts covers 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.
  • Transport, real engine + real protocol. packages/objectql/src/protocol-withheld-mentions-answer.test.ts uses a real ObjectQL and the real ObjectStackProtocolImplementation. The one stand-in is the writer, an after* hook. It pins five things. createData / updateData answer 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.
  • The verdict, real gate. mention-recipient-gate.integration.test.ts runs the kernel, SQLite, AuditPlugin and the real recipient gate. It gains 11 cases:
    • a create tells its own listener the withheld ids, in the order named, while the reader is still notified;
    • a user named by email is reported by id, once;
    • the listener is never called when nobody is withheld, for the author, for an unknown address or for an audience expansion;
    • nothing is stored, and a reader of the thread sees nothing about anyone else;
    • a hook's nested comment never reaches the outer listener;
    • an edit that adds mentions notifies the new reader and reports only the withheld new ones;
    • a kept mention is not re-judged, and a body-only edit judges nothing;
    • an editor who is not the author (CAROL edits ALICE's comment) is the actor: ALICE is notified, CAROL is not, the event's actorId is CAROL and the title names her (patch round);
    • a throwing listener breaks neither the write nor the notification;
    • the gate's onWithheld gets ids only (none for an unknown email or a role: entry);
    • a throwing onWithheld changes no verdict.
  • An existing pin updated as a consequence of the change. audit-writers.test.ts "emits only to the recipients the gate admits" pinned the gate input exactly. It now also expects onWithheld: expect.any(Function).
  • engine-unknown-option.test.ts: onMentionsWithheld passes on update, 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 the audit-writers.test.ts pin 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.
  • typecheck for @objectstack/spec, @objectstack/plugin-audit, @objectstack/metadata-protocol and @objectstack/objectql: all exit 0 (lock VERDICT command-exit 0), including each package's check:test-typecheck.
  • Patch round, on 51450e76: pnpm --filter @objectstack/plugin-audit exec vitest run Test Files 67/67, Tests 1090/1090; tsc --noEmit for @objectstack/client and @objectstack/plugin-audit exit 0; the spec contract test 7/7; the objectql transport and option tests 32/32.
  • On 9a38b6c0: the spec contract tests 16/16, the objectql transport and option tests 32/32, and plugin-audit's gate integration and audit-writers.test.ts 145/145.
Ablations (one-shot, through scripts/ablation-replace.mjs, each restored to blob == HEAD)
# Mutation Expected Observed
A1 writer: onMentionsWithheld(withheld); replaced by a no-op listener pins red 4 failed / 27 (create, email, both edit cases)
A1b writer: the update's added-only filter removed edit pins red 2 failed / 27 (both edit cases)
A1c writer: the afterUpdate registration deleted added-mention pin red 1 failed / 27
A2 createData: answer key renamed (ablatedA2); metadata-protocol rebuilt, marker proven in dist/ transport pins red 2 failed / 7; restore leg rebuilt, marker proven absent, 7/7
A3 createData: the per-request set hoisted to a process-wide one; rebuilt, marker proven in dist/ per-request pins red 3 failed / 7 (control, nested, second-request); restore leg rebuilt, absent, 7/7
A4 writer (patch round): the edit's actor reverted to row.author_id editor pin red 1 failed / 28 (the editor case)

plugin-audit imports AuditPlugin from source, so A1–A1c needed no build. The objectql transport test resolves @objectstack/metadata-protocol through dist/, so A2 and A3 rebuilt it on both legs and checked them with ablation-dist-preflight.mjs.

Acceptance notes

  • Entries that resolve to no id are not listed. withheldMentions holds 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.
  • Failures outside the gate's verdict are not reported. These are: no messaging service composed, no gate composed (fail closed, warned once), the gate itself throwing, and a messaging.emit failing for an admitted user. The ruling scopes the member to the gate's withheld verdicts, and each of these failures is logged at warn as before.
  • Batch, clone and flow writes do not answer it. Only createData and updateData pass the listener, as ruled. A comment created through createManyData / batchData, cloned, or written by a flow still notifies its readers and logs what it withheld. Its caller is not told.
  • The edit's actor. On an edit, the editor is the actor, not the comment's author: sys_comment admits 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.
  • The ui half (read withheldMentions in the three Discussion write callbacks, name the users in one sentence, mention chips) is the seat's follow-up domain:ui card once this key is on main.

Verification

Patch round, head 51450e76. Re-derived against the patched diff: the same 113 families. All 113 re-ran on 51450e76, each with stdin from /dev/null and 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 is spec check:skill-examples (exit 3, client SDK dist prerequisite), CI's. pnpm --filter @objectstack/spec check:generated is green after gen:docs regenerated protocol.mdx for the new describe wording.

First round, head 9a38b6c0. Gates were derived with node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack against 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.

  • NOT MEASURED, prerequisite not met (exit 3, the gate refusing before it reads anything). These are CI's:
    • check:i18n needs the CLI's build closure;
    • check:dual-build-cjs-loads needs a whole-repo pnpm build;
    • spec check:skill-examples needs the client SDK dist.
  • node scripts/check-plugin-teardown-shape.mjs --self-test first exited 3 because its pinned positive control 621a4876 was 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 on 9a38b6c0, after a rebuild of the merged source. The two regenerated artefacts are content/docs/references/api/protocol.mdx and packages/spec/authorable-surface/api.json (two response keys).
  • Full dogfood: not owed (no ! in the title, no (narrowing) arm).
  • The full farm is CI's. The PR's check-runs are the evidence for every family outside the derived set.

Generated by Claude Code

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 5 package(s): @objectstack/client, @objectstack/metadata-protocol, @objectstack/objectql, @objectstack/plugin-audit, @objectstack/spec, touching 29 documentable anchor(s). ⚠️ 2 changed file(s) yielded no anchor (packages/spec/authorable-surface/api.json, packages/spec/src/data/hook-api.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

34 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 35f205514ce93e1871ff2e238529d7da5423c893.

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

What this run could not see
  • 2 changed file(s) yielded no anchor (packages/spec/authorable-surface/api.json, packages/spec/src/data/hook-api.ts) — pages documenting those are invisible to this run
  • 1 cross-cutting symbol(s) contributed no route anchor: updateData (4 routes)
  • the SDK route bridge reached 58 of 210 client-bound route-ledger rows — the other 152 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 152: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 97 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 — 178 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 35f205514ce93e1871ff2e238529d7da5423c893 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 7f4c840e4d651abdb9434258cce9c7d85a14c797 — the merge of head 51450e766c971ee903fccf2cfb3c5b3a2188f5d7 into base 35f205514ce93e1871ff2e238529d7da5423c893, 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 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

⚠️ 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 35f205514ce93e1871ff2e238529d7da5423c893 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@github-actions github-actions Bot added documentation Improvements or additions to documentation protocol:data tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Oct 30, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#2 · os-tesla · session_01L9qibx5r5nhDMwpRs4SL6D

Contract-review-claim: session_01L9qibx5r5nhDMwpRs4SL6D · head 9a38b6c · 2026-10-30T15:19Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#2 · os-tesla · session_01L9qibx5r5nhDMwpRs4SL6D

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 9a38b6c0296098d1b52a9c09482f3a7ed4f36483
Local-runs: none
Scope: packages/spec/src/api/protocol.zod.ts, packages/spec/src/contracts/data-engine.ts, packages/spec/src/data/hook-api.ts + packages/metadata-protocol/src/protocol.ts, packages/plugins/plugin-audit/src/audit-writers.ts, packages/plugins/plugin-audit/src/mention-recipient-gate.ts, packages/plugins/plugin-audit/src/comment-access-hooks.ts, packages/plugins/plugin-audit/src/audit-hook-object-scope.test.ts, packages/objectql/src/engine.ts, packages/objectql/src/engine-driver-options.ts, packages/spec/src/data/hook.zod.ts, packages/rest/src/crud-routes.ts, packages/client/src/index.ts, ui/packages/data-objectstack/src/index.ts (cited, read to judge; not reviewed)

Governing ruling: card comment 6523848208 (maintainer 「27703 同意」, letter A). Judged against: a response-only member on the sys_comment create and update answer, the requester's own request only, ids only, no reason, never stored; the edit-time mention folded into the server end; the gate's verdict reused with no second derivation of readability; the gate admits the same people as before.

① Derived judgments

Each accept-set or public-surface change the net diff implies, named right or wrong against the ruling and the live tree.

  1. CreateDataResponseSchema and UpdateDataResponseSchema (protocol.zod.ts) gain withheldMentions: z.array(z.string()).optional() with one shared description. Right. Optional and omit-when-empty keeps every existing client's reading; z.array(z.string()) admits ids only, so a per-user object carrying a reason is refused by the schema itself (pinned in write-answer-withheld-mentions.test.ts). CloneDataResponseSchema is untouched, as the ruling names create and update only.
  2. packages/spec/authorable-surface/api.json gains api/CreateDataResponse:withheldMentions and api/UpdateDataResponse:withheldMentions; content/docs/references/api/protocol.mdx regenerated. Right. Generated artefacts of 1; the Governed Surface Queue Guard and Spec property liveness check runs are success.
  3. WriteObservabilityOptions.onMentionsWithheld?: (userIds: readonly string[]) => void (contracts/data-engine.ts). Right. A function, so it cannot enter the serializable Zod bags (the same wall onFieldsDropped / onValidationAdvisory sit behind, data-engine.test.ts L269–315); HookUpdateOptions is Omit<EngineUpdateOptions,…> & WriteObservabilityOptions, so the hook-API bag inherits it with no type change — the hook-api.ts hunk is a docblock word list only, and that is the correct size of change there.
  4. ENGINE_UPDATE_OPTION_KEYS admits onMentionsWithheld (engine.ts L719), with the drift pin in engine-unknown-option.test.ts naming it as the fourth contract member. Right. rejectUnknownEngineOptions is called for find, findOne, update, delete, aggregate and not for insert (read at head), so the insert path needs no allowlist line.
  5. Transport: createData / updateData build a per-call Set, pass onMentionsWithheld in the engine bag, and spread withheldMentions only when the set is non-empty. Right. Read in the engine: on insert each row context is built with input: { data, options: opCtx.options } (L14929) where opCtx.options is the caller's bag verbatim (L14647), then rowCtx.input.options = buildDriverOptions(object, ctx, optionsBase) (L15384–15396); on by-id update input: { id, data, options: opCtx.options } (L16476) then buildDriverOptions (L16959). buildDriverOptions either returns base unchanged or { ...base, +driver keys } (engine-driver-options.ts L164–235), so the listener survives into every after* context, exactly as the PHASE rule in hook.zod.ts L879–888 states. A nested write a hook makes calls engine.insert with its own bag, so its verdicts cannot reach the outer set.
  6. MentionGateInput.onWithheld?: (userId: string) => void; withhold() calls it only when a resolved userId is present, after the log line, inside its own try/catch. Right. The admission computation (candidates → readableIn on source then thread → admitted) is byte-for-byte what main had; the new lines are appended to the withhold closure only. Same people admitted as before; no second derivation of readability anywhere in the diff.
  7. writeCommentMentions also registered on afterUpdate for sys_comment, judging only the entries the written row's mentions gained over ctx.previous. Right. previous is bound unconditionally on the by-id branch (Action-body writes have no not-found gate: ctx.api.object().update() against a nonexistent id answers 400 (or worse) instead of 404, while the protocol and callData paths both gate correctly #7867, L16681) from readUpdatePriorRow, which returns every declared column (mentions is declared), and on the predicate branch per row via buildPerRowAfterContexts now that hasHooksFor('afterUpdate','sys_comment') is true. The existing registration pins in audit-hook-object-scope.test.ts filter on before* (L487–493) and on afterInsert (L577–580), so they stay green; the comment at L485–486 ("on afterInsert") is now stale prose in a non-hits file.
  8. REST: crud-routes.ts answers res.status(201).json(result) / res.json(result) with the protocol answer verbatim (L298–304, L483–488), so the key reaches the wire with no REST change. Right, and the first wire consumer (ui/packages/data-objectstack/src/index.ts) already reads droppedFields / warnings structurally off the answer (L4060–4070), so it can read withheldMentions the same way when the ui card lands.
  9. Client SDK: CreateDataResult / UpdateDataResult in packages/client/src/index.ts (L473, L528) are hand-written mirrors headed /** Spec: CreateDataResponseSchema */ and carry droppedFields and warnings but not withheldMentions. Wrong by omission — the typed SDK surface now lags the spec it says it mirrors. No parity gate pins it (none found under scripts/, packages/lint, packages/spec/src), so nothing goes red; see ④ should-fix 2.
  10. Batch (createManyData / batchData), clone and flow writes do not pass the listener. Right — the ruling names create and update; the dev report records the gap as an out-of-scope finding with the seat as carrier.

Check runs on 9a38b6c0 (42, pages 1–2 read): 13 success — Auto Label, Dogfood Regression Gate, Plan Test Core shards, Lint · scoped · tooling self-tests, Lint · PM dispatch-gates, filter, Governed Surface Queue Guard, Check Changeset, Check Documentation Links, Check PR Size, PR-body guards, Flag docs affected by code changes, Spec property liveness. 7 skipped (opt-in or matrix placeholders). 22 in_progress at review time — Test Core 1/8–8/8, Build Core, Build Docs, Build UI Deps, Live E2E UI, Type Check · source gates / consumer gates / debt ledger / workspace, Lint · ESLint, Lint · CI release & engine gates, Lint · scoped · slot lookup & corpus, Lint · scoped · query-options erasure, Lint · repo & tooling gates, Lint · docs & code guards. 0 failure. The verdict below judges the completed runs and the tree; a red among the in-progress families reopens it.

② Semver level

.changeset/27703-withheld-mentions-answer.md: @objectstack/spec, @objectstack/plugin-audit, @objectstack/metadata-protocol, @objectstack/objectql — all minor. Matches what the diff publishes: spec adds an optional response member and an optional contract member (additive); metadata-protocol answers a new optional key (additive); objectql accepts a new option key it previously refused (additive); plugin-audit gains behaviour (edit-time mention notifications, a new optional gate input) with no removed or narrowed surface. No major is owed: nothing is removed, no existing key changes shape, the gate admits the same set. @objectstack/rest and @objectstack/client have no source change in the diff, so no changeset is owed for them in this PR (a follow-up that updates the client mirrors, ④ should-fix 2, owes its own). Check Changeset is success. Release-owned paths (content/docs/releases/, packages/*/CHANGELOG.md) are untouched.

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; Metadata-protocol: added likewise.

③ Boundary flags

  • Dev report 6526285418 open_questions: []. Nothing to escalate.
  • Deviations (5), each answered: (a) file surface beyond the claim's two files — covered by claim amendment 6524793510 (data-engine.ts, protocol.ts, engine.ts) plus docblock/test/docs additions; none under ui/**, no governed path, no stored sys_comment field, no change to whom the gate admits — the claim's ⛔ lines hold. (b) sweep timing vs later commits — the derived set is CI's to confirm; the relevant families are among the in-progress runs. (c) worktree handling — process only. (d) test:repo not run locally — CI's (Test Core in progress). (e) a retried push — no residue in the tree.
  • Out-of-scope findings (3): batch/clone/flow not answering — consistent with the ruling, carrier noted; non-author edit actor — taken up in ④ should-fix 3; the ui half card — the seat files it once the key is on main, as the ruling orders.
  • Docs-drift bot (PR comment 6526283540): two changed files yielded no anchor (api.json, hook-api.ts). Read by hand: api.json is generated from 1 and hook-api.ts is a docblock word list over a type that already inherits the member. The two hand-written pages (content/docs/api/data-api.mdx, content/docs/kernel/contracts/data-engine.mdx) are not release-owned and state the rule as built (requester-only, ids only, omit-when-empty, update judges added mentions only).
  • The maintainer's disclosure point (triage 6517777140) is answered by the ruling itself (accepted); the tree gives exactly the accepted bit — one id per user the requester named, no reason — and nothing wider (the gate's reason type is still only logged; the schema refuses any object per user).
  • Pending gate families: the 22 in-progress check runs named in ①.

④ Design judgment

packages/spec/src/api/protocol.zod.ts — against ruling 6523848208 and its first consumers (createData / updateData → crud-routes.ts → data-objectstack). The member is where the ruling puts it (the data-write answer type), optional, ids only, one description for both answers so they cannot drift, and absent from the clone answer. Tried to break it: (i) a reason riding along — refused by z.array(z.string()); (ii) storage — sys_comment declares no such field and the answer is assembled from a per-call Set, never written (pinned against the real gate and SQLite: the stored row read back as system and as CAROL carries nothing); (iii) another request's answer — the set is local to the call and the listener rides the caller's own bag, so neither a nested hook write nor a sibling request can add to it (pinned in both test files). Holds. Two precision defects in the description, below.

packages/spec/src/contracts/data-engine.ts — against its first consumer, the plugin-audit writer reading ctx.input.options, and against the protocol that passes it. The docblock's three claims were each verified in the engine: never called by the engine (no onMentionsWithheld reference in engine.ts outside the allowlist); reaches after* hooks on ctx.input.options through buildDriverOptions' additive widening (insert L15384–15396, update L16959, per-row contexts from the batch context); a throwing listener is caught and logged by the writer (audit-writers.ts L2612–2618). The consumer calls it once per written comment and only when at least one id was withheld (L2613), so a listener never sees an empty list. Holds.

packages/spec/src/data/hook-api.ts — a one-line docblock list; the type HookUpdateOptions already carries the member through WriteObservabilityOptions. Holds; nothing to break.

Cited code the hits make claims about (read, not reviewed; findings named where they bear on the contract):

  • mention-recipient-gate.ts: the verdict path is unchanged; onWithheld fires after the log line, only with a resolved id, inside try/catch. The ruling's "gate's verdict reused" holds literally.
  • audit-writers.ts: the writer dedups the ids and calls the write's own listener before emitting; on update it diffs against ctx.previous, so a kept mention is neither re-judged nor re-told (pinned). The messaging dedupKey collab.mention:${commentId}:${uid} additionally stops a double notification should a kept mention ever be re-spelled (email on create, id on edit) — belt and braces, not a gap.
  • comment-access-hooks.ts L18–30: the sys_comment beforeUpdate rule admits the comment's author or a holder of EDIT on the parent record. This is what makes should-fix 3 reachable.
  • resolveMentionedUser L285–304: any non-email token is taken as a user id without an existence read, so a mention of a non-existent id is judged (cannot_read_source) and reported back in withheldMentions. The PR body says such an entry "has no id to give back"; the tree does give it back. Harmless under the ruling — the requester typed the token, and user existence is already readable through the picker's sys_user directory read — but the PR body's account is wrong on this point. Observation, no fix owed.

Must-fix: none.

Should-fix 1 — protocol.zod.ts WRITE_ANSWER_WITHHELD_MENTIONS_DESCRIPTION and the data-engine.ts docblock overstate the cause and the recipient. They say the ids were withheld "because they cannot read the comment or its record", but withhold() reports every reason that has a resolved user — no_source_record, no_comment_id, source_record_missing, grants_unavailable as well as the two readability reasons — and they say "the author is told", while on an update the answer goes to the requester, who may be a parent-record editor (above). The fact conveyed ("will not be notified") stays true in every case, so this is wording, not behaviour; but the description is the contract text the ui half will quote. Say "whose mention notification the gate withheld" and "the requester".

Should-fix 2 — packages/client/src/index.ts CreateDataResult / UpdateDataResult (declared as mirrors of the two schemas) lack withheldMentions?: string[]. The wire carries the key and data-objectstack reads answers structurally, so nothing is blocked, but the typed SDK surface now disagrees with the spec it names, and the ui card will otherwise have to cast. One line each plus a @objectstack/client minor changeset — this PR or a follow-up before the ui card.

Should-fix 3 — audit-writers.ts writeCommentMentions on afterUpdate keeps actorId = row.author_id and actorName = row.author_name. For the accepted scenario (the author edits their own comment) that is correct. For an edit by a parent-record editor (admitted by comment-access-hooks.ts), the new notifications are titled "{author} mentioned you" for a mention the editor added, and the author-skip excludes the wrong person. This path did not exist before (edits notified nobody), so it is new behaviour of this PR, not an inherited shape. ctx.session.userId is already read into sess two lines above; on the update branch use it as the actor when present. The dev report names the case; it should be closed here or on a card with a pointer, not left as a note.

Observations (no fix owed under the ruling): when the gate throws, no gate or no messaging is composed, or emit fails for an admitted user, nothing is told and the warn line is the only trace — the ruling scopes the member to the gate's verdict, and the PR says so; the stale "on afterInsert" comment at audit-hook-object-scope.test.ts L485–486 is the lane seat's.

Implemented-by: claude/project-thread-z0obcm
Reviewed-by: fable-subagent-of-session_01L9qibx5r5nhDMwpRs4SL6D

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
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#2 · os-tesla · session_01L9qibx5r5nhDMwpRs4SL6D

Contract-review-claim: session_01L9qibx5r5nhDMwpRs4SL6D · head 51450e7 · 2026-10-30T16:27Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#2 · os-tesla · session_01L9qibx5r5nhDMwpRs4SL6D

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 51450e766c971ee903fccf2cfb3c5b3a2188f5d7
Local-runs: none
Scope: packages/spec/src/api/protocol.zod.ts, packages/spec/src/contracts/data-engine.ts, packages/spec/src/data/hook-api.ts + packages/plugins/plugin-audit/src/audit-writers.ts, packages/plugins/plugin-audit/src/mention-recipient-gate.integration.test.ts, packages/plugins/plugin-audit/src/comment-access-hooks.ts, packages/client/src/index.ts, packages/objectql/src/engine.ts, .changeset/27703-withheld-mentions-answer.md (cited, read to judge; not reviewed)

Delta review of record 6526608625 (PASS on 9a38b6c0296098d1b52a9c09482f3a7ed4f36483). Judged: the two patch commits be32a8da and 51450e76 (git diff 9a38b6c0…51450e76: 9 files, +72/−24), the updated PR body, and the check runs on 51450e76. Everything the first record found right is carried forward unchanged unless named below; the delta touches no transport, gate-verdict or schema-shape line.

① Derived judgments

  1. WRITE_ANSWER_WITHHELD_MENTIONS_DESCRIPTION (protocol.zod.ts) now says "WITHHELD by the mention recipient gate, so they will not be notified" and "the requester's own answer … the requester is told". Right — the causal clause and the recipient now match what withhold() reports (every reason with a resolved id) and who comment-access-hooks.ts admits to edit (author or parent-record editor). The schema shape (z.array(z.string()).optional()) is untouched, so no accept-set moves; the write-answer-withheld-mentions.test.ts pins (/never stored/, /never the reason/, both descriptions equal) still match the new text. protocol.mdx regenerated with the identical sentence on both rows. Should-fix 1 of 6526608625: landed.
  2. data-engine.ts docblock: "the users the writer named … whatever the gate's reason (most often that they cannot read …) … on the requester's own answer". Right; same correction, type unchanged. Should-fix 1: landed.
  3. packages/client/src/index.ts: CreateDataResult and UpdateDataResult gain withheldMentions?: string[] with a docblock in the style of the warnings member; CloneDataResult untouched, mirroring the schemas. Right. @objectstack/client: minor added to the changeset. Should-fix 2 of 6526608625: landed.
  4. audit-writers.ts writeCommentMentions: on afterUpdate the actor is ctx.session.userId when present, else row.author_id; actorName stays row.author_name when the editor is the author, otherwise it is read through resolveActorSnapshot(ctx.api, editorId).name when api.sudo exists, else null. Right, and verified against the engine: the by-id update context carries session: buildSession(opCtx.context) and api: buildHookApi(opCtx.context) (engine.ts L16490–16510), per-row contexts are built from that batch context; resolveActorSnapshot is the existing actor reader (L1759), cached 30 s and wrapped in .catch(() => NO_ACTOR_SNAPSHOT), so it cannot throw out of the hook and fail the edit; buildHookApi returns a ScopedContext, which has sudo(). On insert nothing changes (editorId is null outside afterUpdate). Should-fix 3 of 6526608625: landed.
  5. New integration case "an edit by someone other than the author makes the EDITOR the actor": CAROL edits ALICE's comment adding [ALICE, CAROL, BOB]; expects audience [[ALICE]], actorId: CAROL, payload.actorName: CAROL.id, told: [[BOB]]. Right as a pin of the writer: the fixture inserts every sys_user with name: u.id, so the title-field read yields CAROL.id; ALICE (the author) is a recipient, CAROL (the editor) is skipped, BOB (ORG_B) is withheld and told to CAROL's own listener. Note (not a defect): the harness composes no security or sharing service, so canEditParent falls to sharingAndMasterAdmit (comment-access-hooks.ts L734–739) and CAROL's edit is admitted by the degraded parent-read path, not by a real EDIT grant — the case pins the writer's actor rule, not the admission rule, which is what it claims to pin.
  6. Docs: data-api.mdx POST paragraph and data-engine.mdx onMentionsWithheld section reworded to "the mention gate withheld them … requester's own answer". Right; the PATCH paragraph ("the same way, for the mentions the update added") still holds.
  7. Changeset body: "requester's own answer", the client bullet, and the editor-as-actor sentence added. Right. The changeset heading still reads "a comment's author is told" — true for the common case, and headings are not contract text; observation only.

Check runs on 51450e76 (46, pages 1–2 read; several names appear twice because the workflow was re-triggered — the completed row of each pair is the one counted): 14 success — PR-body guards (×2), Auto Label, Dogfood Regression Gate, Plan Test Core shards, Lint · PM dispatch-gates, Lint · scoped · tooling self-tests, Check Changeset, Check PR Size, Governed Surface Queue Guard, filter, Spec property liveness, Flag docs affected by code changes, Check Documentation Links. 9 skipped (opt-in/matrix placeholders and the superseded duplicates of Auto Label / Check PR Size). 23 in_progress at review time — Test Core 1/8–8/8, Check Changeset (re-run), Build Core, Build Docs, Build UI Deps, Live E2E UI, Type Check · source gates / consumer gates / debt ledger / workspace, Lint · ESLint, Lint · CI release & engine gates, Lint · scoped · slot lookup & corpus, Lint · scoped · query-options erasure, Lint · repo & tooling gates, Lint · docs & code guards. 0 failure. The families that read the delta's prose (check:generated for protocol.mdx, the client typecheck, plugin-audit's Test Core shard) are among the in-progress ones; a red there reopens this record.

② Semver level

Changeset now lists @objectstack/spec, @objectstack/plugin-audit, @objectstack/metadata-protocol, @objectstack/objectql, @objectstack/client, all minor. Matches the delta: the only new package the diff moves is @objectstack/client, with an additive optional member on two result interfaces — minor, not patch, since a type surface widened. No package's level needs to rise: the actor change in plugin-audit alters the attribution of notifications on a path that did not notify before this PR, so it is still additive behaviour under the same minor. Check Changeset is success on the completed row. Clause-②: yes (unchanged — the served key is the same); Metadata-protocol: added (unchanged). Release-owned paths untouched.

③ Boundary flags

  • The three should-fixes of 6526608625 are each answered in the tree (① items 1–5); none was declined or deferred to a card.
  • The PR body's acceptance note "Entries that resolve to no id are not listed" now says what the tree does (a bare token is taken as an id and listed when withheld), closing the account mismatch the first record observed.
  • The PR body's actor paragraph ("the editor is the actor … the author, if mentioned, is notified like anyone else") matches audit-writers.ts L2573–2585 as read.
  • Patch-round verification in the PR body: 113 families re-derived and re-run, 1 NOT MEASURED (spec check:skill-examples, client dist prerequisite) — CI's Build Core + lint families are in progress and cover it; ablation A4 (actor reverted → the new case red) is the right killing mutant for ① item 5.
  • No new open_questions; the dev report has not been re-posted for the patch round (the PR body carries the account). Nothing to escalate.
  • In-progress gate families: the 23 named in ①.

④ Design judgment

protocol.zod.ts — the description now states the gate's verdict as the cause and the requester as the recipient, which is exactly the ruling's text ("whose notification was withheld by the mention gate … the author's own request only", where the request's maker is the one answered). Tried to break: the new wording does not promise a reason or a per-user object; it still says "ids only, never the reason", "never stored", "Present ONLY when …". The one-description-for-two-answers rule survives (pinned). Holds.

data-engine.ts — the docblock's behavioural claims (engine never calls it; reaches the writer on ctx.input.options; writer catches a throwing listener; nested writes carry their own bag) are unchanged and were verified on the first head; the delta changes only the cause/recipient sentences. Holds.

hook-api.ts — unchanged in the delta. Holds.

Cited code — the actor change (audit-writers.ts L2573–2585) and its test, tried against the scenarios it is accepted against:

  • Author edits own comment: editorId === row.author_id → actorId is the author, actorName is row.author_name with no extra read. Byte-identical outcome to 9a38b6c0. Holds.
  • Parent-record editor edits another's comment and adds mentions: editor is actorId (named in the title, skipped as recipient); the author is a recipient like anyone else; the editor's own listener is told the withheld ids of the users the editor named. The disclosure stays "one bit per user the requester named", to the requester — within letter A. Holds.
  • System or flow edit (no session.userId): editorId null → author as actor, as before. Holds.
  • Missing or unreadable editor row: readActorSnapshot returns NO_ACTOR_SNAPSHOT (name null) → the anonymous title; .catch guarantees the write and the notifications proceed. Holds.
  • Predicate (multi) update of sys_comment: per-row contexts inherit the batch context's session/api, so the same rule applies per row. Holds.
  • The 30 s actor-snapshot cache is shared with the activity mirror; a renamed editor may be titled by the old name for up to 30 s. Pre-existing property of that reader, not introduced here. Observation.
  • payload.actorName expectation CAROL.id depends on the fixture's name: u.id; the assertion is honest but would read more clearly with a distinct display name. Observation, test-prose only.

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 sharingAndMasterAdmit path in the harness rather than a real EDIT grant, which is fine for a writer pin; the stale "on afterInsert" comment at audit-hook-object-scope.test.ts L485–486 noted in the first record is still there (lane seat's file).

Implemented-by: claude/project-thread-z0obcm
Reviewed-by: fable-subagent-of-session_01L9qibx5r5nhDMwpRs4SL6D

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#2 · os-tesla · session_01L9qibx5r5nhDMwpRs4SL6D

维护者速读

  • 改了什么: 在记录讨论里 @ 一个看不到这条讨论的同事时,服务端仍然不通知他,但现在会在作者自己这次保存的返回里列出这些人的 id(withheldMentions,只给 id、不给原因、不落库)。编辑评论时新加的 @ 也会被判定和通知;通知里的“谁 @ 了你”是实际编辑的人,不再固定写原作者。
  • 为什么改: 以前被拦下的通知只写日志,作者以为对方已经知道了。这是你 13:21 裁定的方案 A。
  • 风险与回滚: 返回体只多一个可选键,不读它的客户端看到的结果不变;谁能收到通知的判定没有变。回滚即 revert。界面上“某某不会收到通知”的提示是后续 ui 卡。
  • 先看: packages/plugins/plugin-audit/src/audit-writers.ts(writeCommentMentions 的插入与更新两路)、packages/metadata-protocol/src/protocol.ts(createData / updateData 的回答)、packages/spec/src/api/protocol.zod.ts。
  • 两分钟验证: pnpm --filter @objectstack/plugin-audit exec vitest run src/mention-recipient-gate.integration.test.ts,预期全绿,其中包括“非作者编辑者新加 @”这一条。
  • 需要你做的: 无。不属于受管面,契约复审两轮 PASS,由席位落地。
  • 席位意见: ACCEPT,可落地。

席位核对 · ACCEPT · domain:spec seat 2 (#18549) · 2026-10-30T16:48Z

Head 51450e766c971ee903fccf2cfb3c5b3a2188f5d7. Card #27703, claim 6524736722 + surface amendment. Ruling-ref 6523848208 (letter A).

  • Shape: draft to main, made by the relay; Fixes #27703; Clause-②: yes, Metadata-protocol: added, Skills-docs: none (a response-only member, nothing a metadata author writes; taught in content/docs in this PR). Changeset: @objectstack/spec, plugin-audit, metadata-protocol, objectql, client all minor.
  • Contract review: seat-run at CONTRACT_REVIEW_TIER (the maintainer's 「你有 fable,可以自己契约复审」), reviewer an isolated subagent, not the drafter. PASS 6526608625 on 9a38b6c0 with three should-fixes (wording of cause/recipient, client SDK mirror, editor-as-actor on afterUpdate); all three landed in a patch round, delta PASS 6527914328 on this head with no must-fix and no new should-fix.
  • Diff read by the seat: the non-hit files (metadata-protocol transport, objectql allowlist line, plugin-audit writer and gate callback, docs, changeset). The listener rides the write's own options bag, so a nested write's verdicts never reach this answer; nothing is stored on sys_comment; the gate's admission code is unchanged.
  • Acceptance notes: the stale "on afterInsert" comment at audit-hook-object-scope.test.ts L485–486 and the changeset heading's word "author" (the body says requester) — prose only, no card. The ui half (name the withheld users in one sentence; mention chips) is filed by the seat once the key is on main, per the ruling.
  • Gates: check-runs on this head 41 success, 11 skipped, 0 red, Test Core 3/8 still running at this stamp; auto-merge waits for it. mergeable_state blocked only on that check. check-governed-merges --branch: NOT governed, 18 paths, +643/−31.
  • Authority: maintainer standing go-ahead 「按 pm-dispatch 审过的pr你可以自主落地」 (2026-10-30T14:20Z, project thread).
  • Landing: pr_ready + automerge_enable in this act.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 30, 2026 16:49
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 30, 2026 16:49
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 7811c3f Oct 30, 2026
55 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-z0obcm branch October 30, 2026 17:15
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 protocol:data 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.

comments: the @mention picker offers a member who cannot read the thread, and the author is never told that person will not be notified

1 participant