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 d374cbe
Browse filesBrowse the repository at this point in the historyBrowse files
feat(objectql,platform-objects): keep a by-id delete's rows in the recycle bin
ADR-0148, first slice: the sys_recycle_bin object, the snapshot on
delete, the retention stamp and the TTL reap.
- platform-objects registers sys_recycle_bin, built from the spec's
RECYCLE_BIN_ENTRY_FIELDS: engine-owned, no generic data-API method,
its tenant column cascades, ttl on purge_after.
- objectql: a by-id delete of a business record writes one entry in its
own unit of work, before the root row goes: the cascade set read raw
before the walk (master first, secret columns left out), the set_null
references the walk cleared, deleted_by/deleted_at, retention_days
and purge_after. A removal that fails takes the entry with it.
- retention: ObjectQLPlugin's recycleBinRetention { resolve, token },
else OS_RECYCLE_BIN_RETENTION_DAYS (read at init), else 30 days; a
value that is not a positive whole number is refused.
- spec: sys_recycle_bin joins PLATFORM_OBJECTS_BY_PACKAGE; cli: its
organization-ownership inventory row.
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czFGLnXKQd6cQjv3Pr
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
+
Clause-②: yes (widening)
11
+
Metadata-protocol: added
12
+
13
+
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.
14
+
15
+
-**`@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.
16
+
-**`@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.
17
+
-**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()`.
18
+
-**Which deletes do NOT enter the bin:**
19
+
- a delete by predicate (`multi: true`), which includes the lifecycle sweep;
20
+
- a child the cascade deletes, which is a row of its root's entry instead;
21
+
- any `sys_*` object, whose rows are also left out of a business record's snapshot;
22
+
- any delete on a composition that does not register `PlatformObjectsPlugin`, which logs one `info` line saying so.
23
+
-**Forward-only:** records deleted before this release have no entry.
24
+
-**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.
25
+
-**`@objectstack/spec`:**`PLATFORM_OBJECTS_BY_PACKAGE['platform-objects']` lists `sys_recycle_bin`, so a reference to it lints as a real platform object.
26
+
-**`@objectstack/cli`:** the organization-ownership inventory has a row for `sys_recycle_bin` (fate `attribution`).
// Exchange rates (`@objectstack/platform-objects`, #27185): an organization's
804
804
// administrators author its own rate table; no parent row anchors a rate.
805
805
{object: 'sys_exchange_rate',census: PMAIN,fate: 'attribution',citation: `${CENSUS_MAIN} (in reach, added since the first census); ${D10_SINGLE}`,anchors: []},
806
+
// The recycle bin (`@objectstack/platform-objects`, ADR-0148, #30237): the
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.
810
+
{object: 'sys_recycle_bin',census: PMAIN,fate: 'attribution',citation: `${CENSUS_MAIN} (in reach, added since the first census); ${D10_SINGLE}`,anchors: []},
806
811
// A reader's own named list views (`@objectstack/platform-objects`, ruling
807
812
// 6570568131 on #28971): user data on the preference template, each row in
808
813
// its owner's organization; no parent row anchors a view.
0 commit comments