Repository navigation
Commit d463c46
fix(comments): unreact, resolve and own-comment delete answer on a kernel with no http.server (#36539)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9JpRoUZGqtwqMU5k7b4C58D)_
Part of #36469
Clause-②: yes (widening)
Metadata-protocol: none
## 维护者速读
-
托管环境里的成员现在可以撤回自己的表情回应、标记评论已解决或重新打开、删除自己的评论;以前这三个操作在托管环境一律报“找不到接口”,自托管环境不变。
- 修的是评论协作这块的托管缺口,与之前已裁定的“托管环境缺少服务端入口”一类问题同一种修法。
- 出错时只影响这三个评论操作:没装审计插件的环境会明确提示缺什么,而不是“找不到”;改动可以直接撤回。
- 无。
## What changes
The cause is in objectstack, in two layers: `AuditPlugin` mounted the
three comment doors only on the kernel's own `http.server`, and the
runtime dispatcher had no domain for `/comments`. A hosted tenant kernel
owns no socket and registers no `http.server`, so `DELETE
/api/v1/comments/reactions/:id`, `PUT /api/v1/comments/:id/resolution`
and `DELETE /api/v1/comments/:id` reached the host's `createHonoApp`
catch-all, whose `dispatch()` had no domain for them, so they answered
the dispatcher's `404 ROUTE_NOT_FOUND`.
**Premise reading.** Cloud confirmed the hosted composition on the card
(comment 7084177018, cloud `apps/objectos` at `ab4358642`). The rig
mounts `createHonoApp({ prefix: '/api/v1' })` under the
`plugin-hono-server` raw app with `outer.route('/', inner)`, after the
plugin routes. So an unclaimed `/api/v1/comments/**` request reaches the
dispatcher catch-all, and the new `/comments` domain is reachable on
hosted. **Unexplained:** the card read `404` with
`{"code":"ENDPOINT_NOT_FOUND","message":"Not found"}`. In this tree only
the `plugin-hono-server` transport's unmatched answer spells that, and
the `createHonoApp` catch-all answers `ROUTE_NOT_FOUND`. Either the
reading predates the pin cloud read, or a layer upstream of the
catch-all answered it; that was not measured here. The code text now
states the tree's answer (`ROUTE_NOT_FOUND`) and records this
discrepancy instead of the old account.
Shape: ruling A on #22438 (record 6079645593, applied to this member of
the class; seat scope comment 7081381198). Three segments, one PR.
- **spec** (`packages/spec/src/contracts/comment-doors-service.ts`): new
`ICommentDoorsService` with one OPTIONAL, transport-neutral member
`handleCommentDoor(request: Request)` answering a promised `Response`,
the shape `IWebhookService.handleRedeliver` and
`IApprovalService.handleActionPage` already use. `ServiceSlotContracts`
gains `comments: ICommentDoorsService`. No comment service contract
existed, so this is the smallest new one. API surface and export-origin
snapshots gain the one interface.
- **plugin-audit** (`comment-doors-member.ts`, `audit-plugin.ts`):
`init()` registers the `comments` service. Its member runs the SAME two
registrars (`registerCommentReactionRoutes`,
`registerCommentDoorsRoutes`) over the same deps as the `http.server`
mount, on a private `HonoHttpServer` that never listens, built on first
request. The registrar body moved verbatim into a module-level
`registerCommentDoors(http, ctx)` that both faces call;
`mountCommentDoors` is otherwise unchanged, so the raw mount is
byte-unchanged and nothing is mounted twice. The no-server branch now
logs (info) that the doors are served on the `comments` service instead
of warning that they are unmounted. New dependency:
`@objectstack/plugin-hono-server`.
- **runtime** (`domains/comments.ts`, registered in
`http-dispatcher.ts`): a `/comments` segment domain for `PUT`/`DELETE`
that claims exactly the three method and path shapes and forwards
`context.request` with its body unread (env-scoped spellings are
rewritten to the `/api/v1` wire path). Every other `/comments` shape
keeps `404 ROUTE_NOT_FOUND`. No slot, or a slot without the member: `501
NOT_IMPLEMENTED` naming `@objectstack/plugin-audit`. A consumed body or
a throwing member: sanitised 500, logged. No auth-gate or
membership-gate exemption. Route ledger: three `server-only` rows under
domain `/comments`.
- **guards**: `scripts/check-route-envelope.mjs` declares `comments.ts`
in `DISPATCHER_DOMAINS`; the dogfood authz matrix classifies the new
ledger key (`comment-doors-session`); the live-mount parity boot pins
the three rows as unexercised (that boot composes no `AuditPlugin`).
Overlap: PR #36399 also edits `audit-plugin.ts`. This diff stays in the
imports, the `init()` slot registration, `mountCommentDoors` and the new
`registerCommentDoors` helper, and touches none of that PR's regions.
Out of scope here (filed separately by the seat): the personal-views and
attachments doors of the same class.
## Tests
**Why `Part of`, not `Fixes` (seat, on l2-review#4 7086653795 ③):**
cloud's reading (7084177018) shows that this tree's hosted composition
reaches the bridged path. However, the card's own measurement read
`ENDPOINT_NOT_FOUND` with no `mountCommentDoors` warning, which this
tree would not produce. So no hosted evidence yet shows that the card's
request took this path. #36469 stays open for one hosted live probe
after this merges. That probe also checks whether a tenant kernel with
no auth service answers 401.
**Text rework (L2 S1), head `e7dcb26cc4`** (main merged at `f3a8a13c` in
merge commit `acc0d0cd`, no rebase): the contract jsdoc, `comments.ts`,
`comment-doors-member.ts`, the unreact ledger note, the conformance test
header and the changeset now state the prior hosted miss as the
dispatcher's `ROUTE_NOT_FOUND`, and the absence promise as never
`ROUTE_NOT_FOUND` (nor `ENDPOINT_NOT_FOUND`). The member's own
`ENDPOINT_NOT_FOUND` for paths outside its three routes is unchanged.
The conformance pin now refuses both miss codes. Readings at
`e7dcb26cc4`:
- runtime `comments.test.ts` + `route-ledger.conformance.test.ts` 26/26;
conformance 6/6; spec contract tests 12/12.
- typecheck exit 0 for plugin-audit and http-conformance. runtime `tsc
--noEmit` exit 0; its `check:test-typecheck` flagged only 3 untouched
files with TS2307 on the unbuilt `@objectstack/driver-turso`. That run
was green with the full build in the previous round.
- eslint on the five edited source files: exit 0. The CI ESLint parse
error at `604b45ec3` (an unescaped apostrophe in the ledger note) is
fixed at `e7dcb26cc4`.
- dispatch-gates derived for this round's six paths: 98 families, 95
exit 0. NOT MEASURED: `check:dual-build-cjs-loads` and `check:i18n` (no
whole-workspace dist), and `check:type-check-debt` (its locked closure
build queue-timed out). CI runs all three.
Earlier readings at head `6b916dcfc` unless noted (spec and runtime
source unchanged after the noted sha).
-
`packages/qa/http-conformance/src/hono-comment-doors.conformance.test.ts`
(new, the dispatcher-only shape: `createHonoApp`, no `http.server`, real
`AuditPlugin`, real ObjectQL over sqlite-wasm): **6/6 passed**. Covers
unreact, resolve then reopen, own-comment delete (200, store follows),
byte parity of the anonymous refusal and the refused body between the
self-hosted mount and the hosted door, and a typed `501 NOT_IMPLEMENTED`
per door with no `comments` service.
- `packages/runtime/src/domains/comments.test.ts` (new) +
`route-ledger.conformance.test.ts`: **26/26 passed** (at `2f6e249ad`).
- `@objectstack/plugin-audit` full suite: **109 files, 1794 tests
passed** (at `2f6e249ad`).
- `@objectstack/spec` `comment-doors-service.test.ts` +
`core-service-contracts.test.ts`: **12/12 passed**; spec `typecheck`
(incl. `check:test-typecheck`) exit 0.
- dogfood `authz-conformance.test.ts` +
`authz-probe-blind-spot.test.ts`: **70/70 passed**.
- typecheck exit 0: plugin-audit, runtime, http-conformance, dogfood.
<details><summary>Red before, green after (two ablations, both
restored)</summary>
Both via `scripts/ablation-replace.mjs` (anchor hit 1 to 0, blob
changed, then restored: blob == HEAD and `git diff HEAD` empty). Both
subjects resolve to source (runtime tests import
`../http-dispatcher.js`; http-conformance aliases
`@objectstack/plugin-audit` to `src`), so no dist rebuild sits between
mutation and reading.
1. Runtime domain registration removed from `http-dispatcher.ts`:
`comments.test.ts` **10 failed / 3 passed** (the door shapes fall to the
ordinary miss).
2. `ctx.registerService('comments', ...)` removed from
`audit-plugin.ts`: conformance **4 failed / 2 passed**. Unreact, resolve
and own-delete answer `501 NOT_IMPLEMENTED ... no comments service is
registered`, and byte parity breaks.
Not done: a conformance-level ablation of the runtime domain. That
subject reaches the conformance test through `@objectstack/runtime`'s
`dist/` and would need a locked rebuild per leg. The unit-level ablation
(1) covers the domain.
</details>
<details><summary>Gates</summary>
`node scripts/pm/dispatch-gates.mjs --commands` at `6b916dcfc` derived
135 families. All 135 ran locally; `--ran` reconciliation: 135 derived,
135 run, 0 unrun.
Final pass, non-zero exits only:
- `check:dual-build-cjs-loads` and `check:i18n` exited 3 (PREREQUISITE
NOT MET: unbuilt workspace dist). Both were rerun after the full build
`check:type-check-debt` performed, and both exited 0.
- `check-self-test-workflow-commands.mjs` failed once with `spawnSync
node ETIMEDOUT` on the loaded box. Rerun: exit 0.
Fixed in this PR because a gate caught them:
- `check:route-ledger-census`: 150 to 153.
- `check:test-source-alias`: plugin-audit gets an anchored alias for
plugin-hono-server, and the domain test imports `@objectstack/metadata`
at module top.
- `check-affected-docs`: the runtime door table keys `pattern`, not
`path`, so it is not read as a spec API declaration.
- `check:query-options-erasure`: the test's `findOne` options are typed.
</details>
## Acceptance notes
- The cause is in objectstack: the plugin-audit mount and the runtime
dispatcher layer. Ruling A on #22438 is applied to this member of the
class. The personal-views and attachments doors of the same class are
not touched here; the seat files them separately.
- Clause-② `yes (widening)` adds one optional member on one new contract
and one new slot key. Nothing is removed or narrowed. A service without
the member still satisfies the contract (pinned).
- The `/comments` rows enter the route ledger as `server-only`, because
the gap ratchet is 0. The live-mount parity boot pins them as
unexercised, because that boot composes no `AuditPlugin`.
- Unmeasured on hosted: the member resolves the caller with the tenant
kernel's own `auth` service (`ctx.getService('auth')`), while the
dispatcher's identity step can fall back to the host kernel. A tenant
kernel with no `auth` service of its own would answer 401 after the
dispatcher admitted the caller. The webhooks precedent makes the same
assumption.
- L2 N1, accepted deviation (also in the changeset):
`@objectstack/plugin-audit` now depends on
`@objectstack/plugin-hono-server` at runtime (the member's private table
is a `HonoHttpServer`), and the `comments` service name is taken, so a
composition that registers its own `comments` service beside
`AuditPlugin` fails to boot with a duplicate-service error. L2 N2 to N4
are accepted as is.
- NOT MEASURED: `route-ledger-live-mount-parity.dogfood.test.ts`. It
boots the showcase app, and the box's verify lock never reached this run
for that boot. CI's merge-queue dogfood shard runs it.
- Deviation: the shared verify lock answered queue-timeout (exit 99) on
every attempt in about 2.5 hours, under holders that each ran 10 to 80
minutes. One build closure did acquire the lock (`VERDICT command-exit
0`). Per the seat's fallback, the scoped vitest and typecheck runs above
ran outside the lock, one at a time. A parked slot did not keep its
place across re-queues (it reappeared at the back); that is recorded for
the seat.
## Verification
Read first, by risk:
1. `packages/runtime/src/domains/comments.ts`: `handleCommentsRequest`
(the three-shape claim, the 501 legs, the body-unread forward).
2. `packages/plugins/plugin-audit/src/audit-plugin.ts`: the `init()`
slot registration and the extracted `registerCommentDoors` (must equal
the old inline body).
3. `packages/plugins/plugin-audit/src/comment-doors-member.ts`: the
private never-listening table.
Two-minute check: `pnpm --filter @objectstack/http-conformance exec
vitest run --maxWorkers=2 src/hono-comment-doors.conformance.test.ts`
after building the closure. Expected: 3 suites green; the unreact,
resolve/reopen and own-delete legs answer 200 on a kernel with no
`http.server`.
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY
<!-- signed: repo:objectstack#2 · os-steve ·
session_01ADHkmRY38EZf38Yy3zthbY -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 8da2b7e commit d463c46
25 files changed
Lines changed: 1176 additions & 30 deletions
File tree
- .changeset
- packages
- plugins/plugin-audit
- src
- qa
- dogfood/test
- http-conformance
- src
- runtime/src
- domains
- spec
- api-surface
- export-origins
- src/contracts
- scripts
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
| |||
528 | 530 | | |
529 | 531 | | |
530 | 532 | | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
531 | 543 | | |
532 | 544 | | |
533 | 545 | | |
| |||
1083 | 1095 | | |
1084 | 1096 | | |
1085 | 1097 | | |
1086 | | - | |
1087 | | - | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
1088 | 1101 | | |
1089 | 1102 | | |
1090 | 1103 | | |
| |||
1097 | 1110 | | |
1098 | 1111 | | |
1099 | 1112 | | |
1100 | | - | |
1101 | | - | |
1102 | | - | |
1103 | | - | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
1104 | 1121 | | |
1105 | 1122 | | |
1106 | 1123 | | |
1107 | | - | |
1108 | | - | |
1109 | | - | |
1110 | | - | |
1111 | | - | |
1112 | | - | |
1113 | | - | |
1114 | | - | |
1115 | | - | |
1116 | | - | |
1117 | | - | |
1118 | | - | |
1119 | | - | |
1120 | | - | |
1121 | | - | |
| 1124 | + | |
1122 | 1125 | | |
1123 | 1126 | | |
1124 | 1127 | | |
| |||
1150 | 1153 | | |
1151 | 1154 | | |
1152 | 1155 | | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
1153 | 1188 | | |
1154 | 1189 | | |
1155 | 1190 | | |
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
43 | 50 | | |
44 | 51 | | |
45 | 52 | | |
| |||
0 commit comments