@substrat-run/kernel 0.158.0 → 0.160.0

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.
Files changed (95) hide show
  1. package/dist/billing-retention.d.ts +46 -0
  2. package/dist/billing-retention.d.ts.map +1 -0
  3. package/dist/billing-retention.js +78 -0
  4. package/dist/billing-retention.js.map +1 -0
  5. package/dist/byte-stream.d.ts +102 -0
  6. package/dist/byte-stream.d.ts.map +1 -0
  7. package/dist/byte-stream.js +153 -0
  8. package/dist/byte-stream.js.map +1 -0
  9. package/dist/connection-landings.d.ts +15 -3
  10. package/dist/connection-landings.d.ts.map +1 -1
  11. package/dist/connection-landings.js +10 -2
  12. package/dist/connection-landings.js.map +1 -1
  13. package/dist/deadline-fetch.d.ts +34 -0
  14. package/dist/deadline-fetch.d.ts.map +1 -0
  15. package/dist/deadline-fetch.js +231 -0
  16. package/dist/deadline-fetch.js.map +1 -0
  17. package/dist/deployment-wire-auth.d.ts +82 -0
  18. package/dist/deployment-wire-auth.d.ts.map +1 -0
  19. package/dist/deployment-wire-auth.js +150 -0
  20. package/dist/deployment-wire-auth.js.map +1 -0
  21. package/dist/entity-trash.d.ts +65 -8
  22. package/dist/entity-trash.d.ts.map +1 -1
  23. package/dist/entity-trash.js +80 -12
  24. package/dist/entity-trash.js.map +1 -1
  25. package/dist/export-break.d.ts +6 -0
  26. package/dist/export-break.d.ts.map +1 -1
  27. package/dist/export-break.js +11 -0
  28. package/dist/export-break.js.map +1 -1
  29. package/dist/index.d.ts +18 -9
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +16 -7
  32. package/dist/index.js.map +1 -1
  33. package/dist/invocation-line.d.ts +3 -2
  34. package/dist/invocation-line.d.ts.map +1 -1
  35. package/dist/invocation-line.js +2 -0
  36. package/dist/invocation-line.js.map +1 -1
  37. package/dist/meter-days.d.ts +107 -0
  38. package/dist/meter-days.d.ts.map +1 -0
  39. package/dist/meter-days.js +230 -0
  40. package/dist/meter-days.js.map +1 -0
  41. package/dist/meters.d.ts +19 -1
  42. package/dist/meters.d.ts.map +1 -1
  43. package/dist/meters.js +0 -0
  44. package/dist/meters.js.map +1 -1
  45. package/dist/ops-failure-reference.d.ts +31 -0
  46. package/dist/ops-failure-reference.d.ts.map +1 -0
  47. package/dist/ops-failure-reference.js +32 -0
  48. package/dist/ops-failure-reference.js.map +1 -0
  49. package/dist/platform-request-cap.d.ts +9 -0
  50. package/dist/platform-request-cap.d.ts.map +1 -0
  51. package/dist/platform-request-cap.js +42 -0
  52. package/dist/platform-request-cap.js.map +1 -0
  53. package/dist/platform-sweep.d.ts +170 -7
  54. package/dist/platform-sweep.d.ts.map +1 -1
  55. package/dist/platform-sweep.js +375 -45
  56. package/dist/platform-sweep.js.map +1 -1
  57. package/dist/request-rollup.d.ts +161 -0
  58. package/dist/request-rollup.d.ts.map +1 -0
  59. package/dist/request-rollup.js +273 -0
  60. package/dist/request-rollup.js.map +1 -0
  61. package/dist/reserved-roles.d.ts +157 -4
  62. package/dist/reserved-roles.d.ts.map +1 -1
  63. package/dist/reserved-roles.js +216 -2
  64. package/dist/reserved-roles.js.map +1 -1
  65. package/dist/schedule-state.d.ts +5 -0
  66. package/dist/schedule-state.d.ts.map +1 -1
  67. package/dist/scope-host.d.ts +260 -15
  68. package/dist/scope-host.d.ts.map +1 -1
  69. package/dist/scope-host.js +53 -2
  70. package/dist/scope-host.js.map +1 -1
  71. package/dist/scope-lifecycle.d.ts +7 -0
  72. package/dist/scope-lifecycle.d.ts.map +1 -1
  73. package/dist/scope-lifecycle.js +7 -0
  74. package/dist/scope-lifecycle.js.map +1 -1
  75. package/dist/scope-record.d.ts +16 -5
  76. package/dist/scope-record.d.ts.map +1 -1
  77. package/dist/scope-record.js +72 -7
  78. package/dist/scope-record.js.map +1 -1
  79. package/dist/spine-restore.d.ts +7 -3
  80. package/dist/spine-restore.d.ts.map +1 -1
  81. package/dist/spine-restore.js +14 -3
  82. package/dist/spine-restore.js.map +1 -1
  83. package/dist/storage-gauge.d.ts +47 -13
  84. package/dist/storage-gauge.d.ts.map +1 -1
  85. package/dist/storage-gauge.js +84 -27
  86. package/dist/storage-gauge.js.map +1 -1
  87. package/dist/subject-redaction.d.ts +9 -3
  88. package/dist/subject-redaction.d.ts.map +1 -1
  89. package/dist/subject-redaction.js +24 -12
  90. package/dist/subject-redaction.js.map +1 -1
  91. package/dist/vertical-owners.d.ts +69 -0
  92. package/dist/vertical-owners.d.ts.map +1 -0
  93. package/dist/vertical-owners.js +108 -0
  94. package/dist/vertical-owners.js.map +1 -0
  95. package/package.json +2 -2
