Skip to content

remove(plugin-audit): drop kernel-built-in assignment notifications (#3403) - #3404

Merged
os-zhuang merged 1 commit into
mainfrom
claude/issue-3403-e529bb
Jul 22, 2026
Merged

remove(plugin-audit): drop kernel-built-in assignment notifications (#3403)#3404
os-zhuang merged 1 commit into
mainfrom
claude/issue-3403-e529bb

Conversation

@baozhoutao

Copy link
Copy Markdown
Contributor

Closes#3403. Takes over and closes#3402.

背景

上传文件会刷「系统文件 "xxx" 已分配给你」噪音通知(#3402)。根因:分配通知作为全局行为硬编码在 plugin-audit 的 afterInsert/afterUpdate 钩子(writeAssignmentNotifications),靠字段名启发式(OWNER_FIELDSowner_id)猜「负责人」,把 sys_file.owner_id(存储层 ACL 归属)误判成业务指派;sys_file 由存储服务裸引擎写库(actorId=null)穿透自我分配守卫,多次写库(pending→committed)重复刷屏。

经维护者讨论,结论是问题不在缺一个跳过名单或开关,而在这个功能放错了层。

决策

移除内核内置分配通知,「分配通知」回归用户态:平台只提供机制(记录变更触发器 + notify 节点 + 消息模板),通知策略由应用/管理员用自动化流程按需配置,文案可自定义。业界同类产品(Salesforce / ServiceNow / Odoo)均为「机制内置、策略配置」,且没有平台对文件/附件等系统记录发分配通知。

改动

  • audit-writers.ts — 删 writeAssignmentNotificationsOWNER_FIELDSpickOwnerwriteAudit 内调用点(含 makeTitle)。保留sys_audit_log/sys_activity 写入、@mention 通知(writeCommentMentions)。
  • translations/messages.ts — 删 en/zh-CN/ja-JP/es-ES 四处 assignedToYou key(mentionedYou 等保留)。TranslationData['messages'] 是开放 z.record,非枚举,spec 无需改。
  • audit-writers.test.ts — 删两条 assignment 用例,补一条回归用例「设置 owner 字段不再产生 collab.assignment」。全套 44 passed。
  • recipient-resolver.tsDEFAULT_OWNER_FIELDS 注释更新;owner_of: audience 是独立、调用方显式请求的机制,保留
  • 设计文档(notification-platform-convergence.md / adr-0030-notification-convergence.md)assignment 段落加废弃标注,历史不重写。
  • changeset(minor + FROM→TO 迁移) — 想保留分配通知的用户,按 showcase_task_assigned_notify 范例给目标对象配一条 record-after-update + notify 流程。

迁移(FROM → TO)

{id: 'start',type: 'start',config: {objectName: 'your_object',triggerType: 'record-after-update',condition: 'assignee != previous.assignee',}},{id: 'notify_assignee',type: 'notify',config: {topic: 'task.assigned',recipients: ['{record.assignee}'],channels: ['inbox'],title: 'New assignment: {record.title}',actionUrl: '/your_object/{record.id}',}},

真机验证(showcase :3377,真实运行,REST API 驱动)

全量 build(71/71),plugin-audit/dist grep collab.assignment = 0。

场景操作结果
#3402 本体完整上传三步,sys_file.owner_id=admin、committed✅ 0 条 collab.assignment、0 条「已分配给你」/文件噪音
业务对象分配PATCH task assignee→admin(owner_id 亦为 admin)✅ 内核未发铃铛
替代路径同一次 assignee 变更✅ 范例流程 showcase_task_assigned_notify 照常触发,收件箱「New task assigned」
保留功能发带 mention 的评论collab.mention 正常产生

最终 sys_notification topic 分布:collab.mention:1, project.digest:4, task.assigned:1 —— 无 collab.assignment

验收

🤖 Generated with Claude Code

@vercel

vercelBot commented Jul 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
specReadyReadyPreview, CommentJul 22, 2026 8:03am

Request Review

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling size/m labels Jul 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/plugin-audit, packages/services.

9 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/automation/webhooks.mdx(via packages/services)
  • content/docs/deployment/production-readiness.mdx(via @objectstack/plugin-audit)
  • content/docs/getting-started/cli.mdx(via @objectstack/plugin-audit)
  • content/docs/kernel/runtime-services/audit-service.mdx(via packages/services)
  • content/docs/kernel/runtime-services/index.mdx(via packages/services)
  • content/docs/kernel/runtime-services/settings-service.mdx(via packages/services)
  • content/docs/plugins/packages.mdx(via @objectstack/plugin-audit, packages/services)
  • content/docs/protocol/kernel/i18n-standard.mdx(via packages/services)
  • content/docs/releases/implementation-status.mdx(via @objectstack/plugin-audit)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@os-zhuang
os-zhuang merged commit f243727 into mainJul 22, 2026
16 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-3403-e529bb branch July 22, 2026 09:19
…3403)
Deciding that an owner/assignee change warrants a bell is a business
policy, not a platform default. The kernel notifier guessed "who is the
assignee" from field names (owner_id, assigned_to, …), which misfired on
system records like sys_file and spammed users with "…assigned to you"
noise on file uploads (#3402).
Removes writeAssignmentNotifications, the OWNER_FIELDS heuristic, and the
messages.assignedToYou translation key (en/zh-CN/ja-JP/es-ES) plus the two
assignment test cases; adds a regression test asserting no collab.assignment
emit on an owner-field write. Assignment notifications now live in user-space
automation (record-after-update + a notify node); see the
showcase_task_assigned_notify flow.
Unaffected: sys_audit_log / sys_activity capture; @mention notifications
(collab.mention); service-messaging owner_of: audience + DEFAULT_OWNER_FIELDS
(a separate, caller-requested mechanism — comment updated). Design docs get a
deprecation note (history not rewritten). Changeset carries the FROM→TO
migration.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

2 participants

@baozhoutao@os-zhuang