Skip to content

feat(automation): notify node click-through target (source_object/source_id) (#2675) - #2677

Merged
os-zhuang merged 1 commit into
mainfrom
fix/notify-source-target
Jul 7, 2026
Merged

feat(automation): notify node click-through target (source_object/source_id) (#2675)#2677
os-zhuang merged 1 commit into
mainfrom
fix/notify-source-target

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

问题

Fixes#2675.

Flow 的 notify 节点无法给通知附带点击跳转目标——生成的 sys_notification.source_object / source_id 恒为 null,inbox 里点通知无处可跳。节点此前只消费 recipients / title / message / channels,写出的 payload 只有 { title, body }

根因很窄:下游 messaging 服务的 emit()早已支持source: { object, id } / actorId,会把它们写进 sys_notification.source_object / source_id / actor_id,并在无显式 URL 时合成 /{object}/{id} 的 inbox 深链(actionUrlFor)。缺口只在 notify 节点从不把这些从 config 转发进 emit()

改动

packages/services/service-automation/src/builtin/notify-node.ts:

  • 从 config 读取跳转目标并转发给 messaging.emit({ source, actorId })
    • 扁平键 sourceObject / sourceId(canonical,对齐 DB 列名)
    • 或嵌套 source: { object, id }(对齐 emit 契约)
    • actorId
  • 两个键都走 interpolate,支持 sourceId: '{new_quotation.id}' 这类流程变量。
  • 半指定即丢弃(只给 object 不给 id,或反之)——inbox 绝不渲染死链。
  • 显式 actionUrl / url 仍优先于合成链;新增 url 作为 actionUrl 别名。
  • 给 descriptor 补 configSchema,让 Studio 表单可发现这些键(不加 required,不锁死额外键——纯 discoverability)。

用法(即 issue 的期望):

{type: 'notify',config: {recipients: ['{record.sales_person}'],title: '转报价申请已通过',message: '…请到报价单补全明细',channels: ['inbox'],sourceObject: 'mtc_quotation',sourceId: '{new_quotation.id}',// 或显式 url: '/…/mtc_quotation/record/{new_quotation.id}'}}

验证

  • 新增 4 个 notify 节点单测(sourceObject/sourceId 转发+插值、嵌套 source 形式 + actorId、半指定丢弃、url 别名)。
  • service-automation 全套 256 passed;service-messagingemit() 已有测试覆盖 sourcesource_object/source_id 落库 + /{object}/{id} 深链合成,整条链路端到端有据。
  • 包 build(tsup + DTS 严格类型门)通过。

🤖 Generated with Claude Code

…rce_id) (#2675)
The flow `notify` node consumed only recipients/title/message/channels, so every
notification it emitted had `sys_notification.source_object` / `source_id` = null
— inbox notifications could not be clicked into the related record.
Read `sourceObject`/`sourceId` (or the nested `source:{object,id}` form) and
`actorId` from the node config and forward them to `messaging.emit()`, which
already persists the source columns and synthesizes a `/{object}/{id}` inbox
deep-link. Both keys interpolate flow variables; a half-specified target is
dropped so the inbox never renders a dead link. Accept `url` as an alias for
`actionUrl`, and publish a `configSchema` documenting the accepted keys.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercelBot commented Jul 7, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
specReadyReadyPreview, CommentJul 7, 2026 1:49pm

Request Review

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

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): packages/services.

6 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/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 packages/services)
  • content/docs/protocol/objectos/i18n-standard.mdx(via packages/services)

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 0adcc1c into mainJul 7, 2026
16 checks passed
@os-zhuang
os-zhuang deleted the fix/notify-source-target branch July 7, 2026 14:07
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

Development

Successfully merging this pull request may close these issues.

flow notify 节点无法给通知附带点击跳转目标(source_object/source_id)——inbox 通知点不进对应记录

1 participant

@os-zhuang