@@ -321,7 +321,11 @@ export declare function redactSubjectSweepRunIntents(sql: RedactionSql, subjectI
321
321
  * prefix, so the directory walk and the writer cannot drift about the link between them.
322
322
  */
323
323
  export declare function platformIntentFailureMessage(intentId: string, text: string): string;
324
- /** The intent an ops-failure message is about, or null — `platformIntentFailureMessage` read back. */
324
+ /**
325
+ * The intent an ops-failure message is about, or null — `platformIntentFailureMessage` read back.
326
+ * A staff row's text may begin with an upstream reference marker ahead of it (#2554,
327
+ * `withUpstreamReference`), which is read past.
328
+ */
325
329
  export declare function intentIdOfFailureMessage(message: string): string | null;
326
330
  /** What the directory half is handed: the erased scope's tenant, and the scope half's intent ids. */
327
331
  export interface SubjectTextTarget {
@@ -357,14 +361,16 @@ export declare const ISSUE_EXEMPLAR_OWNER_BACKFILL_SQL = "UPDATE _substrat_issue
357
361
  *
358
362
  * - `_substrat_ops_failures.message` — the drain's record of an intent it gave up on, or
359
363
  * settled `failed`, quotes that intent's `last_error`. When the intent is one the erasure
360
- * tombstoned (`intentIds`, in this tenant and scope), the message is a copy of text the
364
+ * tombstoned (`intentIds`, in this scope, on this tenant's row or on staff's row of the pair
365
+ * the drain files, #2554), the message is a copy of text the
361
366
  * scope half already redacted, and goes with it. A row in this tenant, or the platform's
362
367
  * own row with no tenant, that names the subject's id goes too.
363
368
  * - `_substrat_issues.last_message` — the newest exemplar of an ops-failure group. Its
364
369
  * writer records whose failure it copied (`last_owner_kind`, `last_tenant_id`, in the same
365
370
  * statement), and erasure reads that rather than the ops-failure rows, which issues outlive.
366
371
  * A tenant's exemplar is rewritten only for that tenant, by the same two links; the
367
- * platform's own on a direct id match, as its ops-failure row is. An exemplar of unknown
372
+ * platform's own on a direct id match, as its ops-failure row is, or on the intent link (a
373
+ * drain pair's sample is staff's text, #2554). An exemplar of unknown
368
374
  * owner (a legacy row nothing attributed) is skipped: the matched text can come from
369
375
  * anyone's request, so an unattributed row is never read as this tenant's.
370
376
  * - `_substrat_sweep_runs.error` — a scheduled operation's throw, matched on the subject's
@@ -1 +1 @@
1
- {"version":3,"file":"subject-redaction.d.ts","sourceRoot":"","sources":["../src/subject-redaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,sBAAsB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAI3E;AA4BD,mDAAmD;AACnD,MAAM,WAAW,iCAAiC;IAChD,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB;;;;;OAKG;IACH,QAAQ,EAAE,mBAAmB,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B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G,IAAI,CAiD7F"}
@@ -36,7 +36,7 @@
36
36
  * `platformRequestHistoryQuery`'s reason, sharpened: three surfaces answer one question
37
37
  * from this table, and a privacy guarantee that holds on one adapter is not a guarantee.
38
38
  */
39
- import { SWEEP_RUNS_KIND } from '@substrat-run/contracts';
39
+ import { SWEEP_RUNS_KIND, upstreamReferenceMarker, upstreamReferenceOf } from '@substrat-run/contracts';
40
40
  /**
41
41
  * The one key a redacted intent payload carries, and nothing else in the system does.
42
42
  *
@@ -491,6 +491,8 @@ export function redactSubjectSweepRunIntents(sql, subjectId) {
491
491
  }
492
492
  }
493
493
  const PLATFORM_INTENT_FAILURE_PREFIX = 'platform intent ';
494
+ /** How a staff row's upstream reference marker opens (`upstreamReferenceMarker`, #2540). */
495
+ const UPSTREAM_MARKER_OPENING = upstreamReferenceMarker('').slice(0, -1);
494
496
  /**
495
497
  * How the drain words an ops failure about one intent. The reader below parses the same
496
498
  * prefix, so the directory walk and the writer cannot drift about the link between them.
@@ -498,11 +500,17 @@ const PLATFORM_INTENT_FAILURE_PREFIX = 'platform intent ';
498
500
  export function platformIntentFailureMessage(intentId, text) {
499
501
  return `${PLATFORM_INTENT_FAILURE_PREFIX}${intentId} ${text}`;
500
502
  }
501
- /** The intent an ops-failure message is about, or null — `platformIntentFailureMessage` read back. */
503
+ /**
504
+ * The intent an ops-failure message is about, or null — `platformIntentFailureMessage` read back.
505
+ * A staff row's text may begin with an upstream reference marker ahead of it (#2554,
506
+ * `withUpstreamReference`), which is read past.
507
+ */
502
508
  export function intentIdOfFailureMessage(message) {
503
- if (!message.startsWith(PLATFORM_INTENT_FAILURE_PREFIX))
509
+ const handle = upstreamReferenceOf(message);
510
+ const text = handle === null ? message : message.slice(upstreamReferenceMarker(handle).length + 1);
511
+ if (!text.startsWith(PLATFORM_INTENT_FAILURE_PREFIX))
504
512
  return null;
505
- const rest = message.slice(PLATFORM_INTENT_FAILURE_PREFIX.length);
513
+ const rest = text.slice(PLATFORM_INTENT_FAILURE_PREFIX.length);
506
514
  const end = rest.indexOf(' ');
507
515
  return end > 0 ? rest.slice(0, end) : null;
508
516
  }
@@ -535,14 +543,16 @@ export const ISSUE_EXEMPLAR_OWNER_BACKFILL_SQL = `UPDATE _substrat_issues
535
543
  *
536
544
  * - `_substrat_ops_failures.message` — the drain's record of an intent it gave up on, or
537
545
  * settled `failed`, quotes that intent's `last_error`. When the intent is one the erasure
538
- * tombstoned (`intentIds`, in this tenant and scope), the message is a copy of text the
546
+ * tombstoned (`intentIds`, in this scope, on this tenant's row or on staff's row of the pair
547
+ * the drain files, #2554), the message is a copy of text the
539
548
  * scope half already redacted, and goes with it. A row in this tenant, or the platform's
540
549
  * own row with no tenant, that names the subject's id goes too.
541
550
  * - `_substrat_issues.last_message` — the newest exemplar of an ops-failure group. Its
542
551
  * writer records whose failure it copied (`last_owner_kind`, `last_tenant_id`, in the same
543
552
  * statement), and erasure reads that rather than the ops-failure rows, which issues outlive.
544
553
  * A tenant's exemplar is rewritten only for that tenant, by the same two links; the
545
- * platform's own on a direct id match, as its ops-failure row is. An exemplar of unknown
554
+ * platform's own on a direct id match, as its ops-failure row is, or on the intent link (a
555
+ * drain pair's sample is staff's text, #2554). An exemplar of unknown
546
556
  * owner (a legacy row nothing attributed) is skipped: the matched text can come from
547
557
  * anyone's request, so an unattributed row is never read as this tenant's.
548
558
  * - `_substrat_sweep_runs.error` — a scheduled operation's throw, matched on the subject's
@@ -565,9 +575,10 @@ export function redactSubjectDirectoryText(sql, target) {
565
575
  return;
566
576
  const intents = new Set(target.intentIds);
567
577
  // Rows whose text the drain wrote about one of those intents — read back by the grammar it
568
- // wrote them in, so the SQL only narrows to the prefix and the id decides.
578
+ // wrote them in, so the SQL only narrows to the prefix (or a staff row's upstream marker ahead
579
+ // of it) and the id decides.
569
580
  const redactLinked = (table, key, text, where, params) => {
570
- const rows = sql(`SELECT ${key} AS key, ${text} AS text FROM ${table} WHERE ${where}instr(${text}, ?) = 1`, [...params, PLATFORM_INTENT_FAILURE_PREFIX]);
581
+ const rows = sql(`SELECT ${key} AS key, ${text} AS text FROM ${table} WHERE ${where}(instr(${text}, ?) = 1 OR instr(${text}, ?) = 1)`, [...params, PLATFORM_INTENT_FAILURE_PREFIX, UPSTREAM_MARKER_OPENING]);
571
582
  for (const row of rows) {
572
583
  const id = intentIdOfFailureMessage(row.text);
573
584
  if (id !== null && intents.has(id)) {
@@ -575,12 +586,13 @@ export function redactSubjectDirectoryText(sql, target) {
575
586
  }
576
587
  }
577
588
  };
578
- redactLinked('_substrat_ops_failures', 'id', 'message', 'tenant_id = ? AND scope_id = ? AND ', [
589
+ // #2554: the drain files an intent's failure as a pair, and staff's row (no tenant, the same
590
+ // scope) carries the error, as does the issue sample it becomes (the platform's). An intent id is
591
+ // a ulid this scope's own erasure tombstoned, so the link reaches those as well.
592
+ redactLinked('_substrat_ops_failures', 'id', 'message', '(tenant_id = ? OR tenant_id IS NULL) AND scope_id = ? AND ', [
579
593
  target.tenantId,
580
594
  target.scopeId,
581
595
  ]);
582
- redactLinked('_substrat_issues', 'fingerprint', 'last_message', "last_owner_kind = 'tenant' AND last_tenant_id = ? AND ", [
583
- target.tenantId,
584
- ]);
596
+ redactLinked('_substrat_issues', 'fingerprint', 'last_message', "((last_owner_kind = 'tenant' AND last_tenant_id = ?) OR last_owner_kind = 'platform') AND ", [target.tenantId]);
585
597
  }
586
598
  //# sourceMappingURL=subject-redaction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subject-redaction.js","sourceRoot":"","sources":["../src/subject-redaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,qBAAqB,CAAC,SAAiB,EAAE,EAAU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AAI,EAAE,CAAC;YACvB,MAAM,EAAE,GAAG,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC9C,IAAI,EAAE,KAAK,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;gBACnC,GAAG,CAAC,UAAU,KAAK,QAAQ,IAAI,cAAc,GAAG,MAAM,EAAE,CAAC,qBAAqB,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YAC5F,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IACF,6FAA6F;IAC7F,kGAAkG;IAClG,iFAAiF;IACjF,YAAY,CAAC,wBAAwB,EAAE,IAAI,EAAE,SAAS,EAAE,4DAA4D,EAAE;QACpH,MAAM,CAAC,QAAQ;QACf,MAAM,CAAC,OAAO;KACf,CAAC,CAAC;IACH,YAAY,CACV,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,4FAA4F,EAC5F,CAAC,MAAM,CAAC,QAAQ,CAAC,CAClB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,69 @@
1
+ import { type VerticalOwnerPeriod } from '@substrat-run/contracts';
2
+ import type { RedactionSql } from './subject-redaction.js';
3
+ /**
4
+ * The history of who owned each vertical slug (#2501), as statements both adapters run against
5
+ * their directory: the SQLite host over better-sqlite3, the hosted one inside ControlPlaneDO.
6
+ * Written once so the two cannot keep different histories of the same fleet.
7
+ *
8
+ * `verticals.owner_tenant` says who owns a slug now, and nothing says who owned it before: a slug
9
+ * deleted and registered again, perhaps by another tenant, leaves no trace of the first owner
10
+ * outside the admin log. A later invoice for a past period bills the builder who owned the
11
+ * vertical then, so each registration is a period here: opened in the transaction that inserts
12
+ * the `verticals` row, closed in the one that deletes it. A slug never changes owner in place
13
+ * (a conflicting re-registration is refused), so those two are the only transitions.
14
+ *
15
+ * At most one period of a slug is open, held by a partial unique index. `owner` is NULL for a
16
+ * platform-owned vertical. `(slug, since)` is deliberately not a key: a slug deleted and registered
17
+ * again within one millisecond has two periods with the same `since`, and the second registration
18
+ * must not fail for it.
19
+ */
20
+ export declare const VERTICAL_OWNERS_DDL = "\n CREATE TABLE IF NOT EXISTS _substrat_vertical_owners (\n slug TEXT NOT NULL,\n owner TEXT,\n since TEXT NOT NULL,\n until TEXT\n );\n CREATE INDEX IF NOT EXISTS _substrat_vertical_owners_slug ON _substrat_vertical_owners (slug, since);\n CREATE UNIQUE INDEX IF NOT EXISTS _substrat_vertical_owners_open ON _substrat_vertical_owners (slug) WHERE until IS NULL;\n";
21
+ /**
22
+ * Open a period for every registered vertical that has none, from the row's own `created_at`.
23
+ * Run by both adapters' schema pass on every start, which is what backfills a directory from before
24
+ * the history, and by a directory restore after its rows are in, so a dump taken before the history
25
+ * comes back with one. A vertical whose period is open is left alone, so it runs once in effect.
26
+ * A registration before it, of a slug deleted and registered again, is in the admin log only.
27
+ */
28
+ export declare const VERTICAL_OWNERS_BACKFILL = "INSERT INTO _substrat_vertical_owners (slug, owner, since, until)\n SELECT v.slug, v.owner_tenant, v.created_at, NULL FROM verticals v\n WHERE NOT EXISTS (SELECT 1 FROM _substrat_vertical_owners o WHERE o.slug = v.slug AND o.until IS NULL)";
29
+ /**
30
+ * The one clock every period stamp is read on: the wall clock, which is what both hosts stamp a
31
+ * `verticals` row's `created_at` (a period's `since`) with. A delete's `until` and a restore's
32
+ * close of a stray period read it too, so the history never mixes a test host's injected clock
33
+ * with the wall clock its registrations were stamped on.
34
+ */
35
+ export declare const verticalOwnerNow: () => string;
36
+ /**
37
+ * Refuse a directory dump that holds two open periods of one slug, before any of its rows load.
38
+ * The open-period index would refuse the second row anyway, as a raw constraint error; this names
39
+ * the slug, in the words the loader's other refusals use. Nothing was changed: it runs first.
40
+ */
41
+ export declare function assertOneOpenVerticalOwnerPeriod(tables: readonly {
42
+ name: string;
43
+ columns: readonly string[];
44
+ rows: readonly (readonly unknown[])[];
45
+ }[]): void;
46
+ /**
47
+ * Close every open period whose slug has no `verticals` row, at `at` (or at the period's own
48
+ * `since`, if that is later, so a period never ends before it began). A directory restore runs it
49
+ * once the dump's rows are in, with `verticalOwnerNow()`: an open period with no row would
50
+ * otherwise make the next registration of that slug fail on the open-period index. Closed, not
51
+ * dropped, so the period stays in the history.
52
+ *
53
+ * One direction only: it closes what has no row, and changes nothing about a slug that has one.
54
+ * A period whose `since` lies ahead of the clock (clock skew, or a hand-edited dump) closes at
55
+ * that `since`, and a registration of the slug after it then opens a period that starts earlier
56
+ * and overlaps it. The history records both as they were stamped.
57
+ */
58
+ export declare function verticalOwnersStrayCloseSql(at: string): string;
59
+ /** Open the slug's period as its `verticals` row is inserted, in that insert's transaction. */
60
+ export declare function openVerticalOwnerRow(sql: RedactionSql, slug: string, owner: string | null, since: string): void;
61
+ /** Close the slug's open period as its `verticals` row is deleted, in that delete's transaction. */
62
+ export declare function closeVerticalOwnerRow(sql: RedactionSql, slug: string, until: string): void;
63
+ /**
64
+ * Every period of a slug's ownership, oldest first. Parsed on the way out. Two periods with the same
65
+ * `since` are ordered closed first, since only the last can be open; `rowid` breaks whatever tie
66
+ * is left, so the order never depends on the plan.
67
+ */
68
+ export declare function listVerticalOwnerRows(sql: RedactionSql, slug: string): VerticalOwnerPeriod[];
69
+ //# sourceMappingURL=vertical-owners.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vertical-owners.d.ts","sourceRoot":"","sources":["../src/vertical-owners.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+C,KAAK,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAChH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,mBAAmB,iYAS/B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,uPAEqE,CAAC;AAE3G;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,QAAO,MAAkC,CAAC;AAEvE;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC,SAAS,OAAO,EAAE,CAAC,EAAE,CAAA;CAAE,EAAE,GACrG,IAAI,CAoBN;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAK9D;AAED,+FAA+F;AAC/F,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAE/G;AAED,oGAAoG;AACpG,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAE1F;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAW5F"}
@@ -0,0 +1,108 @@
1
+ import { instant, substratError, verticalOwnerPeriod } from '@substrat-run/contracts';
2
+ /**
3
+ * The history of who owned each vertical slug (#2501), as statements both adapters run against
4
+ * their directory: the SQLite host over better-sqlite3, the hosted one inside ControlPlaneDO.
5
+ * Written once so the two cannot keep different histories of the same fleet.
6
+ *
7
+ * `verticals.owner_tenant` says who owns a slug now, and nothing says who owned it before: a slug
8
+ * deleted and registered again, perhaps by another tenant, leaves no trace of the first owner
9
+ * outside the admin log. A later invoice for a past period bills the builder who owned the
10
+ * vertical then, so each registration is a period here: opened in the transaction that inserts
11
+ * the `verticals` row, closed in the one that deletes it. A slug never changes owner in place
12
+ * (a conflicting re-registration is refused), so those two are the only transitions.
13
+ *
14
+ * At most one period of a slug is open, held by a partial unique index. `owner` is NULL for a
15
+ * platform-owned vertical. `(slug, since)` is deliberately not a key: a slug deleted and registered
16
+ * again within one millisecond has two periods with the same `since`, and the second registration
17
+ * must not fail for it.
18
+ */
19
+ export const VERTICAL_OWNERS_DDL = `
20
+ CREATE TABLE IF NOT EXISTS _substrat_vertical_owners (
21
+ slug TEXT NOT NULL,
22
+ owner TEXT,
23
+ since TEXT NOT NULL,
24
+ until TEXT
25
+ );
26
+ CREATE INDEX IF NOT EXISTS _substrat_vertical_owners_slug ON _substrat_vertical_owners (slug, since);
27
+ CREATE UNIQUE INDEX IF NOT EXISTS _substrat_vertical_owners_open ON _substrat_vertical_owners (slug) WHERE until IS NULL;
28
+ `;
29
+ /**
30
+ * Open a period for every registered vertical that has none, from the row's own `created_at`.
31
+ * Run by both adapters' schema pass on every start, which is what backfills a directory from before
32
+ * the history, and by a directory restore after its rows are in, so a dump taken before the history
33
+ * comes back with one. A vertical whose period is open is left alone, so it runs once in effect.
34
+ * A registration before it, of a slug deleted and registered again, is in the admin log only.
35
+ */
36
+ export const VERTICAL_OWNERS_BACKFILL = `INSERT INTO _substrat_vertical_owners (slug, owner, since, until)
37
+ SELECT v.slug, v.owner_tenant, v.created_at, NULL FROM verticals v
38
+ WHERE NOT EXISTS (SELECT 1 FROM _substrat_vertical_owners o WHERE o.slug = v.slug AND o.until IS NULL)`;
39
+ /**
40
+ * The one clock every period stamp is read on: the wall clock, which is what both hosts stamp a
41
+ * `verticals` row's `created_at` (a period's `since`) with. A delete's `until` and a restore's
42
+ * close of a stray period read it too, so the history never mixes a test host's injected clock
43
+ * with the wall clock its registrations were stamped on.
44
+ */
45
+ export const verticalOwnerNow = () => new Date().toISOString();
46
+ /**
47
+ * Refuse a directory dump that holds two open periods of one slug, before any of its rows load.
48
+ * The open-period index would refuse the second row anyway, as a raw constraint error; this names
49
+ * the slug, in the words the loader's other refusals use. Nothing was changed: it runs first.
50
+ */
51
+ export function assertOneOpenVerticalOwnerPeriod(tables) {
52
+ const owners = tables.find((t) => t.name.toLowerCase() === '_substrat_vertical_owners');
53
+ if (!owners)
54
+ return;
55
+ const slugAt = owners.columns.findIndex((c) => c.toLowerCase() === 'slug');
56
+ const untilAt = owners.columns.findIndex((c) => c.toLowerCase() === 'until');
57
+ if (slugAt < 0 || untilAt < 0)
58
+ return;
59
+ const open = new Set();
60
+ const twice = new Set();
61
+ for (const row of owners.rows) {
62
+ if (row[untilAt] !== null && row[untilAt] !== undefined)
63
+ continue;
64
+ if (open.has(row[slugAt]))
65
+ twice.add(String(row[slugAt]));
66
+ open.add(row[slugAt]);
67
+ }
68
+ if (twice.size > 0) {
69
+ throw substratError('validation_failed', `restore refused: the dump's _substrat_vertical_owners holds more than one open period for: ${[...twice].sort().join(', ')}. ` +
70
+ 'A slug has at most one registration standing at a time. Nothing was changed.');
71
+ }
72
+ }
73
+ /**
74
+ * Close every open period whose slug has no `verticals` row, at `at` (or at the period's own
75
+ * `since`, if that is later, so a period never ends before it began). A directory restore runs it
76
+ * once the dump's rows are in, with `verticalOwnerNow()`: an open period with no row would
77
+ * otherwise make the next registration of that slug fail on the open-period index. Closed, not
78
+ * dropped, so the period stays in the history.
79
+ *
80
+ * One direction only: it closes what has no row, and changes nothing about a slug that has one.
81
+ * A period whose `since` lies ahead of the clock (clock skew, or a hand-edited dump) closes at
82
+ * that `since`, and a registration of the slug after it then opens a period that starts earlier
83
+ * and overlaps it. The history records both as they were stamped.
84
+ */
85
+ export function verticalOwnersStrayCloseSql(at) {
86
+ // Interpolated, not bound: the adapters run it through `exec`. `instant` holds it to an
87
+ // ISO-8601 UTC timestamp, which carries no quote, or throws.
88
+ return `UPDATE _substrat_vertical_owners SET until = MAX(since, '${instant.parse(at)}')
89
+ WHERE until IS NULL AND NOT EXISTS (SELECT 1 FROM verticals v WHERE v.slug = _substrat_vertical_owners.slug)`;
90
+ }
91
+ /** Open the slug's period as its `verticals` row is inserted, in that insert's transaction. */
92
+ export function openVerticalOwnerRow(sql, slug, owner, since) {
93
+ sql('INSERT INTO _substrat_vertical_owners (slug, owner, since, until) VALUES (?, ?, ?, NULL)', [slug, owner, since]);
94
+ }
95
+ /** Close the slug's open period as its `verticals` row is deleted, in that delete's transaction. */
96
+ export function closeVerticalOwnerRow(sql, slug, until) {
97
+ sql('UPDATE _substrat_vertical_owners SET until = ? WHERE slug = ? AND until IS NULL', [until, slug]);
98
+ }
99
+ /**
100
+ * Every period of a slug's ownership, oldest first. Parsed on the way out. Two periods with the same
101
+ * `since` are ordered closed first, since only the last can be open; `rowid` breaks whatever tie
102
+ * is left, so the order never depends on the plan.
103
+ */
104
+ export function listVerticalOwnerRows(sql, slug) {
105
+ const rows = sql('SELECT slug, owner, since, until FROM _substrat_vertical_owners WHERE slug = ? ORDER BY since, until IS NULL, until, rowid', [slug]);
106
+ return rows.map((r) => verticalOwnerPeriod.parse(r));
107
+ }
108
+ //# sourceMappingURL=vertical-owners.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vertical-owners.js","sourceRoot":"","sources":["../src/vertical-owners.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAA4B,MAAM,yBAAyB,CAAC;AAGhH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;CASlC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;;0GAEkE,CAAC;AAE3G;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAW,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAEvE;;;;GAIG;AACH,MAAM,UAAU,gCAAgC,CAC9C,MAAsG;IAEtG,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,2BAA2B,CAAC,CAAC;IACxF,IAAI,CAAC,MAAM;QAAE,OAAO;IACpB,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,E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AE,KAAoB,EAAE,KAAa;IACvG,GAAG,CAAC,0FAA0F,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AACxH,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,qBAAqB,CAAC,GAAiB,EAAE,IAAY,EAAE,KAAa;IAClF,GAAG,CAAC,iFAAiF,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AACxG,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAiB,EAAE,IAAY;IACnE,MAAM,IAAI,GAAG,GAAG,CACd,4HAA4H,EAC5H,CAAC,IAAI,CAAC,CAML,CAAC;IACJ,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@substrat-run/kernel",
3
- "version": "0.158.0",
3
+ "version": "0.160.0",
4
4
  "description": "Substrat kernel contracts and services — pure TypeScript, no platform imports (D-14)",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -34,7 +34,7 @@
34
34
  "dist"
35
35
  ],
36
36
  "dependencies": {
37
- "@substrat-run/contracts": "^0.158.0"
37
+ "@substrat-run/contracts": "^0.160.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/node": "^22.20.5",