Repository navigation
Commit 888c3e1
fix(service-automation)!: the inbound hook door refuses the address of a flow slot whose package is disabled, before anything is enqueued (ADR-0150 D5) (#34278)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbCpddLFmKzR39wJWZpkRMCi)_
Fixes #33906
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: follow-up owed —
skills/objectstack-automation/SKILL.md:383-395
> **BREAKING** for a sender that posts to the inbound hook of a flow
whose package is disabled while the automation engine still holds that
flow's slot (the disable's re-sync failed or did not run, or the disable
came with no announce). The door answered `202 Accepted`, queued the
post, and the queued run was then skipped: the event was lost while the
sender was told it was accepted. It now answers the door's one refusal,
`401 INVALID_SIGNATURE`, the bytes the same address gets once the
re-sync has withdrawn the slot. Senders that retry on a non-2xx keep the
event and can redeliver after a re-enable. Remedy: enable the package;
the address answers `202` again with no re-arm. Nothing durable moves,
so nothing is migrated (ADR-0087: `not-required
(no-migration-prescription)`).
## 维护者速读
- 改了什么:入站 hook 的地址指向"包已停用、但引擎仍挂着其流程槽位"的流程时,入口不再回 202 受理,而是回入口唯一的 401
拒绝(读完整个请求体之后),不入队;两种托管形态(自托管挂载与托管分发)都一样。原因只写服务器日志(`cause:
'disabled-holder'`),不告诉发送方。
- 为什么改:之前入口回 202,随后排队的运行被跳过,发送方以为已处理,事件静默丢失。按座席裁决 6898449441(方案 A,沿用裁决
6884403301 第 2、3、8 条):停用包的槽位不接受任何地址,与重同步撤回槽位后的回答逐字节相同。
- 风险与回滚:破坏性收窄(标题带 `!`),只影响"包已停用但重同步没撤掉槽位"的流程的 hook 地址;会在非 2xx
时重试的发送方可在重新启用后补投,不重试的发送方这段时间的事件会被拒收(之前是被假受理后丢弃)。共享名的裸
hook、在服务的同名包、无包流程、用槽位开关关掉的流程,回答都不变。回滚即还原本 PR。
- 先看:`packages/services/service-automation/src/engine.ts` 的
`inboundHookSlot`(两处新判断:单一持有者分支、地址选定槽位之后)与新增的
`disabledHolderHookRefused`;测试
`packages/qa/dogfood/test/inbound-hook-disabled-holder-33906.test.ts`。
- 两分钟验证:`pnpm --filter @objectstack/dogfood exec vitest run --project
isolated --maxWorkers=2
test/inbound-hook-disabled-holder-33906.test.ts`(需先构建依赖),预期 6 个用例全部通过。
- 需要你做的:无,席位落地。
## What changes
`AutomationEngine.inboundHookSlot` (both faces of the inbound hook door
ask it before the signature is read) now asks `isDisabledHolderSlot`,
the predicate the trigger's fire-time skip already asks (PR #33890,
extended to a name one package holds by PR #34048):
- **A name two packages hold**: once the qualified address has picked
its slot (the namespace's package), a slot whose package is disabled
answers `unadmitted`. The slot is judged after the pick, so no other
holder is served in its place (amendment 8: admission is judged on the
slot that would execute).
- **A name one package holds** (the door previously answered `undefined`
and judged it as before): a disabled sole holder answers `unadmitted`
for every address, the bare one included.
`unadmitted` is the door's existing answer: the self-hosted mount
(`ApiTriggerPlugin`) and the hosted face (`handleInboundHookRequest` in
the runtime, and the `trigger-api` member for the bare hook) read the
body in full and answer `inboundHookRefusal()`, `401 INVALID_SIGNATURE`.
No door file changes. The engine logs the real cause at `info`, once per
refused post, with `{ cause: 'disabled-holder', flow, package, slot }`;
the door's own line still logs `unadmitted-address` (qualified) or
`unknown-flow` (bare). Nothing is enqueued.
The question is asked at post time, so the enable serves the address
again with no re-arm.
Not moved: the bare hook of a name two packages hold stays the
`shared-name` refusal (PR #33646 "Not moved"); the served co-holder
beside a disabled one, a flow no package ships, and a flow switched off
with `toggleFlowSlot` (its address still routes to its slot:
`flow-triggers-per-slot.test.ts:198-210`, untouched) answer as before.
## Tests
New file
`packages/qa/dogfood/test/inbound-hook-disabled-holder-33906.test.ts` (6
tests). The rig: the real `AutomationEngine` built by the real
`AutomationServicePlugin.init()` (so its flow-name resolver is the
plugin's own) over a real `SchemaRegistry`; the real `ApiTriggerPlugin`
mounting the self-hosted routes and registering the `trigger-api`
member; the real runtime `HttpDispatcher` as the hosted face over a
kernel with no `http.server`; a queue that hands each message to the
trigger's consumer at once, so a run is observed. Each post is signed
with the hook's correct secret, so the disable is the only reason for a
refusal.
- red line: the disabled co-holder's qualified address answers the one
refusal on both faces, byte-identical (status, headers, body) to
`inboundHookRefusalResponse()` and to the same address after
`withdrawFlowSlot` (the re-sync); nothing enqueued, nothing run; the
cause is in the log only (the body names no package, namespace or
`disabled`).
- red line: both holders disabled: neither qualified address is served.
- red line: a disabled sole holder: its qualified and bare addresses
answer the same refusal on both faces, byte-identical to after the
re-sync; nothing enqueued.
- the enable: each address answers `202` and runs again; the active
trigger bindings and the queue subscriptions are unchanged (no re-arm).
- CONTROL: nothing disabled: every address answers `202` on both faces
and runs.
- CONTROL: the served co-holder beside the disabled one answers `202` on
both faces and runs its own flow.
The file is new rather than a describe in
`flow-hook-per-slot.dogfood.test.ts` because the order names it; that
file's rig mounts only the self-hosted face.
## Acceptance notes
- Skills follow-up owed:
`skills/objectstack-automation/SKILL.md:383-395` (the area files that
card).
- The door's own log line for this refusal names a generic cause
(`unadmitted-address` qualified, `unknown-flow` bare); the engine's
`disabled-holder` line beside it is the true cause. Giving the door a
cause of its own would add a member to `UnverifiedPostCause` in
`trigger-api` and the runtime's door text, outside this claim.
- The full PATCH-disable stack through a booted app was not measured (as
in the measurement 6897225218); the armed-but-disabled state is reached
in the rig with `registry.disablePackage` and no re-sync.
## Verification
All readings are on head `84e37cab` (the branch with `origin/main`
merged in, #34048 included) unless a line says otherwise.
- **Pins:** `pnpm --filter @objectstack/dogfood exec vitest run
--project isolated --maxWorkers=2
test/inbound-hook-disabled-holder-33906.test.ts`: Test Files 1 passed,
Tests 6 passed.
- **Dogfood battery** (title has `!`): the dependency closure built
(`--filter '@objectstack/dogfood^...' build`, exit 0), then `pnpm
--filter @objectstack/dogfood test` under the verify lock: exit 0, Test
Files 470 passed, 3 skipped (473); Tests 3980 passed, 42 skipped (4022);
2007 s.
- **`@objectstack/service-automation`:** `pnpm test`: Test Files 284
passed, Tests 4040 passed (`flow-triggers-per-slot.test.ts`, the
toggled-off slot pin at L198-210, untouched and green). `pnpm
typecheck`: exit 0, test layer compiles.
- **Derived gates** (`dispatch-gates --commands`, 76 families): 75 exit
0. `check:dual-build-cjs-loads` exit 3, PREREQUISITE NOT MET (it reads
every package's `dist/` and this tree built only the dogfood closure):
NOT MEASURED here; CI runs it. `--ran` reconciliation: 76 derived, 76
run, 0 unrun. `check:engine-double-contract` was red on an earlier head
(the rig's credential store pinned write verbs the ledger does not
record); the store is now read-only, so no ledger row is owed, and the
gate is green.
- **Declaration self-check:** `check-changeset-no-major`,
`check-adr-0087-registration` (`[BREAKING+bang+clause-②-narrowing]
not-required (no-migration-prescription)`),
`check-closing-keyword-parity`, `check-partof-closing-keyword` on this
body: all exit 0. `dispatch-gates --tier`: no path-derived model
mandate.
- **eslint** on the two touched source files: exit 0. Repo-wide `pnpm
lint` is left to CI.
<details><summary>Ablation: each leave-out put back, the pins go red
(rebuilt, marker proved in dist/, restored)</summary>
Each leg went through `scripts/ablation-replace.mjs` (anchor hit 1 to 0,
blob checked), then `pnpm --filter @objectstack/service-automation
build`, then `ablation-dist-preflight.mjs` (marker present in
`dist/index.js` and `dist/index.cjs`), then the pin file. Taken on
`aa16cc6e`, before the merges, with the same engine hunk.
1. The shared-name leave-out made inert (`if
(globalThis.__ABLATED_33906_SHARED__ === true && ...)`): 3 failed, 3
passed. The red lines for the disabled co-holder, for both holders
disabled, and for the enable go red, for example `AssertionError:
self-hosted: expected { status: 202, …(2) } to deeply equal { status:
401, …(2) }`.
2. The sole-holder leave-out made inert: 2 failed, 4 passed. The
sole-holder red line and the enable go red: `AssertionError: self-hosted
{"ns":"alpha","flowName":"zz_disabled_alone"}: expected { status: 202,
…(2) } to deeply equal { status: 401, …(2) }`.
Restore: each blob equal to HEAD, `git diff HEAD` empty. A rebuild, then
`ablation-dist-preflight --absent` for both markers: absent from all 6
built files, tree clean. The pin file: 6 passed.
</details>
Session: https://claude.ai/code/session_01QsR2jUZKdq3PK2Sab53cT3
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent bb17350 commit 888c3e1
3 files changed
Lines changed: 410 additions & 2 deletions
File tree
- .changeset
- packages
- qa/dogfood/test
- services/service-automation/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
0 commit comments