Skip to content

Commit 66fa70d

Browse files
committed
docs(skills): the lifecycle rule teaches the signed-expiry scope and the retention floor of a packaged sealed object
Claude-Session: https://claude.ai/code/session_01L6bhgXcjUDyiKHv8oX32ik Co-authored-by: Claude <noreply@anthropic.com>
1 parent 1e721fd commit 66fa70d

2 files changed

Lines changed: 33 additions & 18 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): the lifecycle rule teaches which sealed objects take signed expiry, and that a retention override cannot shorten a packaged sealed object's declared window
6+
7+
Clause-②: no (published prose only; teaches behaviour already on main)
8+
Metadata-protocol: none
9+
10+
`skills/objectstack-data/rules/lifecycle.md` (Sealing) no longer says expiry is not built and that the sweeper deletes every sealed object's rows. It now says: signed expiry covers objects whose lifecycle is declared in packaged metadata, whose sealed rows leave only by whole checkpoints and read as `expired`; on such an object with no `archive`, a retention override below the declared window is rejected and the declared window applies, and to keep rows for less time the declared window is what to shorten; on any other sealed object (one created at runtime) the sweeper still deletes sealed rows, which then read as missing. The `retention_overrides` row of the Operations table points at that paragraph.
11+
12+
The same sentence said no verifier is built. `os audit verify` reads the checkpoints back, so that clause is removed.
13+
14+
The file sat at its token ceiling, so the words are paid for in the same file and no ceiling moves: the page drops the rationale sentence after "the file never shrinks" and its echo in the first validation example, the example list in the rule sentence (the Lifecycle Classes table carries a typical use per class), the hook names in the intro, the rationale clause of the Separation bullet, and three filler words in Safety Semantics.

‎skills/objectstack-data/rules/lifecycle.md‎

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22

33
Declaring how long an object's data lives and how its space is
44
reclaimed (ADR-0057). Distinct from
5-
**lifecycle hooks** (`beforeInsert` / `afterUpdate` …), which run logic on
6-
writes.
5+
**lifecycle hooks**, which run logic on writes.
76

87
## Why This Exists
98

109
Every object without a `lifecycle` block is **immortal**: rows are never
11-
deleted, and on SQLite the file never shrinks. That's correct for business
12-
records — and a guaranteed disk leak for anything append-only.
10+
deleted, and on SQLite the file never shrinks.
1311

14-
**Rule: any append-only, high-write-rate object (event log, run history,
15-
delivery outbox, ephemeral tokens) MUST declare a `lifecycle` block.**
12+
**Rule: any append-only, high-write-rate object MUST declare a `lifecycle`
13+
block.**
1614
The platform LifecycleService sweeps declared policies hourly, deletes
1715
expired rows under a system context, and reclaims driver space.
1816

@@ -96,7 +94,7 @@ Duration literals: `<n>` + `h` / `d` / `w` / `y`.
9694
## Validation Rules (rejected at parse time)
9795

9896
```typescript
99-
// ❌ Non-record class with no bounding policy — grows forever, exactly the bug
97+
// ❌ Non-record class with no bounding policy
10098
lifecycle: { class: 'telemetry' }
10199

102100
// ❌ archive.after must equal retention.maxAge
@@ -113,17 +111,15 @@ lifecycle: {
113111

114112
## Safety Semantics
115113

116-
- **Archive-then-delete is atomic-ish and safe by default**: an object
117-
declaring `archive` is never hot-deleted before the copy to the archive
118-
datasource succeeded. If no datasource is registered under the `archive.to`
119-
name, rows are simply retained.
120-
- **Rotation** physically time-shards the table on SQLite (writes hit the
114+
- **Archive-then-delete**: an object declaring `archive` is never
115+
hot-deleted before the copy to the archive datasource succeeded. If no
116+
datasource is registered under the `archive.to` name, rows are retained.
117+
- **Rotation** time-shards the table on SQLite (writes hit the
121118
current shard, reads go through a view under the object's name, expired
122119
shards are DROPped). Other dialects enforce the same window with an
123120
age-based reap.
124121
- **Separation**: registering a datasource named `telemetry` moves every
125-
`telemetry`/`event`/`audit` object onto it — telemetry bloat can't touch
126-
the business DB.
122+
`telemetry`/`event`/`audit` object onto it.
127123

128124
## Sealing (`seal`)
129125

@@ -161,16 +157,21 @@ text `tenant_id` outside `valueFields` (or `chainField: 'organization_id'`),
161157
and beside `seal` any `onlyWhen`, a `ttl` not on `created_at`, or rotation
162158
`storage`. Unsealed, `error` hourly: no declared `id`; a `password`,
163159
`secret`, `formula`, `summary`, `image`, `file`, `avatar`, `video` or `audio`
164-
column; no `cryptoProvider` on `AuditPlugin`. Not built yet (ADR-0154): a
165-
verifier, so a break is recorded but not reported; expiry (P4), so the sweeper
166-
still deletes sealed rows, which then read as missing.
160+
column; no `cryptoProvider` on `AuditPlugin`.
161+
162+
Signed expiry covers objects whose lifecycle is declared in packaged metadata:
163+
their sealed rows leave only by whole checkpoints and read as `expired`. On
164+
such an object with no `archive`, a retention override below the declared
165+
window is rejected and the declared window applies; to keep rows for less
166+
time, shorten the declared window. On any other sealed object (one created at
167+
runtime) the sweeper still deletes sealed rows, which then read as missing.
167168

168169
## Operations
169170

170171
| Knob | Where | Effect |
171172
|:-----|:------|:-------|
172173
| `enabled` | `lifecycle` settings namespace | Runtime master switch |
173-
| `retention_overrides` | settings, **tenant-scoped** | Per-object window overrides — a regulated tenant sets `'2y'` while dev keeps days |
174+
| `retention_overrides` | settings, **tenant-scoped** | Per-object window overrides — a regulated tenant sets `'2y'` while dev keeps days; sealed objects: see § Sealing |
174175
| `quotas` / `quota_defaults` | settings | Row ceilings; breaches ALERT (never delete beyond declared policy) |
175176
| `growth_alert_rows` | settings | Per-sweep growth spike alert |
176177
| `OS_LIFECYCLE_DISABLED=1` | env | Disables sweeping entirely |

0 commit comments

Comments
 (0)