Skip to content

Commit 0306761

Browse files
docs(skills): objectstack-api teaches the recycle bin a by-id delete keeps, not a hard delete (#30994)
<!-- claude-projects-attribution: {"github_login":"huangyiirene"} --> _Requested by **Irene** · [project thread](https://claude.ai/code/project/chan_01TJXtQ1tVD26ecLDZxFS67x?thread=cmsg_01TJXtQ1tVD26ecLDZxFS67xMd2uojmQxPgwLMrBLkrFXY)_ Refs #30847 Clause-②: no Metadata-protocol: none The maintainer's standing order in this project (2026-11-03) waives the contract-review model tier that `dispatch-gates` mandates for `skills/**` (clause ①); this PR was developed below that tier, and the dispatching seat runs the contract review. ## 维护者速读 - 改了什么:`skills/objectstack-api/SKILL.md` 三处:L48 路由表 `DELETE` 注释由 "hard delete" 改为 "business-object rows → recycle bin";派生动词说明 `restore` / `purge` 不派生的理由由"trash 面已退役"改为"回收站还没有 restore / purge 入口";陷阱第 2 条改写为:按 id 删除业务对象会把行保留在 `sys_recycle_bin`(默认 30 天),`multi: true` 删除、平台行、回收站上线前删除的行不在其中,目前没有任何 API 能列出或恢复它(`sys_recycle_bin` 为 `apiEnabled: false`),不要自造软删除。评测 `evals/endpoints-auth-routes.json` 第 5 例的期望同步改为回收站的说法。另加一条 changeset。 - 为什么改:PR #30780(ADR-0148)合入后,按 id 删除会把行快照进回收站,技能却仍教"硬删除、没有回收站",读技能的 agent 会自造软删除,或告诉用户删除的记录无法找回。 - 风险与回滚:只改技能文本,运行时零改动;三段各自行数不变,文件 441 → 441 行,token 5141 → 5157(上限 6314 不动,不付账);回滚即 revert。 - 先看:SKILL.md L48、L268-270、L417-420;评测第 5 例。 - 范围:本 PR 只做 triage 审计要的"立即纠正"部分,所以写 `Refs` 不写 `Fixes`;restore / purge 入口、权限与 REST 路由的教学等 #30237 的 restore 与 REST 入口 PR 落地后再补。 - 需要你做的:Tier H(`skills/**`),需要受管审批人在 GitHub 上 Approve 一次;之后席位落地。 ## What changes `skills/objectstack-api/SKILL.md`, three passages, each at its original line count: | Where | Before | After | |:--|:--|:--| | L48, data route block | `DELETE … # Delete record (hard delete)` | `DELETE … # Delete record (business-object rows → recycle bin)` | | L268-270, derived verbs | "`restore` / `purge` never derive — the trash surface is retired." | "`restore` / `purge` never derive: the recycle bin has no restore or purge door yet." (re-flowed inside its own three lines) | | L417-420, pitfall 2 | "ObjectStack `DELETE` is a hard delete — there is no recycle bin. For recoverability, use per-field `trackHistory` … or a `lifecycle` archive policy instead of custom soft-delete logic." | "**Treating `DELETE` as final or as restorable.** A by-id delete keeps a business object's rows in the recycle bin (`sys_recycle_bin`, 30 days by default; not `multi: true` deletes, platform rows or rows deleted before the bin existed); nothing lists or restores it over the API yet. No soft-delete." | `skills/objectstack-api/evals/endpoints-auth-routes.json`, case 5 only (claim surface widened by the seat in rework round 1): `expected_output` no longer says `restore` / `purge` never derive "because DELETE is a hard delete; recoverability is per-field `trackHistory` or a `lifecycle` archive policy". It now says they never derive, a by-id delete of a business object already keeps its rows in the recycle bin (`sys_recycle_bin`), but nothing lists or restores them over the API yet, so there is no restore operation to add and no custom soft-delete to build. `must_contain` swaps `trackHistory` / `lifecycle` for `sys_recycle_bin` / `recycle bin`; `must_not_contain` keeps `'restore'`. `.changeset/api-skill-delete-recycle-bin.md`: `'@objectstack/skills': patch`, both declaration lines. No `skip-changeset` label: a `skills/**` diff ships in `@objectstack/skills`. Each claim, read off `main`: - **A by-id delete keeps the rows.** `packages/objectql/src/recycle-bin/capture.ts` (PR #30780): `ObjectQL.delete`'s by-id branch (`runByIdDelete`, `engine.ts` ≈L9514) snapshots the cascade set and writes one `sys_recycle_bin` entry before the root row is removed. The REST `DELETE /data/{object}/:id` reaches that branch (a scalar `where.id`). - **Which deletes are not in it.** The same docblock, "Which deletes enter the bin (v1)": not a predicate delete (`multi: true`), not a platform object (`sys_`, `cloud_`, `ai_`, `hasPlatformObjectPrefix`), and a platform row the cascade reaches is left out of the snapshot. Rows deleted before PR #30780 have no entry. - **30 days by default.** `packages/objectql/src/recycle-bin/retention.ts`: host resolver, else `OS_RECYCLE_BIN_RETENTION_DAYS`, else `RECYCLE_BIN_DEFAULT_RETENTION_DAYS` (30), stamped as `purge_after`; `sys-recycle-bin.object.ts` reaps on that deadline (`ttl`). - **Nothing lists or restores the bin over the API.** `sys-recycle-bin.object.ts` declares `apiEnabled: false`, `apiMethods: []`, so no generic data route reaches the bin. `allowRestoreOwnDeleted` / `manageRecycleBin` in `packages/spec/src/security/permission.zod.ts` are `[PLANNED] … Not read yet`; `API_METHOD_DERIVATION` keeps `restore` / `purge` at `flag: () => false`; no engine restore or REST route exists. So the skill names neither permission nor any door (#30237 is still open). - `restore` / `purge` still never derive and are still stripped from `apiMethods` with a FROM → TO warning (`LEGACY_API_METHOD_GUIDANCE`, `object.zod.ts`), so that half of the L267 sentence stands. Dropped from the pitfall: the `enable.trash` history (PR #30844 had already cut it) and the pointer to `trackHistory` / `lifecycle` archive as the recoverability answer, which #30847 names as part of the wrong teaching. **Budget.** `skills/objectstack-api/SKILL.md`: 441 → 441 lines, 20542 → 20646 bytes, 5141 → 5157 tokens (ceiling 6314, headroom 1157). The eval fixture keeps its line count (case 5's two lines change in place; measured, not ratcheted: 1498 → 1529 tokens). Net added lines in `skills/**`: 0. No ceiling row moves, so no deletion payment is owed. **Serial.** PR #30844 (seat 2) edited the same pitfall. `origin/main` at `000a4c0d` (with #30844) was merged into the branch, no rebase; the one conflict, pitfall 2, takes this PR's rewrite. Rework round 1 merged `origin/main` `c77dd17f` (clean) before its commit. ## Why #30847 (p2): since PR #30780 the skill contradicts shipped behaviour. An agent following it builds its own soft-delete, or tells a user a deleted record is gone when its snapshot sits in the bin. Triage audit 6679098621 asks for the "no recycle bin" correction now and the restore-door teaching once #30237's restore and REST-door PRs land; this PR is the first half, hence `Refs`. ## Verification Derived with `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` against the three-file diff, each command run under `timeout 900` with stdin closed after a full `pnpm build`, exit codes recorded first: - At `211f3a99` (first head, base `1b3e22f0`): 45 derived, 45 run, 45 exit 0. - At `14487c50` (after merging `origin/main` `000a4c0d`): 45 derived, 45 run, 45 exit 0. - At `9a449ed9` (the head, rework round 1, after merging `origin/main` `c77dd17f`): 45 derived, 45 run, 45 exit 0. `dispatch-gates --ran`: 45 accounted, 0 NOT-MEASURED, 0 UNRUN. - `check-skills-token-ratchet`: skills/objectstack-api/SKILL.md is 5157 tokens (ceiling 6314; headroom 1157). - `node scripts/check-commit-card-trailers.mjs --range origin/main..HEAD`: 4 commits, exit 0, before each push. Ran lists: `card-30847/gates-{211f3a9,14487c50,9a449ed9}.txt` in the project files. <details><summary>Ran list at 9a449ed</summary> ``` node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0 node scripts/check-adr-0087-registration.mjs --self-test :: exit 0 node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0 node scripts/check-closing-keyword-parity.mjs :: exit 0 node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0 node scripts/check-comment-mask-corpus.mjs :: exit 0 node scripts/check-doc-route-spelling.mjs --advisory :: exit 0 node scripts/check-doc-route-spelling.mjs --self-test :: exit 0 node scripts/check-dts-emitted.mjs --self-test :: exit 0 node scripts/check-empty-changeset.mjs --base origin/main :: exit 0 node scripts/check-empty-changeset.mjs --self-test :: exit 0 node scripts/check-skills-token-ratchet.mjs :: exit 0 node scripts/check-skills-token-ratchet.mjs --self-test :: exit 0 node scripts/ci/assert-turbo-remote-cache.mjs --self-test :: exit 0 node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0 node scripts/ci/prune-turbo-cache.mjs --self-test :: exit 0 node scripts/ci/snapshot-next.mjs --self-test :: exit 0 node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0 node scripts/release-pending-publish.mjs --self-test :: exit 0 pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0 pnpm --filter @objectstack/spec run check:skill-docs :: exit 0 pnpm check:agent-test-spelling :: exit 0 pnpm check:changeset-gate-self-tests :: exit 0 pnpm check:ci-filter-parity :: exit 0 pnpm check:closed-ceremony-text :: exit 0 pnpm check:corpus-claim-drift :: exit 0 pnpm check:cross-package-test-inputs :: exit 0 pnpm check:doc-authoring :: exit 0 pnpm check:driver-memory-census :: exit 0 pnpm check:dts-closure :: exit 0 pnpm check:dual-build-cjs-loads :: exit 0 pnpm check:gitlink-declared :: exit 0 pnpm check:lean-entry-closure :: exit 0 pnpm check:merge-driver :: exit 0 pnpm check:nul-bytes :: exit 0 pnpm check:pm-governed-merges :: exit 0 pnpm check:pm-skill-id-lint :: exit 0 pnpm check:published-files :: exit 0 pnpm check:refd-timer-probe :: exit 0 pnpm check:role-word :: exit 0 pnpm check:skill-compatibility :: exit 0 pnpm check:skill-frame-sync :: exit 0 pnpm check:skill-identifier-liveness :: exit 0 pnpm check:sourcemap-no-sources-content :: exit 0 pnpm check:watch-hint-literal :: exit 0 ``` </details> CI families (`Lint & Repo Gates`, `Test Core`, the rest) are the PR's check-runs, not re-run locally. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` is CI's run (no source file in the diff). - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` not touched. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01J8VVAnsTJVz6nCb7n8NUJs <!-- signed: domain:skills#3 · huangyiirene · session_01J8VVAj7CvjkGXvgXzd6RZ7 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 293a85b commit 0306761

3 files changed

Lines changed: 17 additions & 9 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): objectstack-api no longer teaches that `DELETE` is a hard delete with no recycle bin: a by-id delete keeps a business object's rows in `sys_recycle_bin` (30 days by default; not `multi: true` deletes, platform rows or rows deleted before the bin existed), and nothing lists or restores it over the API yet; eval case 5 expects that teaching instead of a hard delete
6+
7+
Clause-②: no
8+
Metadata-protocol: none

‎skills/objectstack-api/SKILL.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ GET /api/v1/data/{object} # List records (with filter, sort, paginat
4545
GET /api/v1/data/{object}/:id # Get single record
4646
POST /api/v1/data/{object} # Create record
4747
PATCH /api/v1/data/{object}/:id # Update record
48-
DELETE /api/v1/data/{object}/:id # Delete record (hard delete)
48+
DELETE /api/v1/data/{object}/:id # Delete record (business-object rows → recycle bin)
4949
POST /api/v1/data/{object}/query # Complex queries + aggregation (QueryAST in body)
5050
POST /api/v1/data/{object}/batch # Per-object batch operations
5151
POST /api/v1/batch # Cross-object atomic batch
@@ -269,8 +269,8 @@ eight extra verbs are never declared in `apiMethods`:
269269
| `export` | `list` | `GET /data/{object}/export` |
270270

271271
`history` (from `get` ∧ `trackHistory`) gates only. `restore` / `purge` never
272-
derive — the trash surface is retired. Declaring any derived verb in
273-
`apiMethods` is stripped at parse with a FROM → TO warning.
272+
derive: the recycle bin has no restore or purge door yet. Declaring any
273+
derived verb in `apiMethods` is stripped at parse with a FROM → TO warning.
274274

275275
`POST /data/{object}/import` takes `mapping` as `{ Column: field }` or as
276276
`FieldMappingEntry[]` (`api/export.zod.ts`); only the entry form carries
@@ -408,10 +408,10 @@ keys mean the run produced none — never invent an empty.
408408
read. Sending neither skips the check; a mismatch answers **409
409409
`CONCURRENT_UPDATE`**; the quoted-empty entity-tag (`""`) is refused **400
410410
`VALIDATION_FAILED`**, not treated as omitted.
411-
2. **Assuming `DELETE` is recoverable.** ObjectStack `DELETE` is a hard
412-
delete — there is no recycle bin.
413-
For recoverability, use per-field `trackHistory` (audit
414-
trail) or a `lifecycle` archive policy instead of custom soft-delete logic.
411+
2. **Treating `DELETE` as final or as restorable.** A by-id delete keeps a
412+
business object's rows in the recycle bin (`sys_recycle_bin`, 30 days by
413+
default; not `multi: true` deletes, platform rows or rows deleted before the
414+
bin existed); nothing lists or restores it over the API yet. No soft-delete.
415415

416416
---
417417

‎skills/objectstack-api/evals/endpoints-auth-routes.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
{
4545
"id": 5,
4646
"prompt": "Lock the `invoice` object's API down to read, list, search and export; add a `/bulk` route for imports and a `restore` operation so deleted invoices can be undeleted.",
47-
"expected_output": "Authors only the primitives: `apiMethods: ['get', 'list']` — `search` and `export` derive from `list` automatically and are never declared (a declared derived verb is stripped with a warning). Explains there is no `/bulk` route (batch writes go through `POST /api/v1/data/{object}/batch`) and that `restore` / `purge` never derive because DELETE is a hard delete; recoverability is per-field `trackHistory` or a `lifecycle` archive policy.",
47+
"expected_output": "Authors only the primitives: `apiMethods: ['get', 'list']` — `search` and `export` derive from `list` automatically and are never declared (a declared derived verb is stripped with a warning). Explains there is no `/bulk` route (batch writes go through `POST /api/v1/data/{object}/batch`) and that `restore` / `purge` never derive: a by-id delete of a business object already keeps its rows in the recycle bin (`sys_recycle_bin`), but nothing lists or restores them over the API yet, so there is no restore operation to add and no custom soft-delete to build.",
4848
"files": [],
4949
"assertions": {
50-
"must_contain": ["apiMethods", "/batch", "trackHistory", "lifecycle"],
50+
"must_contain": ["apiMethods", "/batch", "sys_recycle_bin", "recycle bin"],
5151
"must_not_contain": ["'search'", "'restore'"]
5252
}
5353
},

0 commit comments

Comments
 (0)