Repository navigation
feat(spec): declare the recycle-bin surface: the sys_recycle_bin entry contract, the retention hook, the restore refusals, the restored event and two grant keys (ADR-0148) - #30577
Conversation
…tention hook, the restore refusals, the restored event and the two grant keys ADR-0148 D5/D6, Rollout step 2. Declared ahead of the readers the ADR names: the engine slice writes and reads, the Console lists, the cloud distribution calls the hook. Claude-Session: https://claude.ai/code/session_01WGufzetvYmJLKYUzZnwSke Co-authored-by: Claude <noreply@anthropic.com>
…the emitted-event enums; regenerate the spec artifacts DataEventType and RealtimeEventType list only emitted events (pinned equal in realtime.test.ts); the engine's restore adds the member to both in the change that emits it, spelled through RECORD_RESTORED_EVENT. The grant keys' planned liveness rows cite the module that names them; state-counts and export-origins regenerated. Claude-Session: https://claude.ai/code/session_01WGufzetvYmJLKYUzZnwSke Co-authored-by: Claude <noreply@anthropic.com>
…eness rows carry no author warning the lint cannot reach Claude-Session: https://claude.ai/code/session_01WGufzetvYmJLKYUzZnwSke Co-authored-by: Claude <noreply@anthropic.com>
…tract; the object file and its registration move to the engine slice PLATFORM_OBJECTS_BY_PACKAGE means "a table exists" (lint and stack.zod.ts read it so), so the name joins it only with the table. The spec now carries RECYCLE_BIN_ENTRY_FIELDS, the one field list the object is built from, and RecycleBinEntrySchema, its value shape. Claude-Session: https://claude.ai/code/session_01WGufzetvYmJLKYUzZnwSke Co-authored-by: Claude <noreply@anthropic.com>
…h its type aliases; ledger rows and regenerated artifacts The module moves to recycle-bin.zod.ts so the docs generator gives it its own reference page, and each exported schema gains its z.input type alias with an isomorphism pin (ADR-0122). The strictness ledger classifies its four object sites as wire (persisted runtime state the engine writes and reads), llms.txt counts the new data schema, and api-surface, export-origins, declaration-map, the reference docs and the strictness counts are regenerated. Claude-Session: https://claude.ai/code/session_01WGufzetvYmJLKYUzZnwSke Co-authored-by: Claude <noreply@anthropic.com>
…to claude/project-thread-uwrsn3
…losed arm form The claim declares `Clause-②: yes (widening)`; the changeset carried a free-text arm the declaration rule does not accept. The prose moves to the body's first sentence. Claude-Session: https://claude.ai/code/session_01L6bhgWAJDEGE4g7p29M3zq Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 22 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 7 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 170 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin f7507b4a76edb1211e2842ecff124a3204432d9d && git checkout f7507b4a76edb1211e2842ecff124a3204432d9d
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 27b0bc79895e47eb416d0041385004cb92050925 25af14cf1fd660284bb2f44722a788ffbe6a0f32 && git checkout -B drift-repro 27b0bc79895e47eb416d0041385004cb92050925 && git merge --no-ff 25af14cf1fd660284bb2f44722a788ffbe6a0f32
node scripts/docs-audit/affected-docs.mjs --json 27b0bc79895e47eb416d0041385004cb92050925
|
|
domain:spec#3 · os-sales · session_01L6bhgTqqeHSwZYJmApbDCa Contract-review-claim: session_01L6bhgTqqeHSwZYJmApbDCa · head 25af14c · 2026-11-05T16:36Z Full review at Generated by Claude Code |
|
domain:spec#3 · os-sales · session_01L6bhgTqqeHSwZYJmApbDCa Contract reviewServed-tier: Inputs: card #30235 (body and all five comments: claims 6659592591 and 6659650100, takeover 6662490518, claim 6662561348, dev report 6663467611), PR #30577 (body, the 29-path file list, the net diff against Gate verdicts: every check-run on the head, read at 2026-11-05T17:03Z once the last one completed — 65 runs, 57 ① Derived judgments
② Semver level
Clause-②: yes (widening) — confirmed against the diff. ③ Boundary flagsDev report 6663467611:
Escalations: none. ④ Design judgment
Must-fix: none. Should-fix: 2 — the cleared-reference rule's wording for multi-valued lookups (this PR or #30237 before re-link lands); the two grants' unstated relations and the tombstone / guidance / liveness prose that re-points at them (carrier #30237, with the reader). Implemented-by: VERDICT: PASS Generated by Claude Code |
|
domain:spec#3 · os-sales · session_01L6bhgTqqeHSwZYJmApbDCa 维护者速读
席位意见:fable 契约复审一轮 PASS,无必改。两条建议都写的是引擎将来的行为(多值查找字段的回链规则;两个权限键与 席位核对 — ACCEPT · domain:spec#3 · head
|
Requested by Sales · project thread
Fixes #30235
Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: follow-up #30237 —
skills/objectstack-api/SKILL.mdteaches that the trash surface is retired and that there is no recycle bin (theapiMethodssection and the delete note); both stay true after this PR, which declares and reads nothing, so the rewrite rides the engine slice that ships the reader.维护者速读
@objectstack/spec里声明回收站的契约:sys_recycle_bin条目的字段表与值形状、宿主保留期钩子(只认天数)、三个恢复拒绝码、data.record.restored事件名、两个对象权限键;运行时一行未动。packages/spec/src/data/recycle-bin.zod.ts(钩子签名与拒绝文案)、packages/spec/src/security/permission.zod.ts(两个新键)、packages/spec/src/api/error-code-ledger.zod.ts(三个拒绝码先于生产者登记)。pnpm --filter @objectstack/spec exec vitest run --project local src/data/recycle-bin.zod.test.ts,预期 1 个文件、16 个用例全过。What changes
The spec half of the recycle bin (ADR-0148 D5, Rollout step 2; ruling 6629858351 on #3146, D7's eight choices ratified 6659364907 on #30234). Every name below is declared here and read elsewhere: nothing in this PR writes or reads the bin, and every delete is still a physical delete.
packages/spec/src/data/recycle-bin.zod.ts(new, exported from@objectstack/spec/data):RECYCLE_BIN_OBJECT='sys_recycle_bin'andRECYCLE_BIN_ENTRY_FIELDS, the entry's one field list (id,object_name,record_id,record_count,snapshot,deleted_by,deleted_at,retention_days,purge_after), all read-only;RecycleBinEntrySchemais its value shape, key for key. The object file, its plugin registration and itsPLATFORM_OBJECTS_BY_PACKAGErow are the engine slice's (seat decision 2): that registry means "a table exists".RecycleBinSnapshotSchema(withRecycleBinSnapshotRowSchema,RecycleBinClearedReferenceSchema): the cascade set, master first, secret-channel refs left out (D4), plus theset_nullreferences the delete cleared (D2's re-link rule).RecycleBinRetentionResolver = (token: string | undefined) => number | undefined, the same token typeresolveFeaturestakes inpackages/cloud-connection/src/runtime-config-plugin.ts;RECYCLE_BIN_RETENTION_DAYS_ENV='OS_RECYCLE_BIN_RETENTION_DAYS',RECYCLE_BIN_DEFAULT_RETENTION_DAYS= 30;RecycleBinRetentionDaysSchema/RecycleBinRetentionDaysEnvSchemarefuse zero and every non-whole-number withrecycleBinRetentionRefusal(source, value), which names the source and the fix and no plan.RECYCLE_BIN_RESTORE_REFUSAL_CODES(three codes) andRECYCLE_BIN_RESTORE_REFUSAL_STATUS= 409.RECORD_RESTORED_EVENT='data.record.restored', a spec constant only (seat decision 1):DataEventType/RealtimeEventTypelist emitted events, so it joins them in the change that emits it.RECYCLE_BIN_GRANT_KEYS.packages/spec/src/api/error-code-ledger.zod.ts):RESTORE_UNIQUE_VALUE_TAKEN,RESTORE_PARENT_PURGED,RESTORE_PACKAGE_UNINSTALLEDunder@objectstack/objectql, ahead of their producer (seat decision 4).packages/spec/src/security/permission.zod.ts):allowRestoreOwnDeletedandmanageRecycleBin, optional with no default, so no parsed entry grows a key. Both enterliveness/permission.jsonasplanned, naming their readers (engine: snapshot deletes into the recycle bin, restore under original ids, purge, and the TTL reap (#3146 slice 3) #30237 evaluator mapping and engine doors, ui: the admin recycle-bin page (list, restore, empty) and the 已删除 · 撤销 toast (#3146 slice 4) #30239 Console) (seat decision 3). The tombstonedallowRestore/allowPurgestay refused.content/docs/references/**, the strictness-ledger counts, liveness state counts,llms.txt, and the type-alias pin (+6 isomorphic pins, 831 → 837).@objectstack/specminor.⛔ Not here: the engine's delete path, restore, purge, empty, the TTL reap, the permission mapping, the REST doors (#30237); the Console (#30239); any tombstoned key (
enable.trash,softDelete,allowRestore,allowPurge, the retiredapiMethodsvalues).Why
A deleted record is gone for good today. ADR-0148 rules a separate bin store and leaves the spellings to this card (D6); the engine and Console slices build on them, and ADR-0049's enforce-or-remove gate is passed by naming each reader in its liveness row.
Tests
All readings at head
25af14cf, afterorigin/mainc23eafa8was merged in and the build state refreshed.packages/spec/src/data/recycle-bin.zod.test.ts(new, 16 cases): the three names; the hook takes theresolveFeaturestoken and answers days or nothing;RecycleBinRetentionDaysSchemaaccepts 1/7/30/365 and refuses0, -1, 1.5, NaN, Infinity, null, '30', truewith the refusal text; the env schema accepts'1' '30' '365'and refuses'0' '030' '-7' '7.5' ' 7' 'thirty' ''; the refusal names the source and the remedy and no plan; the snapshot round-trips and refuses zero rows; the field contract (types, required, read-only,deleted_by→sys_user) builds a validObjectSchemaundersys_recycle_bin;RecycleBinEntrySchemamatches the field keys one for one; the refusal codes are registered and answer 409;data.record.restoredstays out ofDataEventType/RealtimeEventType; the two grant keys parse, are never defaulted, and the retiredallowRestore/allowPurgestay refused.packages/spec/src/api/error-code-ledger.test.ts: the three codes parse asErrorCode, sit under@objectstack/objectql, and need no standard-synonym waiver.packages/spec/src/type-alias-convention.pin.test.ts: +6 isomorphic pins (831 → 837).Commands and results
pnpm --filter @objectstack/spec build· VERDICT command-exit 0pnpm --filter @objectstack/spec check:generated· exit 0 · all 14 generated artifacts up to datepnpm --filter @objectstack/spec test(vitest--project local) · VERDICT command-exit 0 · Test Files 816 passed (816) · Tests 25660 passed, 1 todopnpm --filter @objectstack/spec typecheck(tsc, scripts typecheck, test typecheck) · VERDICT command-exit 0turbo run build --filter=!@objectstack/docs· 119 successful, 119 total...@objectstack/specdirection), the three the diff's widened types reach (object permissions, the error-code union):pnpm --filter @objectstack/plugin-security typecheck·@objectstack/core typecheck·@objectstack/objectql typecheck· each VERDICT command-exit 0pnpm --filter @objectstack/plugin-security test· Test Files 244 passed (244) · Tests 5379 passed, 45 skipped@objectstack/corevitest run src/security· Test Files 63 passed (63) · Tests 1221 passed@objectstack/lintvitest run src/validate-security-posture.test.ts src/validate-retired-permission-residue.test.ts· Test Files 2 passed · Tests 209 passedNo ablation: the diff changes no tested runtime behaviour (declarations only). No dogfood battery: no
!in the title and no(narrowing)arm.Acceptance notes
claude/project-thread-jpl1gr(last884764a2). Each hunk was re-read against ADR-0148 and the seat's four decisions; all are kept. One correction: the changeset'sClause-②:line carried a free-text arm, and now readsyes (widening), the claim's form (25af14cf). The net diff touches no file outsidepackages/spec,content/docs/references/**,docs/audits/2026-07-unknown-key-strictness-ledger*and.changeset/; the object file the first commit wrote underplatform-objectswas moved out by the predecessor itself (seat decision 2).OPERATION_TO_PERMISSIONinpackages/plugins/plugin-security/src/permission-evaluator.tsmust maprestore/purgeto the new grants; that map targets object-permission keys, so both keys live on the per-object entry.manageRecycleBinis bin administration on that object; emptying purges every entry the holder manages.EffectiveObjectPermission(the/auth/me/permissionsshape) gains both optional keys because it derives from the same base; nothing fills them yet.GRANT_BITSinpackages/core/src/security/effective-object-permissions.ts,ObjectPermissionVerbTarget/objectPermissionGrantsinpackages/spec/src/security/permission.zod.ts, andCAPSinui/packages/app-shell/src/views/metadata-admin/previews/PermissionPreview.tsxlist neither key today. Carrier: engine: snapshot deletes into the recycle bin, restore under original ids, purge, and the TTL reap (#3146 slice 3) #30237 (merge, fold, evaluator map, flipping both liveness rows tolive) and ui: the admin recycle-bin page (list, restore, empty) and the 已删除 · 撤销 toast (#3146 slice 4) #30239 (the Console columns).recycle-bin.zod.tsarez.objectand triagedwirein the strictness ledger: persisted runtime state the engine writes and reads, never authored; the snapshot'svaluescarry whatever fields the deleted rows had.scripts/adr-anchors/entry was added, because the claim's file surface does not name one. The seat may ask for it.deleted_at/purge_afteraccept ISO 8601 with an offset (datetime({ offset: true })), a little wider than the repository's commondatetime()form, so an engine writing a local offset is not refused.Verification
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackat head25af14cf(29 paths vs merge basec23eafa8, +852 / -18) derived 106 commands. All 106 ran serially on that head after the full build, each exit code captured before any pipe: 106 × exit 0.--ranreconciliation: 106 derived, 106 run, 0 NOT-MEASURED, 0 UNRUN (a derived zero).pnpm lintand the rest of the CI farm are CI's run; the PR's check-runs are the record for them.The 106 derived commands, all exit 0
check-adr-0087-registration --base origin/main(no declared-breaking changeset; 1 non-breaking seen) and--self-test;check-changeset-no-major --base origin/main(nomajorbump; protocol lockstep 18 / 18.3.0; re-run offline with this body as the--eventpayload: LEVEL AXIS ✓,yes (widening)+added, no moved package gradedpatch);check-empty-changeset;check-issue-citations(13 citations resolve on the board);check-adr-links;check-closing-keyword-parity;check-comment-mask-adoption,check-comment-mask-corpus;check-doc-route-spelling --advisory;check-docs-section-name;check-section-landing-index;check-plugin-teardown-shape(fixture621a4876fetched for the self-test);check-dev-prereqs,check-dts-emitted,assert-turbo-remote-cache,plan-test-core-shards,prune-turbo-cache,release-rehearsal-clone,release-pending-publishself-tests;docs-audit/check-affected-docs,check-drift-comment.@objectstack/spec:check:api-surface,check:authorable-surface,check:browser-reachable-entries,check:docs,check:dual-source-exports,check:duration-unit-keys,check:empty-state,check:entry-nameability(626 probes, 0 new unnameable mentions),check:error-code-provenance,check:export-origins,check:exported-any,check:generated,check:liveness,check:llms-txt,check:skill-examples,check:skill-refs,check:strictness-ledger,check:variant-docs,check:yaml-examples.@objectstack/lint:check:doc-formula-expressions,check:doc-security-posture.check:changeset-gate-self-tests,ci-filter-parity,closed-ceremony-text,corpus-claim-drift,cross-package-test-inputs,dispatcher-error-vocabulary,doc-anchors,doc-authoring,doc-frontmatter,docs-audit-scope,docs-redirects,docs-single-h1,docs-spec-enumerations,docs-transcript-drift,driver-memory-census,dts-closure,dual-build-cjs-loads,engine-double-contract,error-code-casing,error-status-conformance,gitlink-declared,issue-citations,keyed-text-bounds,lean-entry-closure,logger-receiver-detach,merge-driver,nul-bytes,objectql-double-limit,org-identifier,page-declaration-shape,platform-checklist,platform-object-tenancy-census,pm-prior-rulings,published-files,published-readme-links,query-options-erasure,react-page-adapter-contract,refd-timer-probe,registry-log-declared,rest-log-spy-declared,role-word,skill-identifier-liveness,slot-lookup,sourcemap-no-sources-content,spec-docblock-symbol-anchors,spec-parsed-alias,system-context-census,test-source-alias,tier-file-adoption,type-check-coverage,type-check-debt,undeclared-dep-imports,vendor-version-stamps,watch-hint-literal,where-matcher.Branch:
claude/project-thread-uwrsn3, the card thread's harness-pinned branch (a measured platform exception toclaude/issue-30235-…), resumed fromclaude/project-thread-jpl1gr@884764a2by merge, never rebase; every picked-up hunk was re-read and every check re-run on this head.Human Minimum
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgWAJDEGE4g7p29M3zq