@catalyst-cloud/schema 0.1.21 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/events/registry.ts +14 -0
- package/src/events/retention.ts +30 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@catalyst-cloud/schema",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Typed Drizzle schema = single source of truth for the per-tenant Mirror DO SQLite store (CTC-13 / ADR-0002). Shared by the mirror Worker, the host-sync replica, and the browser OPFS replica.",
|
|
6
6
|
"license": "MIT",
|
package/src/events/registry.ts
CHANGED
|
@@ -1607,6 +1607,20 @@ export const durableEventTypes = {
|
|
|
1607
1607
|
wakes: { consumerClass: "dispatcher" },
|
|
1608
1608
|
entity: "ticket",
|
|
1609
1609
|
},
|
|
1610
|
+
"runner.start.failed": {
|
|
1611
|
+
rationale:
|
|
1612
|
+
"CTC-951 — the MirrorDO alarm's existence-push (ADR-0037 Amendment 7) tried to start a tenant runner and the platform refused it. ADR-0039 durable-fact example ('a runner reported an outcome'): the first failure of a backoff episode. NOT wake-eligible — a start failure must never itself trigger the dispatcher, or the dispatch plane would wake on its own retry clock.",
|
|
1613
|
+
ingestVerb: "coordination.publish",
|
|
1614
|
+
wakes: false,
|
|
1615
|
+
entity: "runner",
|
|
1616
|
+
},
|
|
1617
|
+
"runner.start.recovered": {
|
|
1618
|
+
rationale:
|
|
1619
|
+
"CTC-951 — a tenant runner start succeeded after a prior runner.start.failed backoff episode closed it. The paired recovery fact to runner.start.failed; never appended for a start that never failed, and never appended merely because the eligible work that triggered the episode disappeared during backoff (that is a silent clear, not a recovery).",
|
|
1620
|
+
ingestVerb: "coordination.publish",
|
|
1621
|
+
wakes: false,
|
|
1622
|
+
entity: "runner",
|
|
1623
|
+
},
|
|
1610
1624
|
"session.ended": {
|
|
1611
1625
|
rationale: "An agent session ended — a real lifecycle boundary fact.",
|
|
1612
1626
|
ingestVerb: "coordination.publish",
|
package/src/events/retention.ts
CHANGED
|
@@ -162,6 +162,36 @@ export function mayPruneHotEvent(check: HotEventPruneCheck): boolean {
|
|
|
162
162
|
return check.archivedAt !== null && check.ageMs > EVENT_HOT_WINDOW_MS;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
// ── Session transcripts — the artifact plane's first lifecycle class (CTC-963 / ADR-0041) ─────────
|
|
166
|
+
//
|
|
167
|
+
// Transcripts are NOT events and get their OWN retention class: short default, longer
|
|
168
|
+
// keep-on-failure, neither inherited from event retention above nor from ADR-0036's original
|
|
169
|
+
// no-lifecycle default. The name prefixes are imported by apps/mirror's transcript name grammar so
|
|
170
|
+
// the route grammar and the retention markers share one definition.
|
|
171
|
+
//
|
|
172
|
+
// ⚠️ THE TWO WINDOWS BELOW ARE POLICY, NOT WHAT THE BUCKET CURRENTLY ENFORCES. R2 lifecycle rules
|
|
173
|
+
// filter on `conditions.prefix` ONLY — no suffix, no tag — and these markers sit in the LAST key
|
|
174
|
+
// segment, so NO lifecycle rule can select by outcome. The interim enforcement is ONE delete-age
|
|
175
|
+
// rule per account transcript-scope prefix (`${account}/linear-`) at the 180-day FAIL window:
|
|
176
|
+
// fail-class matches exactly, ok-class is kept 6x longer, and the error is toward retention rather
|
|
177
|
+
// than toward destroying post-mortem evidence. Splitting the two windows needs an R2 suffix/tag
|
|
178
|
+
// filter or a name-aware sweeper (ADR-0041 point 4; revisit at CTC-967). Provisioning calls:
|
|
179
|
+
// docs/devops.md → "Session transcript lifecycle rules"; policy: the transcript section of
|
|
180
|
+
// docs/event-backbone/retention-and-deletion.md.
|
|
181
|
+
|
|
182
|
+
/** A transcript whose worker reported a clean outcome is kept 30 days. */
|
|
183
|
+
export const TRANSCRIPT_RETENTION_OK_MS = 30 * 24 * 60 * 60 * 1000; // 30 days
|
|
184
|
+
|
|
185
|
+
/** A transcript whose worker failed/died mid-phase is kept 180 days — keep-on-failure, so a
|
|
186
|
+
* post-mortem is possible long after the ok-class copies have expired. */
|
|
187
|
+
export const TRANSCRIPT_RETENTION_FAIL_MS = 180 * 24 * 60 * 60 * 1000; // 180 days
|
|
188
|
+
|
|
189
|
+
/** The name marker a clean-outcome transcript carries in its final key segment. */
|
|
190
|
+
export const TRANSCRIPT_OK_NAME_PREFIX = "transcript-ok-";
|
|
191
|
+
|
|
192
|
+
/** The name marker a failed/crashed-outcome transcript carries in its final key segment. */
|
|
193
|
+
export const TRANSCRIPT_FAIL_NAME_PREFIX = "transcript-fail-";
|
|
194
|
+
|
|
165
195
|
/** Bump when the projection's slot ASSIGNMENT changes (a field moves position, or the slot count
|
|
166
196
|
* changes); additive-at-the-end changes to a slot's semantic meaning still bump, because AE has no
|
|
167
197
|
* schema to enforce it and a silent reinterpretation of an existing blob/double is the failure mode
|