Skip to content

flow 的 delete_record / update_record 无法表达批量意图 —— 节点 schema 无键、执行器不传 options.multi,谓词批量写对所有 flow 平台级不可达,而节点描述符宣称支持 #5393

Description

@baozhoutao

Part of #5225(showcase 清扫流从未删过记录 —— 该单的根因,按跨车道协议转 spec 车道;发现与全部实测证据来自其 os-dev 的 needs_decision 报告,PM 转录)。

事实(真实 boot + built spec 的 safeParse 实测,origin/main @ ccba1bb)

  • DeleteRecordConfigSchema(packages/spec/src/automation/builtin-node-config.zod.ts:242)是 strictObject,只声明 objectNamefilter 两键;multi / options.multi / bulk / all 逐一实测被 unrecognized_keys 拒绝。
  • CRUD 执行器(service-automation)调用引擎时从不options.multi。引擎契约(packages/objectql/src/engine-delete-dispatch.ts):标量 where.id → 按 id;否则 options.multi 为真 → deleteMany;否则抛 Delete requires an ID or options.multi=true
  • 于是谓词批量删除从任何 app 的任何 flow 都不可达,而节点描述符写着 name: 'Delete Records' / description: 'Delete records matching a filter.';writtenRowCount 的文档与 Flow node filters silently blank date macros: the template engine consumes {…} before the query engine sees it #3810 擦除防护的前提都以「谓词 delete_record 会到达 deleteMany」为设计意图 —— declared ≠ enforced。
  • update_record 同病(engine.ts:5403 同款抛错,UpdateRecordConfigSchema 同样无批量键);showcase 三处 update_record 全用 filter: { id: … } 所以被掩盖。
  • 单元测试全程绿的原因已另记:service-automation 的 run-summary.test.ts:405 内联 fake 接受真引擎拒绝的谓词删除,且不在 engine-double 基线内(已评论至 os-dev 派发词/定义可加一行:测试假引擎的 delete() 必须路由 assertEngineDeleteDispatch —— 同一门禁一日两红(#5173、#5192) #5197,检测器盲点)。

PM 裁定(两轴分析由 #5225 的 dev 给出,PM 附议;留否决窗口 —— 维护者可否决,不等批准)

取 A:在 spec 给两个节点 config 声明批量意图键(一次命名,两节点共用),CRUD 执行器在作者声明后传 options.multi;B 与 C 否决。

完成判据

关联:#5225(现场与验收锚)、#5197(检测器盲点)、#5383(loop lint 盲区)、#3810、PD #5/#10/#12

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions