Skip to content

feat(rest): the recycle bin has REST doors, and a delete answer names the entry to undo (#30237 PR 5) - #31595

Merged
objectstack-fleet[bot] merged 8 commits into
mainfrom
claude/project-thread-py4hal
Nov 8, 2026
Merged

objectstack-fleet[bot] merged 8 commits into
mainfrom
claude/project-thread-py4hal

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Part of #30237

Clause-②: yes (widening)
Metadata-protocol: semantic
Skills-docs: follow-up #30847

Spec consent: 6721939207 (S1 DeleteDataResponseSchema.recycleBinEntryId, optional; S3 api-derivation.ts derives restore / purge from delete, docblock corrected). S2 (the EngineDeleteOptions out-channel) is NOT committed in spec: the callback is typed in objectql instead, see Acceptance notes. Claim amendment 6721792971. PR 5 of 5 (hand-over 6690307585): the recycle bin's REST doors. Also answers #30239 (the delete answer names the entry to undo).

维护者速读

  • 改了什么:回收站有了 REST 入口,一次一个对象:GET /data/:object/recycle-bin 列出条目(仅 manageRecycleBin 持有者,行值按调用者在该对象上的字段级权限裁剪,掩码字段不返回),POST …/:entryId/restore 恢复一条,DELETE …/:entryId 清除一条,DELETE …/recycle-bin 清空该对象的回收站。DELETE /data/:object/:id 的应答在写入回收站条目时带上 recycleBinEntryId,客户端可据此提供"撤销"。引擎新增 listRecycleBin,restore / purge 可限定条目所属对象;客户端新增 client.recycleBin.list / restore / purge / empty。
  • 为什么改:PR 1–4 已上线回收站及其权限,但只有引擎调用可达,用户和客户端无从列出、恢复或清除;ui: the admin recycle-bin page (list, restore, empty) and the 已删除 · 撤销 toast (#3146 slice 4) #30239 要求删除应答指明可撤销的条目。
  • 风险与回滚:放宽(Clause-② widening):新增四个 REST 入口和一个可选应答键。Metadata-protocol: semantic:对象的 API 派生集合在暴露 delete 时现在包含 restore / purge(此前恒为关闭),撤去 delete 的对象四个入口一律 405。列表在无权限解析器时拒绝(fail closed)。回滚即 revert,无数据迁移。
  • 先看:packages/rest/src/recycle-bin-routes.ts(四个入口、字段裁剪 servedFieldsOf、恢复回执 restoreReceipt、错误应答 answerThrown);packages/objectql/src/recycle-bin/list.ts(listRecycleBin 与 assertCallerManagesRecycleBin);packages/objectql/src/engine.ts(按 id 删除后的 onRecycleBinEntry);packages/spec/src/data/api-derivation.ts(S3)。
  • 两分钟验证:pnpm --filter @objectstack/rest exec vitest run src/recycle-bin-routes.test.ts 与 pnpm --filter @objectstack/objectql exec vitest run src/recycle-bin/list.test.ts,预期全部通过,含「answers 405 at every door of an object whose API withholds delete」「with only a read projection, withholds every field that declares a maskingRule」「refuses, 403, when no permission resolver answers」。
  • 需要你做的:无,席位落地(契约复核由席位执行)。

What changes

The doors (packages/rest/src/recycle-bin-routes.ts, new; seat ruling S4). Four routes under {data}/:object/recycle-bin, registered inside api.enableCrud before CRUD's /:object/:id (first match wins, the export precedent):

Door Exposure gate Engine call Answer
GET {data}/:object/recycle-bin restore listRecycleBin(object, { context, limit, offset }) { object, entries, hasMore }; each row's values cut to the caller's fields
POST {data}/:object/recycle-bin/:entryId/restore restore restore(entryId, { context, object }) the restore receipt; null → 404 RECORD_NOT_FOUND; a stale roll-up → 200 with what was written
DELETE {data}/:object/recycle-bin/:entryId purge purge(entryId, { context, object }) { object, entryId, purged: true }; false → 404
DELETE {data}/:object/recycle-bin purge empty(object, { context }) { object, removed }

The engine (objectql).

  • listRecycleBin(object, { context, limit, offset }) is a host-literal delegation.
  • It refuses a platform object 400, and a bad limit / offset 400 naming the parameter.
  • assertCallerManagesRecycleBin refuses 403 PERMISSION_DENIED unless the effective permissions grant manageRecycleBin on the object. It fails closed when no resolver answers or the resolver throws. The system is exempt.
  • An object with no bin, or a caller the wall denies, gets an empty page.
  • The read is newest first (deleted_at desc, id desc), with limit + 1 rows fetched to answer hasMore.
  • restore / purge take an optional object. An entry of another object answers null / false and nothing is dispatched.
  • callerRecycleBinManagement was factored out of the restore check, which keeps its text.
  • recycleBinPlatformObjectRefusal is exported from purge.ts.

The delete answer names the entry (#30239; seat ruling S2).

  • The by-id delete tells options.onRecycleBinEntry(entryId) the entry it wrote. It does so after the transaction commits, and only when the driver reports the row removed (not false or 0).
  • The callback is declared on objectql's exported RecycleBinDeleteObservability, and ObjectQL.delete takes EngineDeleteOptions & RecycleBinDeleteObservability. This is the WriteObservabilityOptions shape update already uses.
  • ENGINE_DELETE_OPTION_KEYS admits the key, and the drift pin lists it as delete's one type-only extra.
  • metadata-protocol deleteData answers recycleBinEntryId when it is told one.
  • @objectstack/client DeleteDataResult gains the key.

Spec (consent 6721939207; S1 and S3).

  • S1: DeleteDataResponseSchema.recycleBinEntryId: z.string().optional().
  • S3: restore: { all: ['delete'] }, purge: { all: ['delete'] }. The docblock and the isApiOperationAllowed comment are corrected, and api-derivation.test.ts is updated.
  • authorable-surface/api.json was regenerated by the build (one row).

Client. client.recycleBin.list(object, { limit, offset }), .restore(object, entryId), .purge(object, entryId) and .empty(object). The RecycleBinPage and RecycleBinRestoreReport types are added.

Route ledger, OpenAPI, discovery.

  • Four recycle-bin rows (disposition sdk, clients recycleBin.*).
  • The doors register on the route manager with summary and tags, so they appear in /openapi.json through getRoutes().
  • Discovery is unchanged: the doors sit under routes.data (S4, no ApiRoutesSchema change).

Docs.

  • content/docs/protocol/kernel/http-protocol.mdx: the "no recycle-bin runtime" warning is replaced. It gains a "Recycle Bin" section with the doors table, and the delete answer example now shows recycleBinEntryId.
  • content/docs/permissions/system-context.mdx: row 29f owns the list check's isSystem read. The register was regenerated with --write.

Tests

  • packages/rest/src/recycle-bin-routes.test.ts (new, 33):
    • Every door's happy path and engine arguments.
    • FLS through getQueryableFields; the read-projection fallback withholds maskingRule fields; no answer leaves only the id.
    • The snapshot is never served.
    • Closed and declared query parameters.
    • The engine's 403, the 409 refusal details, and 404s.
    • A stale roll-up → 200.
    • The restore receipt drops anything the report carries beyond its five members.
    • An anonymous caller is refused before anything is listed; 501 when the engine has no bin; an unexpected fault is a 500 without its message.
    • The exposure describe: an object whose API withholds delete → 405 at all four doors, and no engine verb is called.
  • packages/objectql/src/recycle-bin/list.test.ts (new, 26):
    • Ordering and paging.
    • manageRecycleBin / modifyAllRecords allowed.
    • No resolver, allowRestoreOwnDeleted only, allowDelete only, manage without read, manage on another object, and a throwing resolver are each refused 403 with no read.
    • System, wall deny, no bin, platform 400, bad paging.
    • restore / purge under another object.
    • onRecycleBinEntry: told after removal; not told for permanent, no bin, a platform object, or a driver answering false / 0; not told when the removal throws, and the entry goes with it.
  • packages/metadata-protocol/src/protocol.delete-recycle-bin-entry.test.ts (new): the answer carries recycleBinEntryId and parses against DeleteDataResponseSchema; no key when no entry was written.
  • Census and pins updated for the new module:
Ablations (9, each red, each restored to HEAD by scripts/ablation-replace.mjs)

A1–A4b run objectql src/recycle-bin/list.test.ts, A5–A9 run rest src/recycle-bin-routes.test.ts.

  • A1-list-manager (the manager refusal never throws): 6 failed | 18 passed; e.g. "refuses, 403, when no permission resolver answers: it fails closed, and reads nothing"
  • A2-restore-object (object mismatch line deleted): 1 failed | 23 passed; "restore answers null, and dispatches nothing, for an entry of another object"
  • A3-purge-object (object mismatch line deleted): 1 failed | 23 passed; "purge answers false, and dispatches nothing, for an entry of another object"
  • A4b-callback-on-unremoved (entry told whatever the driver answered): 2 failed | 24 passed; "does not call back when the driver answers false (not found)", "… 0 (kept)"
  • A5-rest-exposure (the purge door's exposure gate removed): 1 failed | 32 passed; "answers 405 at every door of an object whose API withholds delete, and calls no engine verb"
  • A6-fls-fields (every value served): 3 failed | 30 passed; e.g. "lists the object's entries as the caller, with each row's values cut to the fields it may query on"
  • A7-mask-fallback (fallback keeps masked fields): 1 failed | 32 passed; "with only a read projection, withholds every field that declares a maskingRule"
  • A8-restore-receipt (engine report served verbatim): 1 failed | 32 passed; "answers a receipt, never a record body: a member the report carries beyond its five is not served (The write-response internal-field tripwire walks the protocol class only — a direct engine write mouth outside it (rest-server's batch ql.update) is covered by the fix but not by the guard #8497)"
  • A9-paging-declared (limit declared as any number): 3 failed | 30 passed; e.g. "refuses {"limit":"1.5"} through its declaration (limit), 400 naming the parameter"

A first A4 leg (entry id taken before driver.delete) stayed green. A throwing removal skips the callback by exception propagation alone, so that pin cannot see the placement. The "driver answers false / 0" pin (A4b) was added for the case that the placement does decide.

Acceptance notes

  • Deviations from the claim surface (6721792971), each needed by the delete answer or by a gate:

    • packages/metadata-protocol (deleteData answers the key)
    • packages/client (recycleBin.*, the DeleteDataResult pin)
    • the spec test api-derivation.test.ts
    • the regenerated content/docs/references/api/protocol.mdx (one row, from S1)
    • the generated authorable-surface/api.json
    • scripts/check-route-envelope.mjs (the new module's declaration)
  • Metadata-protocol: semantic, and @objectstack/spec is minor. The authorable-surface shard moved, so none is refused by check-changeset-no-major, and the derived restore/purge exposure changes meaning. The other four packages are patch.

  • A row the driver does not remove keeps its bin entry. A by-id delete whose driver answers false / 0 still leaves the entry written before it. The answer no longer names it. Compensating it there would also drop any cascaded children captured in the same entry, so it is left as it was before this PR (PR 1 behaviour) and is not changed here.

  • S2 was taken out of spec. Putting the callback on EngineDeleteOptions had two effects:

    • It turned the bare alias into an intersection, so check:spec-parsed-alias (ADR-0122) asked for a line to be deleted from type-alias-convention.pin.test.ts.
    • HookDeleteOptions = Omit<EngineDeleteOptions, …> (hook-api.ts) would have given app hook bodies the callback.

    Both files are outside consent 6721939207. The callback is therefore typed in objectql, beside the options, the way update's WriteObservabilityOptions are. data-engine.zod.ts is byte-identical to main. The spec diff is now S1 + S3 only, which is narrower than the consent.

  • The list rides the restore exposure gate (there is no list verb on the bin). Purge and empty ride purge.

Verification

Head 274a8241fc (origin/main 6ed533f6b6 merged). 32 files changed, +1804 / −49.

  • node scripts/pm/dispatch-gates.mjs --commands: 140 families, each run with its exit captured before any pipe. Every one exits 0 on the final tree. --ran reconciliation: 140 derived, 140 run, 0 NOT-MEASURED, 0 UNRUN.
  • The first pass, on an earlier head, had seven reds. All were fixed before the final pass:
    • an objectql DTS type error, which also cascaded into check:dts-closure, check:dual-build-cjs-loads, check:type-check-debt and check:skill-examples
    • check:docs (the protocol reference regenerated)
    • check:spec-parsed-alias (answered by taking S2 out of spec)
    • check:test-source-alias (module-top side-effect imports in six touched tests)
  • spec check:generated: exit 0. check:system-context-census (row 29f + --write) and check:route-envelope: exit 0.
  • tsc --noEmit for spec, objectql, metadata-protocol, client and rest: exit 0. eslint (--no-inline-config) over the 27 touched source files: exit 0.
  • Tests on the final tree:
Suite Files Tests
objectql (full) 572 11602
rest (full) 400 7917 (+355 skipped)
metadata-protocol (full) 328 (+4 skipped) 22593 (+26 skipped)
client (full) 56 721
spec src/data + src/api 225 8071 (+1 todo)

Ablations A1–A3 and A5–A9 were measured at 3e3d14d7b4 (those files are unchanged since). A4b was re-measured at the final guard text: 2 failed | 24 passed, restored to HEAD.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FEkQ5nYzXijPZzrM68FB5J

…the delete answer's recycleBinEntryId

The recycle bin (ADR-0148) is reachable over HTTP, one object at a time,
under {data}/:object/recycle-bin: GET lists the object's entries for a
caller who manages its bin (FLS on each row), POST /:entryId/restore writes
one entry back, DELETE /:entryId purges one and DELETE empties the bin. An
entry addressed under another object is not found; every door has a closed
query-parameter set and passes the object's API exposure, where restore and
purge now derive from delete.

The engine gains listRecycleBin (fail-closed manager check), an optional
object on restore/purge, and an onRecycleBinEntry delete callback that the
protocol's deleteData uses to answer recycleBinEntryId. The client gains
client.recycleBin.list/restore/purge/empty.

Spec consent: 6721939207 (DeleteDataResponseSchema.recycleBinEntryId, the
EngineDeleteOptions callback, restore/purge derived from delete).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nYzXijPZzrM68FB5J
…tract 0 through unknown; regenerate the protocol reference

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nYzXijPZzrM68FB5J
…ngine's options, not on the spec type; pay lazy loads at collection in the touched tests

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nYzXijPZzrM68FB5J
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation protocol:data tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 5 package(s): @objectstack/client, @objectstack/metadata-protocol, @objectstack/objectql, @objectstack/rest, @objectstack/spec, touching 128 documentable anchor(s). ⚠️ 2 changed file(s) yielded no anchor (packages/objectql/src/index.ts, packages/spec/authorable-surface/api.json), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

70 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json cb7b3ccbc71ecbcf6bc8acea6478e74eec59ea10.

⛔ 16 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 2 changed file(s) yielded no anchor (packages/objectql/src/index.ts, packages/spec/authorable-surface/api.json) — pages documenting those are invisible to this run
  • 6 cross-cutting symbol(s) contributed no route anchor: enforceAuth (30 routes), resolveExecCtx (35 routes), routeManager (25 routes), recordId (4 routes), enforceApiAccess (12 routes), resolveProtocol (29 routes)
  • 4 anchor(s) matched too much of the corpus to be a work list: ObjectQL (symbol, 80 pages), PERMISSION_DENIED (literal, 51 pages), VALIDATION_FAILED (literal, 44 pages), /data/:object (route, 77 pages)
  • 6 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 231 client-bound route-ledger rows — the other 166 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 166: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 107 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 180 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json cb7b3ccbc71ecbcf6bc8acea6478e74eec59ea10 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from c39a68c749eb31eb1b92add629bd33220d67f0eb — the merge of head b18b209442336a431e51c44587873c8f85e09145 into base cb7b3ccbc71ecbcf6bc8acea6478e74eec59ea10, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin c39a68c749eb31eb1b92add629bd33220d67f0eb && git checkout c39a68c749eb31eb1b92add629bd33220d67f0eb
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin cb7b3ccbc71ecbcf6bc8acea6478e74eec59ea10 b18b209442336a431e51c44587873c8f85e09145 && git checkout -B drift-repro cb7b3ccbc71ecbcf6bc8acea6478e74eec59ea10 && git merge --no-ff b18b209442336a431e51c44587873c8f85e09145

node scripts/docs-audit/affected-docs.mjs --json cb7b3ccbc71ecbcf6bc8acea6478e74eec59ea10

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs cb7b3ccbc71ecbcf6bc8acea6478e74eec59ea10 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

… new it.each tuples

restore and purge derive from delete since the recycle bin's doors
landed, so the full closure the security layer annotates now carries
both; the it.each tables in the two new test files are typed so the
package test layers compile.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nYzXijPZzrM68FB5J
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#3 · os-project-manager · session_01FEkQ5pXkgNXVpCn2GZDjyy

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 2b5217d3fd646120ef44a6f29d5120f8a2b5c251
Local-runs: none
Scope: packages/spec/src/api/protocol.zod.ts, packages/spec/src/data/api-derivation.ts + packages/rest/src/recycle-bin-routes.ts, packages/rest/src/rest-server.ts, packages/rest/src/rest-route-ledger.ts, packages/objectql/src/recycle-bin/list.ts, packages/objectql/src/engine.ts, packages/objectql/src/engine-top-level.ts, packages/objectql/src/recycle-bin/restore.ts, packages/objectql/src/recycle-bin/purge.ts, packages/metadata-protocol/src/protocol-data-writes.ts, packages/client/src/index.ts, content/docs/protocol/kernel/http-protocol.mdx

Inputs read: card #30237 body and all 41 comments (consent 6721939207 S1–S3 = A; amendments 6721792971, 6721834323; hand-over 6690307585; rulings Q1–Q7, 6691358077, 6718336940, 6720657486), PR #31595 body and 34-file list, git diff origin/main...pr-31595 at 2b5217d3, the check-runs on 2b5217d3 (every required run success; the rest skipped by filter; none failed — Lint & Repo Gates, Type Check · workspace/consumer/source/debt, Test Core 1–8, Test UI 1–16, Build & E2E UI, Live E2E UI, Dogfood Regression Gate, Governed Surface Queue Guard, Check Changeset, Spec property liveness, PR-body guards, Build Docs, Check Documentation Links all green). The rest of the diff (tests, census pins, authorable-surface/api.json, generated content/docs/references/api/protocol.mdx, content/docs/permissions/system-context.mdx register, scripts/check-route-envelope.mjs, packages/objectql/src/index.ts re-exports, the changeset) is the lane seat's ACCEPT at TIER_DEFAULT.

① Derived judgments

Each accept-set or public-surface change the diff implies, judged against the tree:

  • S1 DeleteDataResponseSchema.recycleBinEntryId: z.string().optional() — a response-side widening; authorable-surface/api.json gains the one row and references/api/protocol.mdx the one table row (both regenerated). Right.
  • S3 API_METHOD_DERIVATION.restore/purge = { all: ['delete'] } — the effective closure of every object exposing delete grows by two verbs. Consumers read in the live tree and each moves with it: apiAccessDenialFromEnable (REST 405 allowed, rest-server.ts:584–592), canServeApiOperation → core annotateEffectiveApiOperations (/me/permissions, re-pinned in effective-object-permissions.test.ts and plugin-hono-server effective-api-operations.test.ts), nav servability (asks list, unaffected). Core's EXTERNAL_WRITE_GATED_OPERATIONS already lists restore/purge, so the ADR-0015 Gate-3 clamp covers them without change. Right.
  • S2 not committed in spec — data-engine.zod.ts is byte-identical to main; the out-channel is RecycleBinDeleteObservability.onRecycleBinEntry in objectql, intersected onto ObjectQL.delete's options and admitted by ENGINE_DELETE_OPTION_KEYS. HookDeleteOptions = Omit<EngineDeleteOptions, …> therefore does not inherit it, so app-authored bodies are not told entry ids. Narrower than consent 6721939207, in the direction the consent allows; no spec parsed-alias moves. Right.
  • REST public surface: four doors under {data}/:object/recycle-bin registered inside api.enableCrud ahead of the greedy /:object/:id (pinned); four recycle-bin ledger rows with disposition: 'sdk' and client: recycleBin.*, which the client implements; OpenAPI via routeManager metadata; ApiRoutesSchema unchanged (seat's call 6721834323). Right.
  • Wire delete answer: deleteData adds recycleBinEntryId only when told; crud-routes.ts:558 relays res.json(result) and the objectql: a published roll-up summary that sums a text field makes every create, update and delete of its child answer 500, though each write lands — the authoring door does not check the summed field's type #28661 stale-summary path rides withEarnedAnswer(stale, answer), so the key reaches the wire on both paths. Client DeleteDataResult.recycleBinEntryId? matches. Right.
  • objectql public surface: ObjectQL.listRecycleBin, RecycleBinListOptions/Result/ListedEntry, RecycleBinDeleteObservability, RECYCLE_BIN_LIST_{DEFAULT,MAX}_LIMIT; restore/purge options gain object. All additive. Right.
  • System-context register: row 29f for assertCallerManagesRecycleBin (the one new isSystem read). Right.

② Semver level

.changeset/30237-recycle-bin-rest-doors.md: @objectstack/spec: minor, objectql / metadata-protocol / rest / client patch. Clause-②: yes (widening) is right: new doors, a new optional response key, a larger derived exposure set; nothing is refused that was accepted. Metadata-protocol: semantic is right: an authored apiMethods whitelist that grants delete now means restore/purge are exposed too (a changed meaning of an accepted value; no key added or removed). Under AGENTS.md step 3 a kind takes at least minor on a package the diff moves and the protocol change lives in @objectstack/spec, so minor there and patch elsewhere is the rule's grading (non-protocol widenings ship patch); Check Changeset is green on the head. Both declaration lines appear line-initial in the PR body and the changeset. The Skills-docs: line cites #30847 as the card requires. Clause-②: yes (widening) — matches the diff.

③ Boundary flags

  • Claim-surface deviations (PR body, Acceptance notes): packages/metadata-protocol deleteData, packages/client recycleBin.* and engine.ts listRecycleBin are admitted by amendment 6721834323. Not named in any amendment: api-derivation.test.ts, the regenerated protocol.mdx / api.json, scripts/check-route-envelope.mjs, the core and plugin-hono-server pin tests, system-context.mdx row 29f, http-protocol.mdx. Each is a test, a generator output or the prose the doors make true, inside the "tests, docs pages the doors make false" clause of 6721792971. Answered: in surface; the seat records them in one amendment line.
  • Metadata-protocol: semantic / spec minor — answered in ②: right.
  • "A row the driver does not remove keeps its bin entry" (dev out-of-scope finding, class b, "noted, not filed"): pre-existing since PR 1; this PR correctly withholds the id for false/0 (pinned). Answered for this PR. Escalated: it should be a filed card, not a note — a bin entry snapshotting a row that is still live is a ghost entry an admin can see and try to restore (the id probe refuses it RESTORE_UNIQUE_VALUE_TAKEN, so no duplicate, but the entry is noise until the TTL reaps it). Seat files it.
  • S2 taken out of spec — answered in ①: a narrowing of the dev's own consented scope; the maintainer need not be re-asked.
  • The list rides the restore exposure gate — reasoned (there is no list verb on the bin in ApiOperation; the listing is the restore page's read). Accepted; the recycle-bin-routes.ts header says so.
  • Seat addition: a sys_ object exposing delete is annotated restore/purge while the bin answers 400 — graded in ④ as nit + follow-up card, with the reasoning.
  • Not flagged by the dev, found here: spec prose outside consent 6721939207 that S3 makes false (④, N2). The step-1 spec report should have named them; they go to a follow-up card.
  • dev report open_questions: [].

④ Design judgment

packages/spec/src/api/protocol.zod.ts (S1) against consent 6721939207 S1 and its first consumer. deleteData (protocol-data-writes.ts) hands the engine onRecycleBinEntry and spreads the key only when told; the engine tells it only from the by-id arm, only when bin.write() produced an entry and the driver's answer was neither false nor 0, after the unit it opened has returned (engine.ts ~:9064–9108). So the key is present iff the answer's success: true and an entry exists to restore — exactly what a POST …/recycle-bin/:entryId/restore needs. A platform object, multi, permanent and a composition with no bin open no capture, so no id. Parsed against the schema in protocol.delete-recycle-bin-entry.test.ts. Holds.

packages/spec/src/data/api-derivation.ts (S3) against consent 6721939207 S3 and its first consumers. isLegacyDerivable with no flag reduces to rule.all.every(...), so restore/purge follow delete exactly: unrestricted → present; ['get','list','create','update'] → absent; [] → absent (all pinned). The isApiOperationAllowed comment no longer claims a permanently-off flag. enforceApiAccess asks 'restore' on the list and restore doors and 'purge' on purge and empty, so the gate decision and the 405 allowed array come from the one table (pinned: 405 at all four doors when delete is withheld, no engine verb called). ADR-0148 D5's sentence that the retired authored apiMethods values restore/purge stay retired still holds: the authored enum is unchanged and stripLegacyApiMethods still strips them; only derivation moves, as the ruling says. Holds, with one prose nit (N1).

Implementing files, sentence by sentence against the contract they implement:

  • recycle-bin-routes.ts: each door passes enforceAuth, the closed query set (limit/offset on the list, none on the acts; repeats refused), the exposure gate, then the engine as the caller. FLS on the list follows ISecurityService.getQueryableFields's own contract (security-service.ts:680–703): queryable = readable minus masked; with no getQueryableFields every field declaring a maskingRule is withheld whoever asks; no answer → id alone; no service → values as stored; clearedReferences never served. The restore answer is a five-member receipt (The write-response internal-field tripwire walks the protocol class only — a direct engine write mouth outside it (rest-server's batch ql.update) is covered by the fix but not by the guard #8497). answerThrown orders 503 (authz store) → 400 VALIDATION_FAILED (declared paging) → sandbox fault → classified refusal with REFUSAL_DETAIL_KEYS (incl. parentEntryId for RESTORE_PARENT_IN_RECYCLE_BIN, param for the engine's 400) → 500 with text withheld. Agrees with the hand-over (list for managers, FLS on the live object, closed query sets) and the changeset's sentences.
  • rest-server.ts: the host literal hands the module exactly the RecycleBinRouteHost members; registration sits inside if (this.config.api.enableCrud) before registerDataActionEndpoints, so the two-segment literals win over /:object/:id (mount-table pin updated).
  • list.ts: platform object refused 400 before any permission is asked; paging bounds 1–200 / ≥0 refused 400 naming the param; assertCallerManagesRecycleBin fails closed (no resolver, throwing resolver, no entry for the object → 403) and exempts the system (row 29f); no bin → empty page; wall deny → empty page; the read is scoped through buildDriverOptions(RECYCLE_BIN_OBJECT, context) as purge.ts scopes; newest first, limit + 1 for hasMore. Agrees with ADR-0148 D2 Permissions ("an admin sees all — lists every entry") and D5.
  • restore.ts / purge.ts: options.object mismatch answers null / false before any dispatch (pinned); callerRecycleBinManagement is a pure refactor of the PR 4 check with its text kept; recycleBinPlatformObjectRefusal and parseSnapshot are exported unchanged in behaviour.
  • engine.ts / engine-top-level.ts: the callback is a closure-free type intersection, admitted by ENGINE_DELETE_OPTION_KEYS with the drift pin updated; called once, after result is assigned, guarded by typeof === 'function'.
  • client/src/index.ts: the four methods hit the ledger's exact paths with encodeURIComponent on both segments and unwrapResponse; DeleteDataResult gains the optional key. Types mirror the door's answers (nulls for absent entry fields, as the door sends them).
  • http-protocol.mdx: the doors table, the who-may column (manageRecycleBin / allowRestoreOwnDeleted), the 404 for a mis-addressed entry, the four 409 codes and the recycleBinEntryId example agree with the code above. The retired "no recycle-bin runtime" warning is gone.

Findings (graded; none is a must-fix or should-fix):

Tried to break: an anonymous caller (401 before anything is listed, pinned); a caller with allowDelete but no manager bit (engine 403, pinned in list.test.ts); a repeated ?limit= (400 before the gate); an entry addressed under another object (null/false → 404, no dispatch); a sandboxed hook fault on restore (answered as the data doors do); a stale roll-up after restore (200 with what was written); onRecycleBinEntry passed as a non-function from an in-process caller (ignored by the typeof guard); a wire body cannot carry a function, and HookDeleteOptions does not inherit the key.

Implemented-by: claude/project-thread-py4hal
Reviewed-by: session_01FEkQ5pXkgNXVpCn2GZDjyy

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#3 · os-project-manager · session_01FEkQ5pXkgNXVpCn2GZDjyy

席位意见:ACCEPT · Head-sha 2b5217d3fd646120ef44a6f29d5120f8a2b5c251 · 2026-11-08T17:40Z。本 PR 不在 governed 面上,由席位落地,维护者不需要操作。

席位核对

  • 形态: draft,目标 main,首行 Part of #30237(PR 5,五个里的最后一个;合并后席位核对完再关卡)。Clause-②: yes (widening)、Metadata-protocol: semantic 都在行首;spec 是 minor,其余包是 patch。
  • 维护者同意: spec 改动 S1(DeleteDataResponseSchema.recycleBinEntryId,可选)和 S3(api-derivation.ts 让 restore/purge 跟随 delete 派生)有维护者同意 6721939207。S2 没有进 spec,回调在 objectql 里定型,这是收窄了自己的同意范围,不需要再问维护者。
  • 契约复审(CONTRACT_REVIEW_TIER,schema 面): 6724784594 PASS,就在本 head 上。复审代理全程跑在本档,没有回落。只有 nit,没有必修或应修:
  • CI 红修复(274a8241 → 2b5217d3): 只改测试文件。objectql 和 rest 两处 it.each 元组的类型错误已修;apiOperations 选了读法 (a):业务对象的门确实提供 restore/purge,所以 core 和 plugin-hono-server 的派生集钉子跟着扩大。dev 本地跑了 core 3243/3243、plugin-hono-server 484/484、plugin-security 5904,以及 dogfood、mcp、webhooks、approvals 的相关文件,全部通过。
  • 门禁(check-runs @ 2b5217d3): 57 个 success,8 个 skipped,0 个失败,mergeable clean。fix(cloud-connection): record an unmanaged copy from the row the import wrote #31570(也改 metadata-protocol)已先合并,合并队列会在合并后的树上再跑一遍。
  • 落地条款: check-governed-merges --pr 31595:0 个 governed,+1812/−54,走普通队列。席位把它转为 ready 并开启 auto-merge。

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 42506290340 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Dogfood Regression Gate (1/3) — 失败步骤: Boot example apps and exercise real user flows

    @objectstack/dogfood:test:  FAIL   isolated  test/authz-conformance.test.ts > ADR-0056 D10 — authorization conformance matrix > is a sound conformance ledger (ADR-0060 checkLedger) + the #2567 surface
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: UNCLASSIFIED surface — add a ledger row (ADR-0060): rest-family:rest-route-ledger.ts:recycle-bin: expected [ Array(1) ] to deeply equal []
    @objectstack/dogfood:test:  FAIL   isolated  test/authz-conformance.test.ts > the ledger-sourced population and its baseline bite > the classified ledger keys really are classified — the baseline is n
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: expected 42 to be 43 // Object.is equality
    @objectstack/dogfood:test:  FAIL   isolated  test/authz-conformance.test.ts > #2567 — anonymous-deny surface ratchet bites > the real matrix + real discover is sound (baseline lock)
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: expected [ Array(1) ] to deeply equal []
    @objectstack/dogfood:test:  FAIL   isolated  test/authz-conformance.test.ts > #9083 — a wired transport is admitted only by an `enforced` row > (j) leg 2 — appending the key to the EXPERIMENTAL realti
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: expected [ Array(1) ] to deeply equal []
    @objectstack/dogfood:test:  FAIL   isolated  test/authz-conformance.test.ts > #9083 — a wired transport is admitted only by an `enforced` row > (k) the `removed` state admits no exit either — all thre
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: expected [ Array(1) ] to deeply equal []
    @objectstack/dogfood:test:  FAIL   isolated  test/authz-conformance.test.ts > #9083 — a wired transport is admitted only by an `enforced` row > (l) an `enforced` row naming its enforcement site DOES a
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: expected [ Array(1) ] to deeply equal []
    @objectstack/dogfood:test:  FAIL   isolated  test/authz-conformance.test.ts > #17111 — the matrix docblock's ledger figures are pinned to the ledgers > every figure the docblock states equals what its
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: expected [ Array(1) ] to deeply equal []
    @objectstack/dogfood:test:  FAIL   isolated  test/authz-conformance.test.ts > #17111 — the matrix docblock's ledger figures are pinned to the ledgers > a stale GROUP count is RED — the #20102 drift (a
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: the doctoring must land, or this case proves nothing: expected '// Copyright (c) 2026 ObjectStack. Li…' not to be '// Copyright (c) 2026 ObjectStack. Li…' //
    @objectstack/dogfood:test:  FAIL   isolated  test/authz-conformance.test.ts > #17111 — the matrix docblock's ledger figures are pinned to the ledgers > DELETING the figure is RED — the pin cannot be s
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: expected '// Copyright (c) 2026 ObjectStack. Li…' not to be '// Copyright (c) 2026 ObjectStack. Li…' // Object.is equality
    @objectstack/dogfood:test:  FAIL   isolated  test/authz-conformance.test.ts > #17111 — the matrix docblock's ledger figures are pinned to the ledgers > a SECOND present-tense copy of a figure is RED —
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: expected '// Copyright (c) 2026 ObjectStack. Li…' not to be '// Copyright (c) 2026 ObjectStack. Li…' // Object.is equality
    @objectstack/dogfood:test:  FAIL   isolated  test/authz-conformance.test.ts > #17111 — the matrix docblock's ledger figures are pinned to the ledgers > the anchor is the PATH, so the dated drift note 
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: expected [ Array(1) ] to deeply equal []
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

  • test/authz-conformance.test.ts — 24h 窗口内只有本 PR 撞到过,暂不汇总(再有一个不同 PR 撞到就会自动开汇总 issue)。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 2 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

…ormance matrix

The four doors open with the anonymous floor; the proof drives each one
anonymously (401) and with the admin on one boot. The rest ledger now
holds 20 families.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nYzXijPZzrM68FB5J
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#3 · os-project-manager · session_01FEkQ5pXkgNXVpCn2GZDjyy

席位意见:ACCEPT · Head-sha b18b209442336a431e51c44587873c8f85e09145 · 2026-11-08T19:09Z(接续 6724821378,那次在 2b5217d3 上)。

席位核对(delta 2b5217d3..b18b2094)

  • 起因: 合并队列构建 42506290340 的 Dogfood Regression Gate 1/3 红了(6725083712)。新的 recycle-bin REST 家族在 ADR-0060 授权一致性账本里没有归类,PR 侧的 dogfood 分片按路径跳过了,所以只有跑全量的队列才看得到。这是本 PR 自己的问题。
  • 改动: 只动了 packages/qa/dogfood/test 下的 3 个测试文件(+77/−2),没有碰生产代码,也没有碰契约面,所以 at-tier 复审 6724784594 的范围不受影响。
  • 证据: dev 本地 authz-conformance 60/60,证明文件 88/88,dogfood 全量 440 个文件、3641 个测试全部通过。删掉列表门的 enforceAuth 之后,对应用例变红(ablation)。
  • 门禁(check-runs @ b18b2094): 57 个 success,8 个 skipped,0 个失败,mergeable clean。check-governed-merges:0 个 governed,+1889/−56。
  • 落地: 席位重新开启 auto-merge。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation protocol:data size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant