You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bcfc8e4
Browse filesBrowse the repository at this point in the historyBrowse files
fix(service-automation): a node with no installed executor follows its fault edge (#34984)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBQ3DFv6XZAspQRYGQoEWhr8)_
repo:objectstack#3 · os-support-ai · session_01WGufzgNCAXyGfBQFZBwixH
Fixes#34959
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么:** 流程节点的类型没有任何已安装插件提供时(例如没装审批插件时的 `approval`
节点),这个节点的失败现在和其他节点失败一样处理。节点声明了 `fault` 连线就走这条线,处理节点读到的 `$error.code` 是
`NO_EXECUTOR`,文字和原来一样。
- **为什么改:**
以前这类失败在错误路由之前就直接抛出,作者声明的兜底路径(通知、回退、把记录改回去)永远不会执行,提交的记录一直停在原状态。hotcrm 实测有
4 个审批流程是这样。
- **风险与回滚:** 没有 `fault`
连线时行为不变:同一个失败步骤,同一句报错,运行失败。新增的可见变化只有一处:`try_catch` 捕获这类失败时,绑定的错误多了
`code: NO_EXECUTOR`。回滚就是还原这一个提交。
- **先看:** ① `dag-traversal.ts` 缺执行器的分支(新发布 `$error`,再调用
`followFaultEdge`);② 同文件新抽出的 `followFaultEdge`,另外两个失败分支改成调用它,判断条件没变;③
`fault-edge-guard-containment.test.ts` 末尾新增的 describe。
- **两分钟验证:** `pnpm --filter @objectstack/service-automation exec vitest
run --maxWorkers=2 src/fault-edge-guard-containment.test.ts
src/throw-arm-error-refresh.test.ts`,预期 2 个文件、16/16 通过。
- **需要你做的:** 无,席位落地。
## What changes
**`packages/services/service-automation/src/dag-traversal.ts`**
- The missing-executor arm of `executeNode` (any node type except
`start`) now grades the failure the way the two other failure arms
already do:
1. It records the same failure step as before: `status: 'failure'`,
`error: { code: 'NO_EXECUTOR', message: "No executor registered for node
type 'T'" }`.
2. It publishes the failure: `$error = { nodeId, message, code:
'NO_EXECUTOR' }`, plus the node-scoped `NODE_ID.error` through
`setNodeError`. This is the same shape as the returned-failure arm,
where `code` is the classified code a handler branches on.
3. It follows a declared `fault` edge. With no `fault` edge it throws
the same `Error` with the same text as before, so the run fails exactly
as it did.
- `followFaultEdge` (new, module-private) is now the only copy of the
fault-edge routing. The thrown-failure arm and the returned-failure arm
call it too. The decision whether a failure may route stays at each call
site and is unchanged: `isGuardRefusal(execErr)` on the throw arm, and
`errorClass === 'guard'` on the returned arm (#3863).
- `start` keeps its no-executor success path, untouched.
**Why this shape, and not a coded error thrown inside the `try`.** The
catch block would:
- grade the error through `gradeAfterTenantCurrencyReadFault`, which
does nothing to it;
- record the step as `EXECUTION_ERROR`, which loses `NO_EXECUTOR`;
- publish `$error` without a `code`;
- try the `readPartialSteps` fold, which has nothing to fold.
Each of those would need a special case for a node that never ran.
Calling the shared routing helper from the arm itself keeps the step
code and the thrown text identical, and leaves one routing
implementation.
**What a NO_EXECUTOR failure does not pick up.**
- `executeNode` has no node-level retry. Flow-level
`errorHandling.strategy: 'retry'` and a `try_catch` retry ladder see
exactly what they saw before when no `fault` edge routes.
- A routed failure does not consume a flow retry. This is the existing
#3863 pin, and it holds by construction.
- The failure is classed `runtime` (routable), not `guard`. The metadata
is valid, and a deployment that installs the plugin runs it. This is
also why the boot audit only warns (ADR-0018 §M1).
**Other executor lookups in service-automation, checked:**
- Resume, region bodies (`runRegion`: `loop`, `parallel`, `try_catch`),
and subflow children all re-enter through this same `executeNode`, so
they are fixed by this change.
- `dry-run.ts` runs the live `executeNode` body over a dry executor
view. Its missing-type branch notes the failure, then the shared arm
runs, so a dry run follows the `fault` edge as the live run does. That
follows from the shared code; this PR does not pin it separately.
- The ADR-0018 alias executor (`plugin-extension-api.ts`) returns `{
success: false }` when its canonical executor is missing. That already
goes through the returned-failure arm, which routes. It is not the same
bug, so it is left as is.
- `releaseSuspension` (`dispatch-claims.ts`) is a teardown hook (no
executor means nothing to release), and `unregisterNodeExecutor` is a
registry removal. Neither is a failure path.
**Boot warnings left unchanged.** `plugin.ts` ~3032 and the engine's
per-flow `warnUnknownNodeTypes` both still say something true: the node
fails with `NO_EXECUTOR`, and installing the plugin fixes it. A declared
`fault` edge now routes that failure.
**Route 2 (refusing at install or registration) is not taken.** It would
refuse packages whose flows reach the node type only on a path a
deployment never takes, and the boot warning already names them.
No spec node type, edge type or schema changes. `flow.zod.ts` already
declares `fault` as the error path.
## Tests
New top-level describe in `src/fault-edge-guard-containment.test.ts` ("a
node with no installed executor is graded like any other node failure").
The node is an `approval` node with no approvals plugin registered.
- **routes:** with a declared `fault` edge, the run succeeds, the
handler runs once, and the handler reads `$error` equal to `{ nodeId:
'signoff', message: "No executor registered for node type 'approval'",
code: 'NO_EXECUTOR' }` and `signoff.error` equal to the message.
- **step record:** the run log keeps exactly one `signoff` step,
`failure` with `{ code: 'NO_EXECUTOR', message }`, and the step order is
start success, then signoff failure, then handler success.
- **CONTROL, no fault edge:** `success: false`, `status: 'failed'`,
`error` equal to today's text byte for byte, handler not run, steps
start success then signoff failure with `NO_EXECUTOR`.
- **CONTROL, `start` with no executor:** a success step with no error,
the run proceeds, and `$error` is untouched.
- **CONTROL, a registered executor that throws:** the fault edge still
routes. `$error` is `{ nodeId, message }` with no code, and the step
code is `EXECUTION_ERROR`, as before.
New top-level describe in `src/throw-arm-error-refresh.test.ts` (the
#14955 `$error` freshness harness): a missing-executor node inside a
`try_catch` try region (a made-up type, because a pausing `approval` may
not sit in a region) publishes `$error` with `NO_EXECUTOR`, and
`try_catch` binds `code: 'NO_EXECUTOR'` onto its caught error.
Red first, on origin/main 0465f4a with only the tests added: routes
✗, step record ✗, and all three controls ✓.
Ablation (one-off, no permanent file): with `HEAD` at bdee8dc,
`dag-traversal.ts` was set back to its base blob (0465f4a) and
hash-verified on disk. The 3 new routing and publishing tests went red,
and the other 13 tests in the two files, including all 4 controls,
stayed green. The file was then restored from `HEAD`, hash-verified, and
`git diff HEAD` was empty.
## Acceptance notes
- Pre-existing and unchanged: with no `fault` edge, a `try_catch` retry
ladder (`maxRetries`) re-runs a node that cannot run, and flow-level
`errorHandling.strategy: 'retry'` re-runs the whole flow on
`NO_EXECUTOR`. Both are bounded. This PR leaves both alone and does not
file them.
- `engine.ts` ~5645 has a comment saying "executeNode() throws
NO_EXECUTOR at run time". It is now more exactly "fails the node". It is
a comment only and outside this claim's file surface, so it is left.
- `content/docs/automation/flows.mdx` says "executing one fails with
`NO_EXECUTOR`". That is still true, so it is left.
- The platform-checklist item for an unknown node type
(`docs/qa/platform-checklist/areas/automation.json`) tests the shape
with no fault edge (`status: 'failed'` and a `NO_EXECUTOR` step). It
still holds; the no-fault control pins it.
## Verification
All readings are at head bdee8dc, in worktree
`objectstack-issue-34959`.
<details><summary>Package tests and typecheck:
@objectstack/service-automation</summary>
- `pnpm --filter @objectstack/service-automation exec vitest run
--maxWorkers=2` (whole package), under the verify lock: `VERDICT
command-exit 0`, Test Files 287 passed (287), Tests 4145 passed (4145).
- `pnpm --filter @objectstack/service-automation run typecheck`: `tsc
--noEmit` passed, and `check:test-typecheck: OK — ... 0 file(s) / 0
error(s)`.
- `pnpm --filter @objectstack/service-automation run build`:
`check-dts-emitted: 2/2 declared declaration file(s) present`.
- Dependency closure built first: `pnpm --filter
'@objectstack/service-automation^...' build`, `VERDICT command-exit 0`.
</details>
<details><summary>Derived gate families (dispatch-gates --commands,
70)</summary>
- 68 exit 0.
- 2 are NOT MEASURED (exit 3, PREREQUISITE NOT MET):
- `node scripts/check-plugin-teardown-shape.mjs --self-test`: its pinned
positive-control commit is not reachable from this shallow clone. This
is checker health only, and the scan itself
(`check:plugin-teardown-shape`) passed.
- `pnpm check:dual-build-cjs-loads`: it reads a whole-workspace build
that was not produced locally. CI's Lint & Repo Gates runs it.
- `dispatch-gates --ran` with exit codes: "70 derived famil(ies)
accounted for — 68 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit
3)".
- Everything outside the derived list is CI's: Test Core, Build Core,
type-check lanes, and the dogfood shards in the merge queue.
</details>
<details><summary>overlap-check</summary>
`node scripts/pm/overlap-check.mjs
--branch=claude/issue-34959-missing-executor-fault-edge`: "✓
origin/main: merges cleanly", `VERDICT clean exit 0` (0 PR heads
overlapping).
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzgNCAXyGfBQFZBwixH)_
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzgNCAXyGfBQFZBwixH -->
Co-authored-by: Claude <noreply@anthropic.com>
fix(service-automation): a flow node whose type no installed plugin provides now follows its `fault` edge
6
+
7
+
Clause-②: no
8
+
Metadata-protocol: none
9
+
10
+
A flow can name a node type that no installed plugin provides, for example an `approval` node on a deployment without `@objectstack/plugin-approvals`. Running that node fails with `NO_EXECUTOR` ("No executor registered for node type 'approval'"). Until now that failure skipped the node's `fault` edge: the run just failed, nobody was told, and the record that started it stayed where it was. An author could not declare a graceful path for it.
11
+
12
+
That failure is now handled like any other node failure:
13
+
14
+
- When the node declares a `fault` edge, the run follows it. The handler reads `{$error.code}` as `NO_EXECUTOR`, with the same message, and `{<nodeId>.error}` holds the message. The run log keeps the node's failed step with code `NO_EXECUTOR`, followed by the handler's steps.
15
+
- Inside a `try_catch` region, the catch region's bound error now carries `code: 'NO_EXECUTOR'`.
16
+
- With no `fault` edge, nothing changes: the same failed step, the same error text, and the run fails.
17
+
18
+
The boot warning that names flows referencing node types no installed plugin provides is unchanged. Installing the plugin is still the fix; the `fault` edge is the author's fallback until then.
0 commit comments