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 f72f335
Browse filesBrowse the repository at this point in the historyBrowse files
fix(runtime): a dispatcher door is served only by the request's own kernel (#37897)
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:托管多环境主机上,登录、评论、审批链接页、Webhook
重投、入站自动化钩子等入口只由本次请求所在环境自己的服务来处理;该环境没装对应插件时,入口如实回答"尚未提供"。单环境部署用户无感。
- 为什么做:加固多环境部署下这几个入口的服务归属规则。
- 出错会怎样:最坏是某环境里本应可用的入口回答"尚未提供",不会写错数据;改动小,可直接撤回。
- 要你做什么:无
## What changes
A dispatcher door is served only by the request's own kernel.
- `packages/runtime/src/domains/own-door-bridge.ts` gains
`readDoorSlot`, the reader dispatcher doors read their services through.
It reads the slot off the request's own kernel
(`getRequestKernelService`, the reader the personal-view, attachment and
print bridges already used) and treats a lookup that throws as an empty
slot. It carries the same two overloads `getRequestKernelService` has: a
slot in `ServiceSlotContracts` reads as its contract, any other name as
an untyped value the caller casts.
- The auth door (`auth.ts`), the comment doors (`comments.ts`), the
approval action page (`approvals.ts`), the webhook redeliver door
(`webhooks.ts`) and the inbound automation hook (`automation-hooks.ts`)
now read their member through it, and so does the engine that judges a
qualified inbound hook's address. A request kernel without the slot
answers the door's existing typed not-available answer, `501
NOT_IMPLEMENTED`, in the request's language, exactly as an empty slot
already did.
- The jsdoc of `getRequestKernelService`
(`packages/runtime/src/domain-handler-registry.ts`) points doors at
`readDoorSlot`.
- On a host with one kernel the request's kernel is that kernel, so
nothing changes there.
First files to read, by risk:
1. `packages/runtime/src/domains/own-door-bridge.ts` — `readDoorSlot`
and its overloads, the only new code path.
2. `packages/runtime/src/domains/automation-hooks.ts` — the two reader
swaps in `handleInboundHookRequest` (the member, and the qualified
hook's engine).
3. `packages/runtime/src/domains/own-door-bridge.test.ts` — the last
top-level `describe`.
## Tests
A top-level `describe` in `own-door-bridge.test.ts` (the door bridges'
shared harness), "a dispatcher door is served only by the request's own
kernel", driven through the real `HttpDispatcher.dispatch()` with a
`kernel-resolver` that places each request on its own kernel:
- for each of eight doors (auth, comments, approvals, webhooks,
automation-hooks, personal-views, attachments, print), twice (a request
kernel whose lookup throws, and one that answers nothing): the door
answers `501 NOT_IMPLEMENTED` and a member registered elsewhere is never
called (16 cases);
- for each of the eight: with the slot on the request kernel, the
request kernel's member serves the call (8 preservation cases);
- a qualified inbound hook: a request kernel without the automation
engine never consults another kernel's engine for the address, and with
its own engine that engine judges it (2 cases);
- the door net: every non-test module under `src/domains/` (any depth)
that takes the transport's request whole (`context.request as Request`)
or is built on the shared bridge body reads no service through
`deps.resolveService`, `deps.resolveServiceOrLoud`, `deps.getService` or
a `deps.getObjectQL` given an environment id, and each one that reads a
slot itself reads it through `readDoorSlot`; the modules are found by
scanning, with a floor of the nine shipped door modules. Not covered,
and said so in the pin: a module that hands the request on some other
way, and anything outside `src/domains/`. The pin also holds that the
reader reads the request kernel's slot and nothing else.
Reverse verification (each leg on the committed fix, mutated through
`scripts/ablation-replace.mjs`, then restored and proved byte-identical
to `HEAD`):
- the qualified hook's engine read through its previous reader: 2 red
(the engine pin and the door net), 75 green;
- the auth door's member read through its previous reader: 1 red (the
door net), 76 green;
- earlier round: the four bridge member reads reverted, 9 red;
`readDoorSlot` itself reading through another reader, 15 red.
<details><summary>Readings</summary>
Code head `bded79bb60a` (merge base with `origin/main`: `da21c49d9db`'s,
unchanged this round):
- `pnpm --workspace-concurrency=2 --filter '@objectstack/runtime^...'
build && pnpm --filter @objectstack/runtime typecheck && pnpm --filter
@objectstack/runtime exec vitest run --maxWorkers=2` over 11 files
(`own-door-bridge`, `comments`, `approvals-act`, `webhooks-redeliver`,
`automation-hooks`, `scoped-service-miss-attribution`,
`domain-501-language-37811`, `http-dispatcher`,
`auth-forward-fault-sanitization`, `domain-handler-registry`,
`auth-claim-segment-boundary`) at `721702a2687`: build and typecheck
exit 0, `Tests 538 passed` and 1 failed, the door net finding a
refused-reader spelling in the reader's own jsdoc. The next commit
(`bded79bb60a`, jsdoc and test-comment wording only) rewords it;
`own-door-bridge.test.ts` there: `Tests 77 passed (77)`, lock VERDICT
command-exit 0.
- Reverse verification at `bded79bb60a`: engine leg `Tests 2 failed | 75
passed (77)`, auth leg `Tests 1 failed | 76 passed (77)`, each restored
to the `HEAD` blob with `git diff HEAD` empty.
- Derived gate families (`dispatch-gates.mjs --commands`, 67), re-run on
a clean tree at `bded79bb60a`: 64 exit 0; three NOT MEASURED locally and
left to CI: `check:dual-build-cjs-loads` (exit 3, it needs a full `pnpm
build`), `check:query-options-erasure` and `check:type-check-debt`
(stopped at a 300 s local cap on a shared box). `--ran` reconciliation:
67 derived, 67 run.
- The full `@objectstack/runtime` suite was not run locally; `Test Core`
runs it on this PR.
</details>
## Acceptance notes
- The preservation cases are green before and after the fix by design:
they pin that the request kernel's own member keeps serving.
- No shared-kernel (scoped-registration) mode is affected: every slot
these doors read is registered as a plain singleton by its plugin.
- The door net reads source text, so a door module whose comments spell
one of the refused reader calls with its opening parenthesis also reds
it; the shipped modules spell those names without one.
## Verification
Two-minute check: `pnpm --filter @objectstack/runtime exec vitest run
--maxWorkers=2 src/domains/own-door-bridge.test.ts` — expect `Tests 77
passed (77)`, with every case under "a dispatcher door is served only by
the request's own kernel" passing.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01ASNY8XNef4ywkQio6S9ju4)_
<!-- signed: security#1 · os-mickey · session_01ASNY8XNef4ywkQio6S9ju4
-->
---------
Co-authored-by: Claude <noreply@anthropic.com>
fix(runtime): a dispatcher door is served only by the request's own kernel
6
+
7
+
Clause-②: no
8
+
Metadata-protocol: none
9
+
10
+
Every dispatcher door bridge — the auth door, the comment doors, the approval action page, the webhook redeliver door, the inbound automation hook (including the engine that judges a qualified hook's address), and the personal-view, attachment and print doors — reads the services it serves with off the request's own kernel, and only there. When the request's kernel holds no such member, the door answers its typed not-available `501 NOT_IMPLEMENTED`, the same answer an empty slot already gave. On a host with one kernel nothing changes: the request's kernel is that kernel.
it('automation-hooks: a request kernel without the automation engine never consults another kernel\'s engine for a qualified hook\'s address',async()=>{
0 commit comments