Skip to content

Commit 43ce731

Browse files
docs(skills): the lifecycle rule teaches the signed-expiry scope and the retention floor of a packaged sealed object (#37913)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuCEahzFts17HReXUCv1LZP1)_ Fixes #37881 Clause-②: no Metadata-protocol: none Related: #31908, #37605, #33773 ## 维护者速读 - 是什么:对外发布的技能包里,讲「带防篡改封印的审计对象数据留多久」的那一页改成和现在的平台一致:随包发布的封印对象到期后按整段检查点清理,设置里把保留期改得比对象声明的更短会被拒绝;运行时创建的封印对象照旧按保留期清扫。只改教 AI 的文字,用户无感。 - 为什么:平台行为今天已经合入(审计防篡改专题的最后一块),技能包还在教「到期没做完、设置里可以随意缩短保留期」,照着做的 AI 和实施人员会给客户错误的预期。 - 出错会怎样:只动技能包文字,写错了最多是 AI 学到一句不准的话,可以直接撤回这次修改。 - 要你做的:无,座位复核后交审批人。 ## What changes One published skill page and one eval case of the same bundle, prose only. No code, no ceiling row. **`skills/objectstack-data/rules/lifecycle.md`** - *Sealing (`seal`)*. The last sentence said expiry is not built, "so the sweeper still deletes sealed rows, which then read as missing". After PR #37605 that holds only for some sealed objects. The section now ends with one paragraph, in the wording the merged changeset, `content/docs/data-modeling/objects.mdx` and the `lifecycle.seal` description use: - **The scope.** Signed expiry covers objects whose lifecycle is declared in packaged metadata: their sealed rows leave only by whole checkpoints and read as `expired`. - **The floor.** 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. - **Every other sealed object** (one created at runtime): the sentence the page carried, kept for that case only. The sweeper still deletes sealed rows, which then read as missing. - *Operations*, the `retention_overrides` row points at that paragraph ("sealed objects: see § Sealing"), so a reader who starts from the settings table meets the floor. - The same sentence also said no verifier is built ("a break is recorded but not reported"). `os audit verify` has shipped and reads the checkpoints back, and the new paragraph says how rows read, so that clause is removed. See *Decided in the thread*. The page teaches behaviour only: what an author declares and what then happens to the rows. It says nothing about how a checkpoint or an expiry is signed. **`skills/objectstack-data/evals/objects-fields-relationships.json`** (case 16 only; S1 of contract review 7216914110, claim amendment 7216941615) - The case graded the two statements the page no longer makes for an object an author declares: `must_contain` held `not reported` and `read as missing`, and the grader passes an answer only when every token appears. It now holds `expired` in their place. - `expected_output` ended with "Two limits today: no verifier ... until expiry ships ...". It now ends with the three sentences of the new paragraph, and says the prompt's object is one declared in packaged metadata. - Nothing else in the case moves: the prompt, the other four tokens, `must_not_contain`, and the one-checkpoint-per-organization wording (card 33773's). **Paid for in the same file (token ratchet, no ceiling moves).** Each cut is restatement, rationale or filler, and what an author needs stays on the page: | Cut | Where it still lives | |:--|:--| | "That's correct for business records — and a guaranteed disk leak for anything append-only." (*Why This Exists*) | the `record` row of *Lifecycle Classes* ("permanent; policies FORBIDDEN") and the rule sentence that follows | | "— grows forever, exactly the bug" (first *Validation Rules* example comment) | the comment still names the refusal ("Non-record class with no bounding policy"); the reason is the first sentence of *Why This Exists* | | "(event log, run history, delivery outbox, ephemeral tokens)" in the rule sentence | the *Typical use* column of *Lifecycle Classes*, one use per class | | "(`beforeInsert` / `afterUpdate` …)" in the intro | the sentence still tells the two meanings of "lifecycle" apart; the hook names are taught on the hooks pages | | "is atomic-ish and safe by default" (the *Archive-then-delete* bullet lead) | the bullet's own sentence states the guarantee: never hot-deleted before the archive copy succeeded | | "— telemetry bloat can't touch the business DB" (the *Separation* bullet) | rationale only; the behaviour (the objects move onto that datasource) stays | | "simply", "physically" (*Safety Semantics*) | filler | Skill size readings, against `main` @ `f7f9345e`: | | lines before | lines after | tokens before | tokens after | |:--|--:|--:|--:|--:| | `skills/objectstack-data/rules/lifecycle.md` | 199 | 200 | 1931 | 1931 (ceiling 1931) | | `skills/objectstack-data/evals/objects-fields-relationships.json` (eval fixture, measured and not ratcheted) | 521 | 520 | 9184 | 9241 | | every published `SKILL.md`, summed | 4959 | 4959 | | | | ratcheted (authored) bundle | | | 199685 | 199685 | Net lines across `skills/**`: 0 (the page +1, the eval case -1; the claim's budget is +12). Decided in the thread (small, listed per the standing rule): - **The "no verifier" clause is removed here.** It is the `lifecycle.md` :164-166 item of card 33773 (queued, unclaimed). It shares one sentence with the expiry clause this card rewrites, and leaving it would put "no verifier" beside "read as `expired`". The seat agreed in the thread to take that one item here and not to fold the card; a deletion only, which also pays part of the ratchet. Everything else of card 33773 stays with it: the one-checkpoint-per-organization wording (page :131-133 and the eval case's `expected_output`) and the `chainField` teaching. The seat notes this on that card after the merge. - **Eval case 16 follows the page** (added after the contract review, see *What changes*). `expired` is the token the review named: it is the one word the new paragraph teaches for an object an author declares that the old page did not carry. - **"(one created at runtime)"** names the other case the way the merged texts do ("an object created at runtime"); the card's own words are "any other sealed object", and both are on the page. - **Not added, to stay inside the card's three items and the file's ceiling:** that the window is counted to the start of a UTC day and at most 10,000 rows leave per sweep; that rows are kept while no sealer runs; and how a tenant-scoped window applies per chain. `content/docs/data-modeling/objects.mdx` carries all three. - No `Skills-docs:` line: the kind is `none` and there is no `(narrowing)` arm. - Branch name: the platform assigned `claude/project-thread-zjjrt8`, so it does not carry the issue number. ## Why PR #37605 (merged 2026-11-27) made sealed rows of packaged objects expire by whole checkpoints and floored their retention overrides at the declared window. It declared the skill text as a follow-up because `skills/**` is governed. Until the page changes, an agent that writes a sealed object from it expects a settings override to shorten the window, and tells its user that expired sealed rows read as missing. ## Tests Prose only, so no unit test changes and no ablation. Local gates, run on the final head `c68dc00c` (`main` @ `f7f9345e` merged in, full `pnpm build` 123 of 123 tasks before the eval commit, which touches no built file): `node scripts/pm/dispatch-gates.mjs --commands` derives 48 families for this diff, all 48 ran with exit 0, and `--ran` answers: ```text ✓ dispatch-gates --ran: 48 derived famil(ies) accounted for — 48 run, 0 NOT-MEASURED (a DERIVED zero — all 48 recorded an exit code and none of them is 3). ``` The ones that read the page: <details><summary>verdict lines</summary> ```text ✓ check-skills-token-ratchet: 61 authored bundle file(s) within their ceilings; 11 generator-owned file(s) and 42 eval fixture(s) measured, not ratcheted. skills/objectstack-data/rules/lifecycle.md 1931 / 1931 (+0) skills/objectstack-data/evals/objects-fields-relationships.json 9241 / — (eval fixture) ratcheted (authored) 199685 / 199685 (+0) ✓ check-skill-served-sections: 24 served section(s), each heading exactly once in its file (6 json, 2 json+ts, 16 neutral); 10 JSON fence(s) parse and pass their spec validators. ✓ check-skill-links: 272 relative link(s) in 76 published skill file(s) resolve; 140 fragment(s) name a real heading under GitHub's slug rule. ``` `check:skill-compatibility`, `check:skill-frame-sync`, `check:skill-identifier-liveness`, `check:doc-authoring`, `check:pm-skill-id-lint`, `check:nul-bytes`, `check:dual-build-cjs-loads`, `check:lean-entry-closure` and lint `check:doc-formula-expressions`: exit 0. The same 48 also ran with exit 0 on the two earlier heads: `66fa70d6`, before `main` was merged in, and `ca1303b9`, the head the contract review read. </details> Everything else is CI's run: the check-runs on this PR are the record. ## Acceptance notes - Premise re-read on `main` @ `1e721fdb` before writing: `lifecycle.md` :164-166 and the `retention_overrides` row (:173) still carried the old text, and the blocker is merged (`0296d972`). `main` moved one commit while the branch was open (`f7f9345e`, `packages/metadata-protocol` and one docs page, nothing under `skills/`); it is merged in and the gates above ran on the merged head. The wording was read from the merged changeset (`.changeset/31908-p4c-sealed-expiry.md`), `content/docs/data-modeling/objects.mdx` (*Sealed audit objects*), the `lifecycle.seal` description in `packages/spec/src/data/object.zod.ts`, and the floor's own remedy text in `packages/plugins/plugin-audit/src/audit-seal/retention-floor.ts` ("to keep its rows for less time, shorten the window the object declares"). - Which objects take signed expiry is one predicate on `main` (`takesSignedExpiry`, `packages/objectql/src/lifecycle/signed-expiry-scope.ts`); the page says "declared in packaged metadata" and "created at runtime", as the public docs do, and names no internal. - The *Save Notice* section is served by exact heading (`packages/spec/scripts/skill-served-sections.json`) and is byte-identical to `main`. ## Verification Read first: `skills/objectstack-data/rules/lifecycle.md`, the last paragraph of *Sealing (`seal`)*, then the `retention_overrides` row of *Operations*, then case 16 of the eval file. The risk hunk is the new paragraph: each of its three sentences should match what PR #37605 merged. Two-minute check: `node scripts/check-skills-token-ratchet.mjs` prints `skills/objectstack-data/rules/lifecycle.md 1931 / 1931 (+0)` and exits 0. Tier H: `skills/**`. Contract review 7216914110 (PASS, one should-fix) read head `ca1303b9`; the eval commit answers its S1, and the delta review over `c68dc00c` is the seat's. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes. - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgXcjUDyiKHv8oX32ik --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgXcjUDyiKHv8oX32ik)_ <!-- signed: repo:objectstack#2 · os-sales · session_01L6bhgXcjUDyiKHv8oX32ik --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent a8396da commit 43ce731

3 files changed

Lines changed: 37 additions & 21 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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.
15+
16+
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.

‎skills/objectstack-data/evals/objects-fields-relationships.json‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,15 @@
275275
{
276276
"id": 16,
277277
"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?",
278-
"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.",
278+
"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.",
279279
"files": [],
280280
"assertions": {
281281
"must_contain": [
282282
"seal",
283283
"valueFields",
284284
"tenant_id",
285285
"salted commitments",
286-
"read as missing",
287-
"not reported"
286+
"expired"
288287
],
289288
"must_not_contain": [
290289
"trackHistory",

‎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)