From 66fa70d613f19b724a56b69e0adb339ec39747df Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 10:19:45 +0000 Subject: [PATCH 1/2] 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 --- .../37881-skills-lifecycle-signed-expiry.md | 14 +++++++ skills/objectstack-data/rules/lifecycle.md | 37 ++++++++++--------- 2 files changed, 33 insertions(+), 18 deletions(-) create mode 100644 .changeset/37881-skills-lifecycle-signed-expiry.md diff --git a/.changeset/37881-skills-lifecycle-signed-expiry.md b/.changeset/37881-skills-lifecycle-signed-expiry.md new file mode 100644 index 00000000000..39abfc7dce3 --- /dev/null +++ b/.changeset/37881-skills-lifecycle-signed-expiry.md @@ -0,0 +1,14 @@ +--- +'@objectstack/skills': patch +--- + +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 + +Clause-②: no (published prose only; teaches behaviour already on main) +Metadata-protocol: none + +`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. + +The same sentence said no verifier is built. `os audit verify` reads the checkpoints back, so that clause is removed. + +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. diff --git a/skills/objectstack-data/rules/lifecycle.md b/skills/objectstack-data/rules/lifecycle.md index d5834bd8ee8..f2372b2de9a 100644 --- a/skills/objectstack-data/rules/lifecycle.md +++ b/skills/objectstack-data/rules/lifecycle.md @@ -2,17 +2,15 @@ Declaring how long an object's data lives and how its space is reclaimed (ADR-0057). Distinct from -**lifecycle hooks** (`beforeInsert` / `afterUpdate` …), which run logic on -writes. +**lifecycle hooks**, which run logic on writes. ## Why This Exists Every object without a `lifecycle` block is **immortal**: rows are never -deleted, and on SQLite the file never shrinks. That's correct for business -records — and a guaranteed disk leak for anything append-only. +deleted, and on SQLite the file never shrinks. -**Rule: any append-only, high-write-rate object (event log, run history, -delivery outbox, ephemeral tokens) MUST declare a `lifecycle` block.** +**Rule: any append-only, high-write-rate object MUST declare a `lifecycle` +block.** The platform LifecycleService sweeps declared policies hourly, deletes expired rows under a system context, and reclaims driver space. @@ -96,7 +94,7 @@ Duration literals: `` + `h` / `d` / `w` / `y`. ## Validation Rules (rejected at parse time) ```typescript -// ❌ Non-record class with no bounding policy — grows forever, exactly the bug +// ❌ Non-record class with no bounding policy lifecycle: { class: 'telemetry' } // ❌ archive.after must equal retention.maxAge @@ -113,17 +111,15 @@ lifecycle: { ## Safety Semantics -- **Archive-then-delete is atomic-ish and safe by default**: an object - declaring `archive` is never hot-deleted before the copy to the archive - datasource succeeded. If no datasource is registered under the `archive.to` - name, rows are simply retained. -- **Rotation** physically time-shards the table on SQLite (writes hit the +- **Archive-then-delete**: an object declaring `archive` is never + hot-deleted before the copy to the archive datasource succeeded. If no + datasource is registered under the `archive.to` name, rows are retained. +- **Rotation** time-shards the table on SQLite (writes hit the current shard, reads go through a view under the object's name, expired shards are DROPped). Other dialects enforce the same window with an age-based reap. - **Separation**: registering a datasource named `telemetry` moves every - `telemetry`/`event`/`audit` object onto it — telemetry bloat can't touch - the business DB. + `telemetry`/`event`/`audit` object onto it. ## Sealing (`seal`) @@ -161,16 +157,21 @@ text `tenant_id` outside `valueFields` (or `chainField: 'organization_id'`), and beside `seal` any `onlyWhen`, a `ttl` not on `created_at`, or rotation `storage`. Unsealed, `error` hourly: no declared `id`; a `password`, `secret`, `formula`, `summary`, `image`, `file`, `avatar`, `video` or `audio` -column; no `cryptoProvider` on `AuditPlugin`. Not built yet (ADR-0154): a -verifier, so a break is recorded but not reported; expiry (P4), so the sweeper -still deletes sealed rows, which then read as missing. +column; no `cryptoProvider` on `AuditPlugin`. + +Signed expiry covers objects whose lifecycle is declared in packaged metadata: +their 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; to keep rows for less +time, shorten the declared window. On any other sealed object (one created at +runtime) the sweeper still deletes sealed rows, which then read as missing. ## Operations | Knob | Where | Effect | |:-----|:------|:-------| | `enabled` | `lifecycle` settings namespace | Runtime master switch | -| `retention_overrides` | settings, **tenant-scoped** | Per-object window overrides — a regulated tenant sets `'2y'` while dev keeps days | +| `retention_overrides` | settings, **tenant-scoped** | Per-object window overrides — a regulated tenant sets `'2y'` while dev keeps days; sealed objects: see § Sealing | | `quotas` / `quota_defaults` | settings | Row ceilings; breaches ALERT (never delete beyond declared policy) | | `growth_alert_rows` | settings | Per-sweep growth spike alert | | `OS_LIFECYCLE_DISABLED=1` | env | Disables sweeping entirely | From c68dc00c19fb4660e20fd03b305b922e00885e57 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 11:20:33 +0000 Subject: [PATCH 2/2] docs(skills): eval case 16 expects the signed-expiry teaching the lifecycle rule now carries Claude-Session: https://claude.ai/code/session_01L6bhgXcjUDyiKHv8oX32ik Co-authored-by: Claude --- .changeset/37881-skills-lifecycle-signed-expiry.md | 2 ++ .../objectstack-data/evals/objects-fields-relationships.json | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.changeset/37881-skills-lifecycle-signed-expiry.md b/.changeset/37881-skills-lifecycle-signed-expiry.md index 39abfc7dce3..6812bc2ebc8 100644 --- a/.changeset/37881-skills-lifecycle-signed-expiry.md +++ b/.changeset/37881-skills-lifecycle-signed-expiry.md @@ -12,3 +12,5 @@ Metadata-protocol: none The same sentence said no verifier is built. `os audit verify` reads the checkpoints back, so that clause is removed. 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. + +Eval case 16 of `skills/objectstack-data/evals/objects-fields-relationships.json` graded the two withdrawn statements (`not reported`, and `read as missing` for an object an author declares). It now expects the page as it stands: `must_contain` carries `expired` in their place, and `expected_output` ends with the three sentences of the new paragraph. diff --git a/skills/objectstack-data/evals/objects-fields-relationships.json b/skills/objectstack-data/evals/objects-fields-relationships.json index cbcc28faee9..5a6363b76d1 100644 --- a/skills/objectstack-data/evals/objects-fields-relationships.json +++ b/skills/objectstack-data/evals/objects-fields-relationships.json @@ -275,7 +275,7 @@ { "id": 16, "prompt": "Our `consent_change` audit log must show it if anyone edits, inserts or deletes rows directly in the database, but whatever proof is stored must not carry the consent text itself. How do I declare that?", - "expected_output": "Keep `lifecycle.class: 'audit'` with its bounding `retention` (or a `ttl` on `created_at`) and add `seal: { valueFields: ['consent_text'] }`: the audit plugin signs each `created_at` hour into one checkpoint per organization, chained to the one before, where `valueFields` columns enter as salted commitments and every other column in clear. The object declares its own `id` and a text or lookup `tenant_id` field; without that `tenant_id` (and with no `chainField` naming another chain column, such as the injected `organization_id`) it is refused at parse, and without `id` it parses but is not sealed, and the sealer reports it at `error` each hour. Refused at parse: `seal` on a class other than `audit`, `valueFields` naming `id`, `created_at` or an undeclared field, and beside `seal` a `retention` or `ttl` `onlyWhen`, a `ttl` on another field, or rotation `storage`. Two limits today: no verifier reads the checkpoints back yet, so a break is recorded but not reported; and until expiry ships, the sweeper still deletes sealed rows, which then read as missing. Field history is not tamper evidence.", + "expected_output": "Keep `lifecycle.class: 'audit'` with its bounding `retention` (or a `ttl` on `created_at`) and add `seal: { valueFields: ['consent_text'] }`: the audit plugin signs each `created_at` hour into one checkpoint per organization, chained to the one before, where `valueFields` columns enter as salted commitments and every other column in clear. The object declares its own `id` and a text or lookup `tenant_id` field; without that `tenant_id` (and with no `chainField` naming another chain column, such as the injected `organization_id`) it is refused at parse, and without `id` it parses but is not sealed, and the sealer reports it at `error` each hour. Refused at parse: `seal` on a class other than `audit`, `valueFields` naming `id`, `created_at` or an undeclared field, and beside `seal` a `retention` or `ttl` `onlyWhen`, a `ttl` on another field, or rotation `storage`. Signed expiry covers objects whose lifecycle is declared in packaged metadata, as this one is: its sealed rows leave only by whole checkpoints and read as `expired`. With no `archive`, a retention override below the declared window is rejected and the declared window applies; to keep rows for less time, shorten the declared window. On any other sealed object (one created at runtime) the sweeper still deletes sealed rows, which then read as missing. Field history is not tamper evidence.", "files": [], "assertions": { "must_contain": [ @@ -283,8 +283,7 @@ "valueFields", "tenant_id", "salted commitments", - "read as missing", - "not reported" + "expired" ], "must_not_contain": [ "trackHistory",