You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6a07be6
Browse filesBrowse the repository at this point in the historyBrowse files
fix(objectql,plugin-audit): keep predicate deletes, platform objects and the bin's own bookkeeping out of the recycle bin and the ledger
The lifecycle sweep reaps each row with `where: { id }, multi: true`, which
the engine routes as a by-id delete, so a business object that declares a
lifecycle would have entered the bin on every reap. The capture now opens
only when the caller did not ask for `multi: true`. The bin also leaves out
every platform namespace (sys_, cloud_, ai_), not only sys_.
plugin-audit's generic writer would have copied each entry, snapshot and
internal columns included, into sys_audit_log and sys_activity on its reap,
on the set_null of its deleted_by and on an organization delete's cascade.
sys_recycle_bin joins SKIP_OBJECTS beside the other engine-owned plumbing.
Pins: a predicate-shaped by-id delete and a lifecycle sweep of a business
object write no entry; cloud_ and ai_ objects write none; an organization
delete removes its entries without being refused by them; a reap and an
update of an entry write no ledger row while a business delete still does.
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czFGLnXKQd6cQjv3Pr
Copy file name to clipboardExpand all lines: .changeset/30237-recycle-bin-snapshot-on-delete.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,25 +3,27 @@
3
3
'@objectstack/platform-objects': minor
4
4
'@objectstack/spec': minor
5
5
'@objectstack/cli': minor
6
+
'@objectstack/plugin-audit': minor
6
7
---
7
8
8
9
feat(objectql,platform-objects): a by-id delete keeps its rows in the recycle bin (ADR-0148): the `sys_recycle_bin` object, the snapshot on delete, the retention stamp and the TTL reap
9
10
10
11
Clause-②: yes (widening)
11
12
Metadata-protocol: added
12
-
Skills-docs: follow-up owed — skills/objectstack-api/SKILL.md :268, :417 (they still teach that there is no recycle bin; not moved in this release)
13
+
Skills-docs: follow-up owed — skills/objectstack-api/SKILL.md :268, :417 (they teach that there is no recycle bin)
13
14
14
15
The recycle bin's write side. A delete is still a physical delete, and no read path changed: the rows are gone from every query the moment the delete commits. What is new is the copy kept beside them. Restoring, purging and emptying the bin, the two grants that govern them and their REST doors are not in this release.
15
16
16
17
-**`@objectstack/platform-objects`:** registers `sys_recycle_bin`, built from the spec's `RECYCLE_BIN_ENTRY_FIELDS`. One entry per delete operation. It is engine-owned, with no generic data-API method, because the snapshot holds every field of the deleted rows. Its tenant column cascades, so deleting an organization deletes its entries. The lifecycle sweep reaps an entry once its stamped `purge_after` has passed (`ttl` on `purge_after`, window `0h`), and asks no resolver.
17
18
-**`@objectstack/objectql`:** a by-id delete of a business record writes one entry in the delete's own unit of work, before the record's row is removed. The entry holds the record and its master-detail cascade, the master first. Each row keeps its declared columns, and `secret` columns are left out, so a restored record's secret fields come back empty. The entry also records the `set_null` references the delete cleared, and `deleted_by`, `deleted_at`, `retention_days` and `purge_after`. If removing the row fails, the entry goes too: the transaction rolls it back, or the engine removes it when no transaction covered it.
18
19
-**Retention:**`ObjectQLPlugin`'s new `recycleBinRetention: { resolve, token }` option takes the host's retention resolver, called once per delete with the token the host handed over. When the option is absent or the resolver answers `undefined`, the retention is `OS_RECYCLE_BIN_RETENTION_DAYS`, else 30 days. A value that is not a positive whole number of days is refused: from the resolver, the delete is refused before it writes anything; in the variable, the boot is refused, because the plugin reads it in `init()`.
19
20
-**Which deletes do NOT enter the bin:**
20
-
- a delete by predicate (`multi: true`), which includes the lifecycle sweep;
21
+
- a delete by predicate (`multi: true`), which includes every lifecycle sweep reap, even though the sweep names each reaped row by its id;
21
22
- a child the cascade deletes, which is a row of its root's entry instead;
22
-
- any `sys_*` object, whose rows are also left out of a business record's snapshot;
23
+
- any platform object, meaning a `sys_*`, `cloud_*` or `ai_*` object, whose rows are also left out of a business record's snapshot;
23
24
- any delete on a composition that does not register `PlatformObjectsPlugin`, which logs one `info` line saying so.
24
25
-**Forward-only:** records deleted before this release have no entry.
25
26
-**Storage:** every by-id delete of a business record now also writes one `sys_recycle_bin` row holding the deleted rows. The row is reaped once its retention has passed.
26
27
-**`@objectstack/spec`:**`PLATFORM_OBJECTS_BY_PACKAGE['platform-objects']` lists `sys_recycle_bin`, so a reference to it lints as a real platform object. The comment above `RECYCLE_BIN_OBJECT` now names the object file that builds the table; no exported name, shape or description changed.
27
28
-**`@objectstack/cli`:** the organization-ownership inventory has a row for `sys_recycle_bin` (fate `attribution`).
29
+
-**`@objectstack/plugin-audit`:**`sys_recycle_bin` is excluded from the generic audit and activity writer, like the other engine-owned plumbing, so reaping an entry, clearing its `deleted_by` or cascading an organization's delete into its entries never copies a snapshot into `sys_audit_log` or `sys_activity`. The business delete an entry was taken for is audited exactly as before.
{object: 'sys_exchange_rate',census: PMAIN,fate: 'attribution',citation: `${CENSUS_MAIN} (in reach, added since the first census); ${D10_SINGLE}`,anchors: []},
806
806
// The recycle bin (`@objectstack/platform-objects`, ADR-0148, #30237): the
807
807
// engine writes each entry with the organization of the record it holds,
808
-
// else the deleting context's, so a NULL row has no producer; the record it
809
-
// names is gone, so no parent row anchors an entry.
808
+
// else the deleting context's. A NULL row comes only from a delete with
809
+
// neither (a tenancy-disabled object deleted by a context with no active
810
+
// organization). The record an entry names is gone, so no parent row
811
+
// anchors an entry.
810
812
{object: 'sys_recycle_bin',census: PMAIN,fate: 'attribution',citation: `${CENSUS_MAIN} (in reach, added since the first census); ${D10_SINGLE}`,anchors: []},
811
813
// A reader's own named list views (`@objectstack/platform-objects`, ruling
812
814
// 6570568131 on #28971): user data on the preference template, each row in
0 commit comments