Repository navigation
feat(ui): a Setup page to restore deleted records from the recycle bin, or empty it - #31835
Conversation
… managed object's bin Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jR7jBcj3r4Rii4HA82
…fusals and empty Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jR7jBcj3r4Rii4HA82
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jR7jBcj3r4Rii4HA82
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jR7jBcj3r4Rii4HA82
📓 Docs Drift Check12 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 3 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 81086779ece07315ad56d3de25b1f720db5901d8 && git checkout 81086779ece07315ad56d3de25b1f720db5901d8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8079fa9b5cefdc127202f8afe8e7805c85b523a2 701e095bc29d202addb0098a5c2b300a3e4641c2 && git checkout -B drift-repro 8079fa9b5cefdc127202f8afe8e7805c85b523a2 && git merge --no-ff 701e095bc29d202addb0098a5c2b300a3e4641c2
node scripts/docs-audit/affected-docs.mjs --json 8079fa9b5cefdc127202f8afe8e7805c85b523a2 |
|
domain:ui#3 · zhuangjianguo · session_01QsR2jVEjiYrK7onirxUGyo Contract reviewServed-tier: This is the lane seat's own review of record. It is owed by the ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
@objectstack/spec/data already exports RecycleBinEntry (the stored row), so check:spec-symbols flagged the local interface of the same name. The page's type is the list door's served shape, so it gets a name the spec does not own. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jR7jBcj3r4Rii4HA82
…censuses The Setup tree the platform admin is served gains nav_recycle_bin, so the connect-agent wire pin counts 33 entries, not 32, and now names the entry. RecycleBinPage reads useMetadata().objects, so the open-path object-reader census classifies it as off the object-list open. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jR7jBcj3r4Rii4HA82
|
domain:ui#3 · zhuangjianguo · session_01QsR2jVEjiYrK7onirxUGyo Contract reviewServed-tier: This is the delta review of record on the new head. The earlier record is 6733823083, PASS on ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
domain:ui#3 · zhuangjianguo · session_01QsR2jVEjiYrK7onirxUGyo 席位核对 · ACCEPT · 2026-11-09T10:23Z · head
|
Requested by Steedos · project thread
Fixes #30239
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
manageRecycleBin权限的业务对象(不发任何回收站读取),选中一个对象后读它的回收站,每页 50 条,可以「加载更多」。每行显示记录名、连带删除的相关记录数、删除人、删除时间和保留期限。「恢复」复用 feat(ui): undo a business-record delete from its toast through the recycle bin #31795 删除提示里的撤销逻辑:按原 id 恢复,被拒时按原因给出带对象和字段标签的句子。「清空回收站」会先确认并说明不可撤销,完成后报告移除了多少条。导航项由@objectstack/platform-objects的 Setup 导航贡献提供(componentRef: 'data:recycle-bin'),11 个翻译包都加了标签。CatalogAssignmentPage加了一个可选的select属性,renderSection多传第二个参数,两个已有调用方不受影响。没有任何对象回收站管理权限的用户看到说明文字,不发读取。回滚即撤销本 PR。ui/packages/app-shell/src/views/setup/RecycleBinPage.tsx(RecycleBinSection的读取、加载更多、恢复和清空),再看setup/recycleBin.ts(managesRecycleBin权限判断和 SDK 门的取法)。ui/下跑pnpm exec vitest run packages/app-shell/src/views/setup/RecycleBinPage.test.tsx,预期 20 个用例全绿。实机截图见下方 Verification。What changes
@object-ui/app-shell, the page (views/setup/RecycleBinPage.tsx, registered asdata:recycle-bininbuiltinComponents.tsx):objectcatalog narrowed to the business objects whosemanageRecycleBinthe caller holds. The gate ismanagesRecycleBininsetup/recycleBin.ts: the effective map from/auth/me/permissions, read asMePermissionsProviderreads it (the lowercase key, the key as given, then'*'), and folded byobjectPermissionGrants, somodifyAllRecordsgrants it. A platform object (hasPlatformObjectPrefix) never enters the bin, so it is never listed.?object=param. A link to an object the caller does not manage reads nothing.recycleBin.list(object, { limit: 50, offset: 0 }). "Load more" readsoffset= the rows held, while the door answershasMore.getRecordDisplayNameover the served snapshot row, which the door masks to the fields the caller may read.recordCount − 1, a count family) shows when the delete cascaded.sys_userread per page; a refused read leaves the id.purgeAfter).recordDelete.undo, the same restore the delete toast's Undo runs (feat(ui): undo a business-record delete from its toast through the recycle bin #31795). It restores under the original ids, never creates, and drops the row. A refusal toastsrestoreFailedwithrecycleBinRestoreRefusalText, on the labelled path (recycleBinRefusalLabelsOf): a field is named by its label, the object by the page's label, and a parent object by its definition's label. Review nit N2 asked for exactly this path.recycleBin.empty(object)and toastsemptied(a count family) with the door'sremoved. A failed list or empty shows the door code's sentence (for exampleNOT_IMPLEMENTED), else the server message.recycleBinDoorsOf(adapter)→getClient().recycleBin), and restore from the adapter'srestoreRecycleBinEntry(feat(ui): undo a business-record delete from its toast through the recycle bin #31795). NoDataSourcechange.CatalogAssignmentPage: an optionalselect(entries)narrows the catalog, andrenderSection(name, entry)now also receives the picked entry. Both existing callers (Position holders, Permission set assignment) are unchanged.@objectstack/platform-objects:nav_recycle_bin(type: 'component',componentRef: 'data:recycle-bin', icontrash-2) in the Setup app'sgroup_configuration, after Data Lifecycle, beside thesys_recycle_binstore this package registers. It has norequiredPermissions, because the grant is per object. The label is added in all 11apps/translations/*.ts, with its source digest recorded in the 10*.source-hashes.ts.@object-ui/i18n:recycleBin.page.*in every pack (title, subtitle, list and filter labels, the no-object state, pick, column heads, Restore, Load more, the empty action, dialog and failure lines), plus two count families,relatedandemptied. zh-Hant is generated withgen:zh-hant. Shared wording reusessetupAssignments.{noMatch, notFound, retry, refresh}andcommon.cancel..changeset/30239-recycle-bin-setup-page.md. It also namesRecordDeleteToastAction, the type feat(ui): undo a business-record delete from its toast through the recycle bin #31795 exported from@object-ui/core(review nit N1).Tests
app-shell/src/views/setup/RecycleBinPage.test.tsx(20 cases). It runs through a realI18nProviderwith the shipped packs and a realMePermissionsProvider; the stand-ins are the adapter, the metadata store and sonner.'*'modifyAllRecordslists every business object and no platform object. A link to an unmanaged object reads nothing.{ limit: 50, offset: 0 }, which names the record, the related count and who deleted it, through onesys_userread.NOT_IMPLEMENTEDreads its own sentence, and Retry reads again.restoreRecycleBinEntry('crm_lead', 'rb_1'), nevercreate, toastsrestoredNamedand drops the row with no re-read.RESTORE_UNIQUE_VALUE_TAKENnames the field by label ("Email").RESTORE_PARENT_IN_RECYCLE_BINnames the parent object by label ("Account"). In both, the row stays.empty('crm_lead')and toastsemptied. CONTROL: Cancel empties nothing.app-shell/src/views/setup/RecycleBinPage.navContribution.test.tsx: the ref is registered by the production module, owned by app-shell, addressescomponent/data/recycle-bin, and mounts throughComponentNavView.packages/cli/test/connect-agent-both-halves-wire.pin.test.tscounts the Setup tree the platform admin is served.nav_recycle_binmakes it 33, where it said 32. BothtoHaveLength(32)become 33, and the history comment and the "24 entriesSETUP_NAV_CONTRIBUTIONScarries" line move by one. A newtoContain('nav_recycle_bin')ties the bump to this entry.app-shell/src/console/__tests__/openPathObjectReaders-12811.test.tsgains oneOBJECTS_READERSrow.RecycleBinPage.tsxreadsuseMetadata().objects, and it is classifiedoff(Setup → Recycle Bin, not mounted on an app object-list open).Acceptance notes
nameFieldreads its fallback in the list. The bin's snapshot holds stored columns, so a formula title is absent from the served row. The row falls to the next name-ish field: in dev:crm, a contact reads "Alan" rather than "Alan Turing". After a restore, the record and its toasts read the full title.Verification
Head
701e095b: the page59cc82e1, the tests, the changeset, the collection-time linter importtest(ui), origin/main merged at4ed20928, and two commits for reds that CI found after the PR opened.425681c5renames the page's local served-entry type toRecycleBinListEntry, because@objectstack/spec/dataalready exportsRecycleBinEntry(check:spec-symbols, a Type Check UI step outside dispatch-gates).701e095bholds the two census edits named under Tests. The merge of origin/main at4ed20928(11 incoming commits; none touches this diff's files, and no parallel fix was found). Branch restarted from56cac5eb, the landing of #31795.Tests (ui vitest from ui/, under the verify lock)
packages/app-shell/src/views/setup/(13 files):Tests 159 passed (159), including the 20 new page cases and the 3 nav cases.packages/i18n/plus every app-shell test importingbuiltinComponents:Test Files 120 passed (120),Tests 1946 passed | 13 skipped. This coversde-quote-pairing-3876,all-locales-key-parity,count-families-11445and the census pins; the new de keys carry no „…“ pair.@objectstack/platform-objects, whole package:Test Files 120 passed (120),Tests 1932 passed (1932).service-settingssettings-branding-posture.pin: 15 passed.701e095b, after the CI reds, each whole package was run:@object-ui/app-shellin 8 locked--shard=k/8runs: 2221 files (2220 passed, 1 skipped),Tests 20310 passed | 9 skipped.@objectstack/cli:Test Files 616 passed | 2 skipped (618),Tests 7692 passed | 10 skipped.@objectstack/platform-objects: 1932 passed.service-settingssetup-nav-hub-parity: 23 passed.pnpm --dir ui run check:spec-symbols: 0 untriaged collisions.turbo run type-check --filter=@object-ui/app-shell --filter=@object-ui/i18n:Tasks: 70 successful, 70 total.Ablation (scripts/ablation-replace.mjs, anchor x1 -> x0, restored blob == HEAD f34b237a82b4 and git diff HEAD empty)
The manage gate in
setup/recycleBin.ts,entries.filter((e) => managesRecycleBin(effectiveObjects, e.name)), was replaced byentries.filter(() => true).RecycleBinPage.test.tsx:Tests 4 failed | 16 passed (20). The 4 are every object-list pin: the managed-only list, the member's no-object state, the'*'CONTROL's platform exclusion, and the unmanaged link. The restore, refusal, paging and empty pins stay green, as they should.Live run on dev:crm (en and zh, as the organization admin; scripts and shots in the project folder issue-30239/live-pr2/)
Workspace built (
pnpm build119/119,pnpm console:build76/76),pnpm dev:crm. Setup through the data door: an account, an opportunity with two line items (a master-detail cascade), and three contacts. The opportunity and two contacts were then deleted. Each answer carriedrecycleBinEntryId, and the opportunity's entry hasrecordCount: 3.Contact "Ada Lovelace" deleted · Undo; zh: 联系人“Ada Lovelace”已删除 · 撤销. Undo answersPOST …/crm_contact/recycle-bin/:entryId/restore200, toastsContact "Ada Lovelace" restored, and returns to the record's URL./recycle-binrequests before the pick were the record-page restore and the page's own HTML). Picking Opportunity sentGET …/crm_opportunity/recycle-bin?limit=50&offset=0once and showed "Acme renewal · and 2 related records · Dev Admin · 11/9/2026, 6:17:40 AM · 12/9/2026".POST …/restore200, toastOpportunity "Acme renewal" restored, and the row left the list.DELETE …/crm_contact/recycle-bin200, toasted "2 deleted records removed for good", and the list read empty.Gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 67 derived commands, each exit 0 (check:type-check-debtunder the verify lock,check:query-options-erasurealone).check-plugin-teardown-shape --self-testneeded its pinned fixture fetched into the shallow clone, then passed.check:test-source-aliasfirst flagged the new nav pin, which reachescelAuthoring.ts's dynamic@objectstack/lintimport throughbuiltinComponents. The fix, a module-topimport '@objectstack/lint'in that pin, is committest(ui). That gate andcheck:undeclared-dep-importswere re-run after it.--ranreconciliation:67 derived, 67 run, 0 NOT-MEASURED, 0 UNRUN.--tier: no path-derived mandate.check-changeset-no-major,check-adr-0087-registration,check-closing-keyword-parity,check-partof-closing-keyword) were run on this body.Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01QsR2jR7jBcj3r4Rii4HA82