Repository navigation
feat(plugin-hono-server)!: 删除 CRUD/discovery 便利面 —— 插件回归纯传输适配器(#4073 终点) - #4296
Merged
os-zhuang merged 4 commits intoJul 31, 2026
Merged
Conversation
…ugin is a transport adapter (#4073) Completes the retirement. HonoServerPlugin now owns the socket, the middleware and the three current-user endpoints, and nothing else. The data and discovery APIs have one owner each — @objectstack/rest and the runtime dispatcher (ADR-0076 D11). Deleted: raw C+R `/api/v1/data/:object` (+ `/:id`), this plugin's third `/api/v1/discovery` + `/.well-known/objectstack` payload, and the `registerStandardEndpoints` flag itself — gone, not defaulted off. With it go `DISCOVERY_ROUTE_SEGMENTS` and six imports (`IDataEngine`, `shouldDenyAnonymous`, both `ANONYMOUS_DENY_*`, `ApiRoutes`, `makeExecutionContextResolver`) that existed only to serve it. Unaffected: `/auth/me/*` + `/me/apps` (sole supply, unconditional since #4144), and every composed host — `os serve`, `objectstack dev`, cloud's objectos — which mount an owner that already answered these routes byte-identically either way (#4260). A host with NO owner keeps the boot warn, reworded to name both remedies now that opting in is not one of them. Tests, each decided on what it was actually pinning rather than swept: - `hono-discovery` / `hono-anonymous-deny` — deleted. Both existed wholly to test the retired routes. #2567's invariant is not lost with the latter: the gate lives in core and REST enforces it on the surface that survives. - `server-timing-e2e` — KEPT, repointed at `/auth/me/permissions`. #3361's regression value is "perf middleware + a handler that resolves the principal itself", not the route; the permission-set fixtures already fit. Its anonymous case asserts 200-without-timings instead of 401, because that endpoint answers anonymous callers rather than denying them — the invariant is the closed gate. - `client.hono` — KEPT, repointed at a REST-composed host. It is the ONLY coverage of `client.connect()` and the discovery handshake, so deleting it would have cost real signal; its #4018 assertions now read against REST's registry-driven discovery, where `metadata` IS advertised and answers. - `hono-standard-endpoints-default` → `hono-transport-only`. Its subject was the flag's default; it now pins the end state, including that passing the removed option resurrects nothing. - The two cases pinning `/me/*` ordering relative to the CRUD block are gone, with a note: #4088 made plugin-auth's catch-all fall through, so the ordering fragility they guarded no longer exists and is pinned directly in `auth-catchall-fallthrough.test.ts`. - Seven cross-package call sites simply drop the option. AGENTS.md gains the four rules this thread paid for — one route one owner, explicit composition over default magic, absence must be loud, machine-readable surfaces must not lie — plus the verification note: "who serves this path" is a question about the composed, PROVISIONED runtime. #4073 was answered wrongly three times, once per shortcut around that. Verified: plugin-hono-server 135/135, client 3 suites 9/9, runtime 4 integration suites 19/19, http-conformance 46/46, full build 71/71, package tsc clean, changed-file lint 0/0. Net −678 lines. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016gEeLZ4oTeSXG6fKG1r3vd
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
…-permissions-provider-iwtkqm # Conflicts: # packages/plugins/plugin-hono-server/src/hono-plugin.ts
Contributor
📓 Docs Drift CheckThis PR changes 2 package(s): 9 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
…-deny ledger
The Dogfood Regression Gate caught the deletion, which is the ledger doing its
job:
STALE covers — surface no longer in source: data:hono-plugin.ts:POST /data/:object
data:hono-plugin.ts:GET /data/:object/:id
data:hono-plugin.ts:GET /data/:object
`anonymous-deny-hono-data` classified an entry point that no longer exists, so
the row goes with its surface. Three places referenced it and each needed a
different answer:
- the matrix row itself — deleted, with a note on the section above it that the
#2567 invariant is UNCHANGED: it has one fewer implementation to hold it in,
not one fewer guarantee;
- `HIGH_RISK` — the id dropped from the list;
- the ratchet's own negative test `(a) a row that DROPS its covers` — it used
that row as its FIXTURE, so it would have passed vacuously or not at all.
Repointed at `anonymous-deny-meta`, which covers a live surface, so the test
still has a real classification to lose. This one mattered: silently letting
it fall through would have disarmed the ratchet that just caught this.
`showcase-anonymous-deny-surfaces.dogfood.test.ts` keeps every assertion — the
surface-level 401 is enforced by @objectstack/rest, the route's sole owner now.
Only its comments, which described the deleted raw-hono routes, are updated.
Verified: authz-conformance 8/8, full dogfood suite 430 passed / 3 skipped.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016gEeLZ4oTeSXG6fKG1r3vd
…2567 matrix The drift check flagged nine docs; eight carry none (the quickstart and authentication ones were settled in #4280, `http-protocol.mdx` entered only via the CORS change this branch merged from main, and `delegated-administration.mdx` came along as a same-package sibling with nothing to say about this). `authorization.mdx` was real, and it is the kind that matters most: it documents a SECURITY invariant, and it named the deleted surface twice — once in the list of HTTP surfaces the anonymous-deny decision is uniform across, and once in the implementation list, as `plugin-hono-server` `denyAnonymous`. Left alone, the permissions doc would promise a gate on an entry point that no longer exists. Both now read as history, matching how the same sentence already handles the retired GraphQL endpoint: the surface LEFT the matrix (v17, #4073) because the duplicate was deleted, not because it went ungated. The invariant is unchanged — `shouldDenyAnonymous` still backs REST `/data` and the dispatcher's metadata/AI paths, and the source-enumerating ratchet still fails CI on a new ungated surface. It just has one fewer door to hold shut. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016gEeLZ4oTeSXG6fKG1r3vd
os-zhuang
marked this pull request as ready for review
July 31, 2026 05:36
This was referenced Aug 13, 2026
Nenzyz
pushed a commit
to Nenzyz/objectstack
that referenced
this pull request
Dec 1, 2026
…oval (objectstack-ai#37128) Fixes objectstack-ai#36911 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户在列表页和记录页的关联页签里,对正在审批且被锁定的记录打开行菜单时,不再看到「编辑」,「删除」照旧保留。 - 属于记录页关联列表体验的修补,替用户省掉「点了编辑才被告知已锁定」这一步。 - 出错的话,最坏是锁定行的「编辑」仍然出现,点了会和以前一样弹出拒绝提示;改动可以直接撤回。 - 无 ## What changes The grid's row menu (`@object-ui/plugin-grid`) now follows the approval lock the grid's select-first cells already read. Both the list page and a record page's related tab (the related list's enlarged face, which renders `object-grid`) draw this menu, so both change together. - **The read.** It reuses the existing `useRowApprovalLocks` hook (`POST /api/v1/approvals/records/:object/locks`), which is not exported, and its rule `resolveApprovalLock`. Nothing is copied. The read is made once for the rows on screen, when a row's actions are first reached for: the existing `onActionsDemand` channel (pointer or focus on the actions cell, the "⋮" opening, the row context menu, the page bar's single-row menu). It is never made on first paint (the objectstack#35795 posture). The hook now also runs on a grid whose rows offer Edit, not only on a select-first grid. It still reads nothing until it is asked. - **The verdict.** A row whose lock read answered `locked: true` offers no Edit. That matches the record page, which draws no Edit on an approval-locked record (objectstack#35593). Delete stays for a record held by its own approval, because the server lets such a record be deleted and cancels its request (objectstack-ai#13568). The batch read answers only for that case. A line held because its master is held refuses delete too, so if objectstack-ai#37041 makes the read report such lines, the read must tell the two apart before this menu uses it. - **Hidden, not disabled.** Hidden follows the record page (objectstack#35593) and the row menu's own record-verdict posture (objectstack-ai#4296). The disabled-with-reason alternative was not taken. - **Only an answered lock counts.** The row is handed to the hook without its `approval_status` column, so the column does not stand in for a read. In each of these cases the menu stays as it was: a 501 (no approvals service), a `null` entry (a row the reader cannot read), a failed read, or a read not yet asked. The select-first cells keep their column fallback unchanged. Files: `ui/packages/plugin-grid/src/ObjectGrid.tsx` (hook gate and `demandRowActions`), `ui/packages/plugin-grid/src/objectGridActionsColumn.tsx` (Edit verdict and demand wiring), and the new test `ui/packages/plugin-grid/src/__tests__/rowMenuApprovalLock-36911.test.tsx`. `RowActionMenu.tsx` and `useRowApprovalLocks.ts` are unchanged. ### The reading this card asked for (served state) Tree: objectstack-ai/objectstack at 8e4ac50 (re-read at 1e96009). - **Declared per-row predicates** (`userActions.edit` / `delete` `visibleWhen` / `disabledWhen`): already served, and already followed by both related-list faces. - **The master's approval lock on its master-detail lines:** already followed. The record page withholds New, Edit and Delete on those lists (`withDetailWritesWithheld`, objectstack#35599 ruling A). - **The row's own approval lock:** served by the batch door. Before this PR the list page's row menu read none of it; the lock reached only the cells. This PR makes the row menu follow it. - **Package-hook refusals** (the HotCRM measured case): nothing serves them. The seat ruled for no Feature card. An app that wants the row menu to know declares the rule on the child object's `userActions` predicates. The toast from objectstack-ai#36885 covers refusals after the fact. ## Tests - New file `rowMenuApprovalLock-36911.test.tsx`, 7 pins. Five come from the first round: a locked row offers no Edit and keeps Delete, while its unlocked sibling keeps Edit; no lock read before a row's actions are reached for, then one read for the page and none on repeat; a 501 over an `approval_status: pending` row leaves the menu as it was; a `null` entry leaves Edit; a failed or not-yet-asked read leaves Edit. Two were added in fix round 1. **List page:** on the list page, a row's actions come from the single-row selection bar (`SelectionBar.tsx`), not a ⋮ column. With the locked row selected, the bar offers no Edit and still offers Delete; with its unlocked sibling selected, the bar offers Edit, which is the control. The bar already read the lock before this round, because it resolves its actions from the same `rowActionMenuProps` and asks through the same `onActionsDemand` on mount. No wiring was added; only the pin is new. **Read in flight:** the lock answer is held, the ⋮ menu is opened and Edit shows; the answer is released and Edit leaves the open menu while Delete stays. Result at 4c64a0a: 7/7 passed. - Ablation, run once and not kept: `canEdit && rowOps?.update !== false && !approvalLockAnswered(row),` was replaced by `canEdit && rowOps?.update !== false,` through `scripts/ablation-replace.mjs`. The mutation was confirmed on disk (anchor count 1 to 0, blob 2c0f37e to dc3f8dc5). The first pin turned red as predicted (Tests 1 failed, 4 passed). After the restore, the blob matched HEAD and `git diff HEAD` was empty. In fix round 1, the same ablation was run at 4c64a0a (blob c420482 to 2f180f3e) and turned 3 pins red: the ⋮ pin, the list-page bar pin and the in-flight pin (Tests 3 failed, 4 passed; the bar pin received `{ edit: true, delete: true }`). A second ablation changed `approvalLocks.isLocked(rowRecordId(row), null)` to `approvalLocks.isLocked(rowRecordId(row), row)`, which lets the `approval_status` column stand in (blob c420482 to be48f357). It turned the 501-over-pending-column pin red (Tests 1 failed, 6 passed; received `{ edit: false, delete: true }`). Both restores were confirmed: blob == HEAD and `git diff HEAD` empty. - Stale fixtures fixed in this PR. Two existing explain-engine fakes (`rowRecordCrudVerdict.test.tsx`, `inlineEditRecordVerdict-27365.test.tsx`) answered every URL as the explain engine. Once reaching a row's actions also read the lock door, they counted that read as an explain call: 19 tests red on the first full run. Each fake now answers the lock door "unlocked" and leaves it out of its call count. Their assertions are unchanged. Fix round 1 readings, at head `4c64a0a1`: the full plugin-grid suite gave `Test Files 312 passed (312) · Tests 2773 passed (2773)`, VERDICT command-exit 0. `pnpm --dir ui exec vitest run scripts/` gave 172 passed and 2 skipped files, 5130 passed and 2 skipped tests, exit 0. The 39 derived gate families all exited 0. One of them, `check:type-check-debt`, first hit a queue timeout (exit 3, not measured) and then exited 0 on a re-run. Reconciliation with `--ran` gave 39 derived, 39 run, 0 NOT-MEASURED. overlap-check exited 0 and merges cleanly with origin/main and with objectstack-ai#37084. The readings below are from the first round, at head `d4f56f4a` (which includes a merge of `origin/main` at 9d70768), unless a line says otherwise. <details><summary>Full plugin-grid suite: 312/312 files, 2771/2771 tests</summary> `cd ui && pnpm exec vitest run --maxWorkers=2 packages/plugin-grid/` under os-verify-lock: `Test Files 312 passed (312) · Tests 2771 passed (2771)`, VERDICT command-exit 0. The earlier run before the fixture fix, at 2f9deb3, was `2 failed | 310 passed` files, with the 19 tests named above. </details> <details><summary>Type-check and the ui scripts suite</summary> - `pnpm exec turbo run type-check --concurrency=2 --filter=@object-ui/plugin-grid` at abbeea2: 54/54 tasks, plugin-grid a cache miss (`tsc --noEmit && tsc -p tsconfig.test.json`), VERDICT command-exit 0. `tsc --listFilesOnly` confirms that `tsconfig.test.json` compiles all three changed test files. - At d4f56f4: `pnpm run type-check` in `ui/packages/plugin-grid`, exit 0. Declared narrowing: this ran without the lock, because the lock was held by a dogfood run past two 540-second budgets and `tsc --noEmit` writes nothing. The dependency type-checks are left to CI. - After building the seven `@objectstack` packages as Test UI does: `pnpm --dir ui exec vitest run --maxWorkers=2 scripts/` gave `Test Files 172 passed | 2 skipped (174) · Tests 5130 passed | 2 skipped`, VERDICT command-exit 0. </details> <details><summary>Derived gate families: 39 of 39 exit 0</summary> `node scripts/pm/dispatch-gates.mjs --commands` on this diff derived 39 commands, and every one exited 0 at d4f56f4. `pnpm check:changeset-fixed` was also run (exit 0), because its roster sits under `.changeset`. Reconciliation with `--ran` gave: `39 derived, 39 run, 0 NOT-MEASURED, 0 UNRUN (a DERIVED zero — all 39 recorded an exit code)`. `pnpm check:type-check-debt` exited 3 once on the first pass, at 2f9deb3, and was not measured then; both of its later runs exited 0. </details> <details><summary>overlap-check before each push</summary> Every run exited 0. The last one, at d4f56f4: `merges cleanly` with origin/main 9d70768, with objectstack-ai#37084, and with objectstack-ai#37079 (both also edit `ObjectGrid.tsx`). </details> ## Acceptance notes - **Not covered: the compact related-list face and the phone gallery.** The compact face is the `components` data-table (`DataTableBuiltinRowActionItem`). Neither can reach the grid's lock hook without a new dependency or export. No card is filed for this, per the seat's ruling. On those surfaces Edit on a locked row stays until it is refused, and the objectstack-ai#36885 toast explains the refusal. - **Detail lines read "not locked".** The batch lock door reports detail lines of a locked master as not locked until objectstack-ai#37041 lands. Its single-record sibling reports them as locked. On a record page those lines are already withheld (objectstack#35599), but on a detail object's own list page their Edit stays until objectstack-ai#37041. - **Edit is not held inert while the read is on the wire.** A click that lands before the answer opens the form as before, and the server's refusal is shown by the existing toast. The in-flight pin above fixes this behaviour. - **Note only: every row locked.** When every row on screen is locked and Delete is not offered (a predicate or a grant withholds it), the ⋮ column is not drawn. The record-grained verdict already behaves this way. - **Deliberate: 501 with a pending column.** On a 501, a row whose `approval_status` column reads pending is read-only in its cells (the cells use the column fallback), while its menu still offers Edit (the menu uses answered locks only). - **Possible follow-up, inherited: stale answers.** Lock answers can go stale while the grid stays mounted. The hook drops them only when the object's data is invalidated. - **Pre-existing: other edit paths.** Staged click-to-edit and the bulk Change owner action do not read the lock. ## Verification Read first (riskiest first): 1. `ui/packages/plugin-grid/src/objectGridActionsColumn.tsx`: `approvalLockAnswered` and the `canEdit` expression in `rowCrudVerdicts`, the one verdict both the column's draw decision and every menu read. 2. `ui/packages/plugin-grid/src/ObjectGrid.tsx`: the `useRowApprovalLocks` gate and `demandRowActions`, which together decide when the read is made. 3. `ui/packages/plugin-grid/src/__tests__/rowMenuApprovalLock-36911.test.tsx`. Two-minute check: `cd ui && pnpm exec vitest run packages/plugin-grid/src/__tests__/rowMenuApprovalLock-36911.test.tsx`. Expect 7 passed. --- _Generated by [Claude Code](https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D)_ <!-- signed: repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D --> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#4073 的终点。前置拆分(#4144)、证据(#4260)、默认值翻转(#4280)都已合并;按决定把删除也放进 17.0.0,不跨 major 拆成两次迁移。
净 −678 行。
HonoServerPlugin现在只拥有 socket、中间件和三条 current-user 端点 —— 数据面与 discovery 各自单一 owner(ADR-0076 D11)。删除
/api/v1/data/:object(含/:id)—— 直连 ObjectQL 的那份/api/v1/discovery+/.well-known/objectstackpayload —— 它早于DiscoverySchema,且缺services(D12 的 single source of truth),无法合规registerStandardEndpoints本身 —— 是删掉,不是默认关掉。传它现在是类型错误;用as never硬传也挂不出任何东西(有测试钉住)DISCOVERY_ROUTE_SEGMENTS与六个只为它存在的 import不受影响
/auth/me/*+/me/apps(唯一供给,#4144 起无条件注册);以及所有 composed 宿主 ——os serve、objectstack dev、cloud 的 objectos —— 它们挂的 owner 本来就在应答这些路由,且 #4260 已证两种 flag 位置下响应逐字节相同。无 owner 的宿主保留 boot warn,措辞改为点名两个 owner(因为"opt in"已不再是出路之一)。
测试:逐个按「它到底在钉什么」决定,而不是一刀切
hono-discovery、hono-anonymous-denyserver-timing-e2e/auth/me/permissionsclient.honoclient.connect()与 discovery 握手的测试,删掉会丢真实信号hono-standard-endpoints-defaulthono-transport-only/me/*相对 CRUD 块的两条顺序用例auth-catchall-fallthrough.test.ts直接钉住server-timing-e2e的匿名用例从断言 401 改为 200 且无 Server-Timing —— 该端点对匿名调用者是"如实回答"而非"拒绝",要钉的不变量是闸门没开,不是状态码。AGENTS.md:把这条线付过学费的四条规则写下来
一条路由一个 owner · 显式组合优于默认魔法 · 缺席要响亮 · 机器可读面不许撒谎。
外加一条验证方法:「谁在服务这条路径」是关于 composed 且 provisioned 运行时的问题 —— 不是关于谁声明了它、不是关于注册顺序、也不是关于一个能启动的最小 harness。#4073 被答错三次,每次正好对应绕过其中一条。
验证
迁移(changeset 内有完整 FROM → TO)
只有「挂
HonoServerPlugin但两个 owner 都不挂」的宿主受影响:挂createRestApiPlugin(完整 CRUD + 全闸门)或createDispatcherPlugin。没有 flag 可以退回。关联:#4073(终点)、#4280、#4260、#4144、#4088、#4018、#3298、#2567。
🤖 Generated with Claude Code
https://claude.ai/code/session_016gEeLZ4oTeSXG6fKG1r3vd
Generated by Claude Code