Repository navigation
fix(service-messaging): a host that owns the socket can mount the messaging doors for a kernel with no http-server - #39922
Conversation
…saging doors for a kernel with no http-server
MessagingServicePlugin mounted /api/v1/messaging/* only on its own kernel's
http-server, so a hosted environment kernel (the host worker owns the
socket) served them nowhere. The plugin now registers
MESSAGING_HTTP_DOORS_SERVICE ('messaging-http-doors') at init; mount(http)
registers the same routes on a host-supplied server, bound to this kernel's
services. A kernel with its own http-server mounts them as before.
Fixes #39917
Claude-Session: https://claude.ai/code/session_01Q4EjjRQzcYiBPb6jM6qBmk
Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 6 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 9458b80a8642d1cc1ced9f21f14268dc8c75a08c && git checkout 9458b80a8642d1cc1ced9f21f14268dc8c75a08c
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin b8b7727792ead2ef1651b7c85b665c17673c6feb 8f675152c5cbfffd6c08d3ec7f6113a686ab4898 && git checkout -B drift-repro b8b7727792ead2ef1651b7c85b665c17673c6feb && git merge --no-ff 8f675152c5cbfffd6c08d3ec7f6113a686ab4898
node scripts/docs-audit/affected-docs.mjs --json b8b7727792ead2ef1651b7c85b665c17673c6feb
|
|
repo:cloud@hotlong · hotlong · session_01Q4EjjQzFqHGjUAXt8kBQhV L1: ACCEPT at head
|
Requested by Jack · project thread
Fixes #39917
Maintainer summary
MessagingServicePluginmounted/api/v1/messaging/*only on its own kernel'shttp-server, and a hosted environment kernel has none (the host worker owns the socket), so the doors were served nowhere.messaging-http-doorsservice atinit. A host that owns the socket callsmount(http)to register the same routes on its own route table, bound to this kernel's services. A kernel with its ownhttp-server(self-hosted,os dev) behaves as before; a test pins that.Clause-②: no
Metadata-protocol: none
What changed
packages/services/service-messaging/src/messaging-service-plugin.ts:initregistersMESSAGING_HTTP_DOORS_SERVICE('messaging-http-doors') carrying{ mount(http: IHttpServer): void }. The route registration thatmountHttpDoorsdid inline moved intomountHttpDoorsOn(http, …);mountHttpDoorsstill resolves the kernel's ownhttp-serveratkernel:readyand calls it, and its no-server warning now names the service.src/index.ts: exportsMESSAGING_HTTP_DOORS_SERVICEand theMessagingHttpDoorstype.src/messaging-http-doors-service.test.ts(new, 4 tests): the service is registered on a kernel with nohttp-server;mountregisters exactly theMESSAGING_ROUTE_LEDGERroutes; with no server thekernel:readywarning names the service; a kernel WITH its ownhttp-serverstill gets exactly the ledger routes mounted on it atkernel:readyand no warning.@objectstack/service-messagingpatch.Why a service rather than exporting the five registrars: the doors close over the plugin's own
MessagingServiceandSlackLinkStoreinstances; a host rebuilding them from exports would hold a second store.Evidence
5b4c402, pinbd27ebe5: before,GET /api/v1/messaging/me/preferenceswith the owner's session answered404 ENDPOINT_NOT_FOUND, and the environment kernel logged[messaging] no HTTP server is registered … is mounted. With this change applied to the pin'sservice-messagingand cloud#5498's door composed:/me/preferences200 with the caller's topic rows,/me/slack-link200,/preference-options200, anonymous/me/preferences401.Local gates
@objectstack/service-messaging:vitest run88 files / 1174 tests passed;tsc --noEmit -p tsconfig.jsonexit 0 (afterturbo run build --filter='@objectstack/service-messaging^...').node scripts/pm/dispatch-gates.mjslisted 126 local commands; all exit 0 except:pnpm check:dual-build-cjs-loads,pnpm check:published-readme-exports:: exit 3, need every package'sdist/(workspace not fully built in this worktree)node scripts/check-plugin-teardown-shape.mjs --self-test:: exit 3, shallow clone cannot read its pinned positive control (checker health only; the gate itself,node scripts/check-plugin-teardown-shape.mjs, exit 0)check-closing-target-claim,check-partof-closing-keyword,check-single-claim-paths,check-governed-queue-guard:: need the PR / workflow event context; they run on this PR🤖 Generated with Claude Code
https://claude.ai/code/session_01Q4EjjRQzcYiBPb6jM6qBmk