@substrat-run/kernel 0.141.0 → 0.143.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 (195) hide show
  1. package/dist/async-invocation-log.d.ts +1 -1
  2. package/dist/async-invocation-log.d.ts.map +1 -1
  3. package/dist/async-invocation-log.js +1 -1
  4. package/dist/async-invocation-log.js.map +1 -1
  5. package/dist/attachment-extractor.d.ts +0 -9
  6. package/dist/attachment-extractor.d.ts.map +1 -1
  7. package/dist/attachment-extractor.js +2 -2
  8. package/dist/attachment-extractor.js.map +1 -1
  9. package/dist/attachment-text.d.ts +0 -5
  10. package/dist/attachment-text.d.ts.map +1 -1
  11. package/dist/attachment-text.js +0 -4
  12. package/dist/attachment-text.js.map +1 -1
  13. package/dist/attribution.d.ts +0 -7
  14. package/dist/attribution.d.ts.map +1 -1
  15. package/dist/attribution.js +0 -7
  16. package/dist/attribution.js.map +1 -1
  17. package/dist/audit-outcome.d.ts +60 -2
  18. package/dist/audit-outcome.d.ts.map +1 -1
  19. package/dist/audit-outcome.js +63 -3
  20. package/dist/audit-outcome.js.map +1 -1
  21. package/dist/capability.d.ts +123 -14
  22. package/dist/capability.d.ts.map +1 -1
  23. package/dist/capability.js +266 -16
  24. package/dist/capability.js.map +1 -1
  25. package/dist/connector-calls.d.ts +3 -77
  26. package/dist/connector-calls.d.ts.map +1 -1
  27. package/dist/connector-calls.js +4 -63
  28. package/dist/connector-calls.js.map +1 -1
  29. package/dist/denial-query.d.ts +0 -14
  30. package/dist/denial-query.d.ts.map +1 -1
  31. package/dist/denial-query.js +1 -1
  32. package/dist/denial-query.js.map +1 -1
  33. package/dist/derived-handlers.d.ts +17 -0
  34. package/dist/derived-handlers.d.ts.map +1 -0
  35. package/dist/derived-handlers.js +106 -0
  36. package/dist/derived-handlers.js.map +1 -0
  37. package/dist/entity-grant-shape.d.ts +79 -7
  38. package/dist/entity-grant-shape.d.ts.map +1 -1
  39. package/dist/entity-grant-shape.js +177 -74
  40. package/dist/entity-grant-shape.js.map +1 -1
  41. package/dist/entity-grant.d.ts +0 -5
  42. package/dist/entity-grant.d.ts.map +1 -1
  43. package/dist/entity-grant.js +0 -4
  44. package/dist/entity-grant.js.map +1 -1
  45. package/dist/entity-state.d.ts +0 -17
  46. package/dist/entity-state.d.ts.map +1 -1
  47. package/dist/entity-state.js +2 -2
  48. package/dist/entity-state.js.map +1 -1
  49. package/dist/entity-trash.d.ts +2 -2
  50. package/dist/entity-trash.d.ts.map +1 -1
  51. package/dist/entity-trash.js +6 -6
  52. package/dist/entity-trash.js.map +1 -1
  53. package/dist/grant-scoped-read.d.ts +0 -2
  54. package/dist/grant-scoped-read.d.ts.map +1 -1
  55. package/dist/grant-scoped-read.js +2 -2
  56. package/dist/grant-scoped-read.js.map +1 -1
  57. package/dist/index.d.ts +58 -139
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +53 -107
  60. package/dist/index.js.map +1 -1
  61. package/dist/invocation-line.d.ts +211 -0
  62. package/dist/invocation-line.d.ts.map +1 -0
  63. package/dist/invocation-line.js +33 -0
  64. package/dist/invocation-line.js.map +1 -0
  65. package/dist/job-run.d.ts +0 -39
  66. package/dist/job-run.d.ts.map +1 -1
  67. package/dist/job-run.js +6 -6
  68. package/dist/job-run.js.map +1 -1
  69. package/dist/list-index.d.ts +0 -45
  70. package/dist/list-index.d.ts.map +1 -1
  71. package/dist/list-index.js +2 -39
  72. package/dist/list-index.js.map +1 -1
  73. package/dist/membership-executor.d.ts +2 -1
  74. package/dist/membership-executor.d.ts.map +1 -1
  75. package/dist/membership-executor.js +1 -1
  76. package/dist/membership-executor.js.map +1 -1
  77. package/dist/meters.d.ts +21 -1
  78. package/dist/meters.d.ts.map +1 -1
  79. package/dist/meters.js +0 -0
  80. package/dist/meters.js.map +1 -1
  81. package/dist/migration-digest.d.ts +0 -12
  82. package/dist/migration-digest.d.ts.map +1 -1
  83. package/dist/migration-digest.js +1 -1
  84. package/dist/migration-digest.js.map +1 -1
  85. package/dist/module-log.d.ts +5 -4
  86. package/dist/module-log.d.ts.map +1 -1
  87. package/dist/module-log.js +5 -4
  88. package/dist/module-log.js.map +1 -1
  89. package/dist/module-operations.d.ts +146 -0
  90. package/dist/module-operations.d.ts.map +1 -0
  91. package/dist/module-operations.js +174 -0
  92. package/dist/module-operations.js.map +1 -0
  93. package/dist/peer.d.ts +0 -2
  94. package/dist/peer.d.ts.map +1 -1
  95. package/dist/peer.js +0 -4
  96. package/dist/peer.js.map +1 -1
  97. package/dist/permission-checker.d.ts +23 -0
  98. package/dist/permission-checker.d.ts.map +1 -1
  99. package/dist/permission-checker.js.map +1 -1
  100. package/dist/permission-eval.d.ts.map +1 -1
  101. package/dist/permission-eval.js +77 -21
  102. package/dist/permission-eval.js.map +1 -1
  103. package/dist/platform-request-query.d.ts +6 -6
  104. package/dist/platform-request-query.d.ts.map +1 -1
  105. package/dist/platform-request-query.js +23 -7
  106. package/dist/platform-request-query.js.map +1 -1
  107. package/dist/platform-sweep.d.ts +107 -3
  108. package/dist/platform-sweep.d.ts.map +1 -1
  109. package/dist/platform-sweep.js +131 -2
  110. package/dist/platform-sweep.js.map +1 -1
  111. package/dist/refusal-query.d.ts +0 -11
  112. package/dist/refusal-query.d.ts.map +1 -1
  113. package/dist/refusal-query.js +1 -1
  114. package/dist/refusal-query.js.map +1 -1
  115. package/dist/refusals.d.ts +1 -3
  116. package/dist/refusals.d.ts.map +1 -1
  117. package/dist/refusals.js +0 -2
  118. package/dist/refusals.js.map +1 -1
  119. package/dist/row-decode.d.ts +16 -1
  120. package/dist/row-decode.d.ts.map +1 -1
  121. package/dist/row-decode.js +18 -6
  122. package/dist/row-decode.js.map +1 -1
  123. package/dist/scope-copy-ledger.d.ts +49 -2
  124. package/dist/scope-copy-ledger.d.ts.map +1 -1
  125. package/dist/scope-copy-ledger.js +44 -1
  126. package/dist/scope-copy-ledger.js.map +1 -1
  127. package/dist/scope-host.d.ts +100 -110
  128. package/dist/scope-host.d.ts.map +1 -1
  129. package/dist/scope-host.js +0 -17
  130. package/dist/scope-host.js.map +1 -1
  131. package/dist/scope-lifecycle.d.ts +0 -21
  132. package/dist/scope-lifecycle.d.ts.map +1 -1
  133. package/dist/scope-lifecycle.js +1 -1
  134. package/dist/scope-lifecycle.js.map +1 -1
  135. package/dist/scope-role-admin.d.ts +0 -6
  136. package/dist/scope-role-admin.d.ts.map +1 -1
  137. package/dist/scope-role-admin.js +1 -1
  138. package/dist/scope-role-admin.js.map +1 -1
  139. package/dist/search-index.d.ts +0 -23
  140. package/dist/search-index.d.ts.map +1 -1
  141. package/dist/search-index.js +2 -24
  142. package/dist/search-index.js.map +1 -1
  143. package/dist/spine-restore.d.ts +0 -22
  144. package/dist/spine-restore.d.ts.map +1 -1
  145. package/dist/spine-restore.js +2 -2
  146. package/dist/spine-restore.js.map +1 -1
  147. package/dist/sql-limits.d.ts +4 -0
  148. package/dist/sql-limits.d.ts.map +1 -1
  149. package/dist/sql-limits.js +4 -0
  150. package/dist/sql-limits.js.map +1 -1
  151. package/dist/storage-gauge.d.ts +125 -0
  152. package/dist/storage-gauge.d.ts.map +1 -0
  153. package/dist/storage-gauge.js +234 -0
  154. package/dist/storage-gauge.js.map +1 -0
  155. package/dist/subject-redaction.d.ts +0 -38
  156. package/dist/subject-redaction.d.ts.map +1 -1
  157. package/dist/subject-redaction.js +4 -4
  158. package/dist/subject-redaction.js.map +1 -1
  159. package/dist/system-switch-record.d.ts +0 -4
  160. package/dist/system-switch-record.d.ts.map +1 -1
  161. package/dist/system-switch-record.js +2 -2
  162. package/dist/system-switch-record.js.map +1 -1
  163. package/dist/system-switch.d.ts +0 -23
  164. package/dist/system-switch.d.ts.map +1 -1
  165. package/dist/system-switch.js +1 -1
  166. package/dist/system-switch.js.map +1 -1
  167. package/dist/table-ownership.d.ts +0 -32
  168. package/dist/table-ownership.d.ts.map +1 -1
  169. package/dist/table-ownership.js +5 -5
  170. package/dist/table-ownership.js.map +1 -1
  171. package/dist/testing.d.ts +17 -0
  172. package/dist/testing.d.ts.map +1 -0
  173. package/dist/testing.js +15 -0
  174. package/dist/testing.js.map +1 -0
  175. package/dist/vertical-events.d.ts +1 -7
  176. package/dist/vertical-events.d.ts.map +1 -1
  177. package/dist/vertical-events.js +2 -10
  178. package/dist/vertical-events.js.map +1 -1
  179. package/package.json +14 -2
  180. package/dist/invocation-log.d.ts +0 -447
  181. package/dist/invocation-log.d.ts.map +0 -1
  182. package/dist/invocation-log.js +0 -410
  183. package/dist/invocation-log.js.map +0 -1
  184. package/dist/platform-call.d.ts +0 -45
  185. package/dist/platform-call.d.ts.map +0 -1
  186. package/dist/platform-call.js +0 -63
  187. package/dist/platform-call.js.map +0 -1
  188. package/dist/provider-error.d.ts +0 -38
  189. package/dist/provider-error.d.ts.map +0 -1
  190. package/dist/provider-error.js +0 -65
  191. package/dist/provider-error.js.map +0 -1
  192. package/dist/routed-node.d.ts +0 -87
  193. package/dist/routed-node.d.ts.map +0 -1
  194. package/dist/routed-node.js +0 -67
  195. package/dist/routed-node.js.map +0 -1
@@ -51,8 +51,35 @@ import type { SwitchSql } from './system-switch.js';
51
51
  * record. A sharing shape, which people reach through `ctx.grant` (todo's `list`), is skipped
52
52
  * whole, backfill included, so a sharee is never marked a holder.
53
53
  */
54
+ /**
55
+ * The index every marker walk reads (#2083): markers only, in `(object, subject)` order, so one
56
+ * shape's markers are one range (`<type>:` up to `<type>;`) and a pass's cursor is a seek into
57
+ * it. Without it a pass scanned the whole `_substrat_tuples` table, even when it had nothing to
58
+ * do. Partial, so it costs a row per marker and nothing for any other tuple. SQLite uses a
59
+ * partial index only where it can prove the index's WHERE from the query's, so the walks write the
60
+ * relation as this same literal: proved from the text alone, with no dependence on SQLite
61
+ * re-planning once a parameter is bound. In KERNEL_DDL on both adapters, which every wake re-runs,
62
+ * so an existing scope builds it on its next wake.
63
+ */
64
+ export declare const SHAPE_MARKER_INDEX_DDL = "CREATE INDEX IF NOT EXISTS _substrat_tuples_shape_marker ON _substrat_tuples (object, subject) WHERE relation = 'bootstrap'";
54
65
  /** Holders topped up per pass — one transaction each, so a large scope never holds one long. */
55
66
  export declare const SHAPE_TOP_UP_BATCH = 500;
67
+ /**
68
+ * Markers a pass may READ, per row of work it may write. The budget bounds writes, but finding
69
+ * the holders who need one means reading past the ones who do not, and on a scope where nobody
70
+ * does (the common reconcile: nothing changed) that is every marker. Ten per row keeps a pass at
71
+ * 5000 index rows by default, short on any scope, while a rollout still spends most of each pass
72
+ * writing. A pass that reads its window without filling its budget hands back a cursor, and the
73
+ * next pass reads on from there.
74
+ */
75
+ export declare const SHAPE_MARKER_READS_PER_ROW = 10;
76
+ /**
77
+ * Confirming walks that may take keys, per shape per reconcile, before its retirement is left open
78
+ * for the next reconcile. Each one that takes keys starts another, so a steady stream of grants of
79
+ * a retired key landing ahead of the walk would otherwise keep a single reconcile walking forever.
80
+ * Left open, the retirement keeps no record, so the next reconcile simply runs it again.
81
+ */
82
+ export declare const SHAPE_RETIRE_CONFIRMS_MAX = 3;
56
83
  /** The largest batch a caller may ask for: past this a pass is the long transaction it exists to avoid. */
57
84
  export declare const SHAPE_TOP_UP_BATCH_MAX = 5000;
58
85
  /** `batch`, or `validation_failed`: a pass size is a positive integer no larger than the max. */
@@ -64,6 +91,45 @@ export declare function shapeTopUpBatch(batch?: number): number;
64
91
  * transaction, so the marker and its keys land together or not at all.
65
92
  */
66
93
  export declare function grantEntityShapeIn(db: SwitchSql, principal: PrincipalId, entity: EntityRef, permissions: readonly string[]): void;
94
+ /**
95
+ * Where a pass stopped, so the next pass of the same reconcile starts there instead of at the
96
+ * first marker (#2083): the shape (its index in `shapes`), the step of it, and for a marker walk
97
+ * the last marker it read. Without it every pass re-read the holders earlier passes had already
98
+ * finished, and a rollout cost passes × markers.
99
+ *
100
+ * Skipping what lies behind it is safe because a walk leaves every marker it passes finished:
101
+ * topped up (each key now has a row) or with its retired keys tombstoned. A marker written behind
102
+ * it mid-run is complete when a shape grant writes it, and the backfill finishes before its
103
+ * shape's walks begin. The exception is a shape grant by an OLDER deployment, carrying the shape
104
+ * as it was, landing behind the cursor while the reconcile runs:
105
+ *
106
+ * - Missing a key the shape gained: the top-up keeps no record, so the next reconcile's top-up
107
+ * reaches that holder.
108
+ * - Holding a key the shape retired: a retirement ends in a run-once record, so a holder it never
109
+ * saw would never be reached. The first walk therefore never writes that record. Once it reaches
110
+ * the last marker, a CONFIRMING walk starts again from the first (`confirm`), and the record is
111
+ * written only when a confirming walk reaches the last marker having taken nothing; one that
112
+ * took keys starts another, up to `SHAPE_RETIRE_CONFIRMS_MAX`; past that the retirement is left
113
+ * open for the next reconcile. A grant landing behind the confirming walk itself is the gap
114
+ * left, the same as one landing after the retirement finished.
115
+ */
116
+ export interface ShapeCursor {
117
+ shape: number;
118
+ step: 'backfill' | 'retire' | 'topUp';
119
+ /** The last marker a walk read; `null` resumes the step from its start. */
120
+ marker: {
121
+ object: string;
122
+ subject: string;
123
+ } | null;
124
+ /**
125
+ * A confirming retire walk only: whether it has taken nothing so far, and how many confirming
126
+ * walks before it, on this shape in this reconcile, took keys.
127
+ */
128
+ confirm?: {
129
+ clean: boolean;
130
+ count: number;
131
+ };
132
+ }
67
133
  /** Where a pass runs and how its events are stamped — the facts only the adapter holds. */
68
134
  export interface ShapePass {
69
135
  tenantId: string;
@@ -73,22 +139,28 @@ export interface ShapePass {
73
139
  now: string;
74
140
  /** Rows of work at most: a backfill mark or a holder topped up each count one. */
75
141
  limit: number;
142
+ /** The previous pass's `next`; absent or `null` starts the reconcile from the beginning. */
143
+ after?: ShapeCursor | null;
76
144
  /** The adapter's monotonic event-id mint, given the instant in ms. */
77
145
  mintEventId: (ms: number) => string;
78
146
  /** The deploy writing the events, for the outbox `version` column. */
79
147
  version: string | null;
80
148
  }
81
149
  /**
82
- * One pass of the reconcile over one scope, at most `limit` rows of work: backfill marks for any
83
- * shape whose backfill is not done here, then holders whose retired keys are taken back, each
84
- * with its `entity.grants-retired` event, then holders topped up, each with its
85
- * `entity.grants-topped-up` event. `done` is false when the budget ran out, and the caller runs
86
- * another pass. Run it inside ONE transaction, so the keys and their events commit together.
87
- * Re-running a finished scope writes nothing.
150
+ * One pass of the reconcile over one scope, at most `limit` rows of work and
151
+ * `limit × SHAPE_MARKER_READS_PER_ROW` markers read: backfill marks for any shape whose backfill
152
+ * is not done here, then holders whose retired keys are taken back, each with its
153
+ * `entity.grants-retired` event, then holders topped up, each with its `entity.grants-topped-up`
154
+ * event. `next` is `null` once the scope is done; otherwise the caller runs another pass with it
155
+ * as `after`. `retirementsLeftOpen` counts the shapes whose retirement this pass gave up on at
156
+ * `SHAPE_RETIRE_CONFIRMS_MAX`, for the next reconcile to run again. Run it inside ONE
157
+ * transaction, so the keys and their events commit together. Re-running a finished scope writes
158
+ * nothing.
88
159
  */
89
160
  export declare function topUpEntityGrantShapes(db: SwitchSql, pass: ShapePass): {
90
161
  toppedUp: number;
91
162
  retired: number;
92
- done: boolean;
163
+ retirementsLeftOpen: number;
164
+ next: ShapeCursor | null;
93
165
  };
94
166
  //# sourceMappingURL=entity-grant-shape.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entity-grant-shape.d.ts","sourceRoot":"","sources":["../src/entity-grant-shape.ts"],"names":[],"mappings":"AAAA,OAAO,EAUL,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAMjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,gGAAgG;AAChG,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,2GAA2G;AAC3G,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C,iGAAiG;AACjG,wBAAgB,eAAe,CAAC,KAAK,GAAE,MAA2B,GAAG,MAAM,CAS1E;AAiBD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,SAAS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AAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAA;CAAE,CA8D9F"}
@@ -55,8 +55,35 @@ import { assertSqlIdentifier } from './sql-identifier.js';
55
55
  * record. A sharing shape, which people reach through `ctx.grant` (todo's `list`), is skipped
56
56
  * whole, backfill included, so a sharee is never marked a holder.
57
57
  */
58
+ /**
59
+ * The index every marker walk reads (#2083): markers only, in `(object, subject)` order, so one
60
+ * shape's markers are one range (`<type>:` up to `<type>;`) and a pass's cursor is a seek into
61
+ * it. Without it a pass scanned the whole `_substrat_tuples` table, even when it had nothing to
62
+ * do. Partial, so it costs a row per marker and nothing for any other tuple. SQLite uses a
63
+ * partial index only where it can prove the index's WHERE from the query's, so the walks write the
64
+ * relation as this same literal: proved from the text alone, with no dependence on SQLite
65
+ * re-planning once a parameter is bound. In KERNEL_DDL on both adapters, which every wake re-runs,
66
+ * so an existing scope builds it on its next wake.
67
+ */
68
+ export const SHAPE_MARKER_INDEX_DDL = `CREATE INDEX IF NOT EXISTS _substrat_tuples_shape_marker ON _substrat_tuples (object, subject) WHERE relation = '${ENTITY_SHAPE_MARKER_RELATION}'`;
58
69
  /** Holders topped up per pass — one transaction each, so a large scope never holds one long. */
59
70
  export const SHAPE_TOP_UP_BATCH = 500;
71
+ /**
72
+ * Markers a pass may READ, per row of work it may write. The budget bounds writes, but finding
73
+ * the holders who need one means reading past the ones who do not, and on a scope where nobody
74
+ * does (the common reconcile: nothing changed) that is every marker. Ten per row keeps a pass at
75
+ * 5000 index rows by default, short on any scope, while a rollout still spends most of each pass
76
+ * writing. A pass that reads its window without filling its budget hands back a cursor, and the
77
+ * next pass reads on from there.
78
+ */
79
+ export const SHAPE_MARKER_READS_PER_ROW = 10;
80
+ /**
81
+ * Confirming walks that may take keys, per shape per reconcile, before its retirement is left open
82
+ * for the next reconcile. Each one that takes keys starts another, so a steady stream of grants of
83
+ * a retired key landing ahead of the walk would otherwise keep a single reconcile walking forever.
84
+ * Left open, the retirement keeps no record, so the next reconcile simply runs it again.
85
+ */
86
+ export const SHAPE_RETIRE_CONFIRMS_MAX = 3;
60
87
  /** The largest batch a caller may ask for: past this a pass is the long transaction it exists to avoid. */
61
88
  export const SHAPE_TOP_UP_BATCH_MAX = 5000;
62
89
  /** `batch`, or `validation_failed`: a pass size is a positive integer no larger than the max. */
@@ -75,6 +102,11 @@ const recordRefs = (entityType, scopeId) => [`shape:${entityType}`, `scope:${sco
75
102
  /** The writer of the top-up events: the kernel, as no module or person acted. */
76
103
  const PRINCIPAL = 'principal:';
77
104
  const keysOf = (permissions) => [...new Set(permissions)].sort();
105
+ /**
106
+ * Every object of one entity type, as an index range: `prefix` is `<type>:`, and `;` is the byte
107
+ * after `:`. A range, not `substr(object, …) = ?`, so an index leading with `object` can seek it.
108
+ */
109
+ const typeRange = (prefix) => [prefix, `${prefix.slice(0, -1)};`];
78
110
  /**
79
111
  * The shape's grant to one person on one entity: the marker and every key, each an explicit
80
112
  * write, so a re-grant brings back what a revoke tombstoned — as `ctx.grant` does.
@@ -92,21 +124,28 @@ export function grantEntityShapeIn(db, principal, entity, permissions) {
92
124
  }
93
125
  }
94
126
  /**
95
- * One pass of the reconcile over one scope, at most `limit` rows of work: backfill marks for any
96
- * shape whose backfill is not done here, then holders whose retired keys are taken back, each
97
- * with its `entity.grants-retired` event, then holders topped up, each with its
98
- * `entity.grants-topped-up` event. `done` is false when the budget ran out, and the caller runs
99
- * another pass. Run it inside ONE transaction, so the keys and their events commit together.
100
- * Re-running a finished scope writes nothing.
127
+ * One pass of the reconcile over one scope, at most `limit` rows of work and
128
+ * `limit × SHAPE_MARKER_READS_PER_ROW` markers read: backfill marks for any shape whose backfill
129
+ * is not done here, then holders whose retired keys are taken back, each with its
130
+ * `entity.grants-retired` event, then holders topped up, each with its `entity.grants-topped-up`
131
+ * event. `next` is `null` once the scope is done; otherwise the caller runs another pass with it
132
+ * as `after`. `retirementsLeftOpen` counts the shapes whose retirement this pass gave up on at
133
+ * `SHAPE_RETIRE_CONFIRMS_MAX`, for the next reconcile to run again. Run it inside ONE
134
+ * transaction, so the keys and their events commit together. Re-running a finished scope writes
135
+ * nothing.
101
136
  */
102
137
  export function topUpEntityGrantShapes(db, pass) {
103
- // Here as well as at each entry point: a pass with no budget never reports done, so a caller
104
- // looping until it does would never stop.
105
- let budget = shapeTopUpBatch(pass.limit);
138
+ // Here as well as at each entry point: a pass with no budget never hands back `next: null`, so
139
+ // a caller looping until it does would never stop.
140
+ const limit = shapeTopUpBatch(pass.limit);
141
+ const room = { writes: limit, reads: limit * SHAPE_MARKER_READS_PER_ROW };
106
142
  recordGranteeKeys(db, pass.shapes);
107
143
  let toppedUp = 0;
108
144
  let retired = 0;
109
- for (const shape of pass.shapes) {
145
+ let retirementsLeftOpen = 0;
146
+ const from = pass.after ?? null;
147
+ for (let i = from?.shape ?? 0; i < pass.shapes.length; i++) {
148
+ const shape = pass.shapes[i];
110
149
  // A sharing shape is never reconciled — not topped up, not backfilled, nothing retired.
111
150
  if (!shape.bootstrap)
112
151
  continue;
@@ -115,80 +154,144 @@ export function topUpEntityGrantShapes(db, pass) {
115
154
  const gone = keysOf(shape.retired ?? []).filter((k) => !keys.includes(k));
116
155
  if (keys.length === 0 && gone.length === 0)
117
156
  continue;
157
+ // Where this shape starts: the cursor's step if it points here, else the beginning.
158
+ const resume = from?.shape === i ? from : null;
159
+ const at = resume?.step ?? 'backfill';
160
+ const marker = (step) => (resume?.step === step ? resume.marker : null);
161
+ const stop = (step, last, confirm) => ({
162
+ toppedUp,
163
+ retired,
164
+ retirementsLeftOpen,
165
+ next: { shape: i, step, marker: last, ...(confirm ? { confirm } : {}) },
166
+ });
118
167
  const prefix = `${shape.entityType}:`;
119
- const json = JSON.stringify(keys);
120
- // A live retired key still identifies a legacy holder so this pass can retire it.
121
- // The grantee query excludes tombstoned tuples.
122
- budget -= backfill(db, pass, shape, prefix, JSON.stringify([...keys, ...gone]), budget);
123
- if (budget === 0)
124
- return { toppedUp, retired, done: false };
125
- reopenRetirements(db, pass, shape.entityType, keys);
126
- const took = retire(db, pass, shape.entityType, prefix, gone, budget);
127
- budget -= took;
128
- retired += took;
129
- if (budget === 0)
130
- return { toppedUp, retired, done: false };
168
+ if (at === 'backfill') {
169
+ // A live retired key still identifies a legacy holder so this pass can retire it.
170
+ // The grantee query excludes tombstoned tuples.
171
+ room.writes -= backfill(db, pass, shape, prefix, JSON.stringify([...keys, ...gone]), room.writes);
172
+ if (room.writes === 0)
173
+ return stop('backfill', null);
174
+ }
175
+ if (at !== 'topUp') {
176
+ reopenRetirements(db, pass, shape.entityType, keys);
177
+ let start = marker('retire');
178
+ // The first walk is never a confirming one; nor is a resumed walk that does not say it is.
179
+ let confirm = resume?.step === 'retire' ? resume.confirm : undefined;
180
+ for (;;) {
181
+ const took = retire(db, pass, shape.entityType, prefix, gone, start, room, confirm?.clean === true);
182
+ retired += took.found.length;
183
+ if (confirm)
184
+ confirm = { ...confirm, clean: confirm.clean && took.found.length === 0 };
185
+ if (!took.done)
186
+ return stop('retire', took.at, confirm);
187
+ if (confirm?.clean)
188
+ break; // `retire` recorded the retirement finished
189
+ // A confirming walk from the first marker, for what landed behind this one; a walk that
190
+ // ended here having taken keys counts against the cap if it was itself confirming.
191
+ const count = confirm ? confirm.count + 1 : 0;
192
+ if (count >= SHAPE_RETIRE_CONFIRMS_MAX) {
193
+ retirementsLeftOpen++;
194
+ break;
195
+ }
196
+ [start, confirm] = [null, { clean: true, count }];
197
+ }
198
+ }
131
199
  if (keys.length === 0)
132
200
  continue;
133
- const holders = db.all(`SELECT m.subject, m.object FROM _substrat_tuples m
134
- WHERE m.relation = ? AND ${liveTupleSql('m')}
135
- AND substr(m.subject, 1, ${PRINCIPAL.length}) = '${PRINCIPAL}'
136
- AND substr(m.object, 1, ?) = ?
137
- AND EXISTS (SELECT 1 FROM json_each(?) k
138
- WHERE NOT EXISTS (SELECT 1 FROM _substrat_tuples t
139
- WHERE t.subject = m.subject AND t.object = m.object
140
- AND t.relation = 'granted:' || k.value))
141
- ORDER BY m.subject, m.object
142
- LIMIT ?`, ENTITY_SHAPE_MARKER_RELATION, pass.now, prefix.length, prefix, json, budget);
143
- for (const h of holders) {
144
- const added = db.all(`SELECT k.value AS key FROM json_each(?) k
145
- WHERE NOT EXISTS (SELECT 1 FROM _substrat_tuples t
146
- WHERE t.subject = ? AND t.object = ? AND t.relation = 'granted:' || k.value)
147
- ORDER BY k.value`, json, h.subject, h.object).map((m) => m.key);
148
- for (const key of added) {
149
- db.run(`INSERT OR IGNORE INTO _substrat_tuples (subject, relation, object) VALUES (?, ?, ?)`, h.subject, `granted:${key}`, h.object);
150
- }
151
- const st = kernelOutboxInsertSql(shapeEvent(pass, ENTITY_GRANTS_TOPPED_UP, entityGrantsToppedUpPayload, {
152
- principal: h.subject.slice(PRINCIPAL.length),
153
- entity: { entityType: shape.entityType, entityId: h.object.slice(prefix.length) },
154
- added,
155
- }), pass.version);
156
- db.run(st.sql, ...st.params);
201
+ const gave = topUp(db, pass, shape.entityType, prefix, keys, marker('topUp'), room);
202
+ toppedUp += gave.found.length;
203
+ if (!gave.done)
204
+ return stop('topUp', gave.at);
205
+ }
206
+ return { toppedUp, retired, retirementsLeftOpen, next: null };
207
+ }
208
+ /** A step with nothing to walk: done, having read nothing. */
209
+ const NOTHING_TO_WALK = { found: [], done: true, at: null };
210
+ /**
211
+ * The live markers of one shape after `after`, in index order, that are `wanted` (a SQL predicate
212
+ * on the marker `m`, binding one parameter: `json`), as many as `room` allows. Spends one write
213
+ * per marker found, and one read per marker FETCHED: the whole window, not only up to where the
214
+ * writes ran out, because SQLite evaluated `wanted` on every row it returned.
215
+ */
216
+ function walkMarkers(db, now, prefix, after, room, wanted, json) {
217
+ if (room.writes === 0 || room.reads === 0)
218
+ return { found: [], done: false, at: after };
219
+ const [, end] = typeRange(prefix);
220
+ const from = after ?? { object: prefix, subject: '' };
221
+ const window = room.reads;
222
+ const rows = db.all(`SELECT m.object, m.subject,
223
+ (substr(m.subject, 1, ${PRINCIPAL.length}) = '${PRINCIPAL}' AND ${liveTupleSql('m')} AND ${wanted}) AS hit
224
+ FROM _substrat_tuples m
225
+ WHERE m.relation = '${ENTITY_SHAPE_MARKER_RELATION}' AND (m.object, m.subject) > (?, ?) AND m.object < ?
226
+ ORDER BY m.object, m.subject
227
+ LIMIT ?`, now, json,
228
+ // A row-value seek: a resumed walk starts after the cursor and reads none of what it passed.
229
+ from.object, from.subject, end, window);
230
+ const found = [];
231
+ let read = 0;
232
+ while (read < rows.length && found.length < room.writes) {
233
+ const r = rows[read++];
234
+ if (r.hit)
235
+ found.push({ subject: r.subject, object: r.object });
236
+ }
237
+ room.reads -= rows.length;
238
+ room.writes -= found.length;
239
+ const last = rows[read - 1];
240
+ return {
241
+ found,
242
+ // Every marker it fetched was read, and the fetch came back short of the window: no more.
243
+ done: read === rows.length && rows.length < window,
244
+ at: last ? { object: last.object, subject: last.subject } : after,
245
+ };
246
+ }
247
+ /**
248
+ * One bounded walk of a shape's top-up: each live marker whose entity lacks a key of the current
249
+ * shape (no row at all — a tombstone is a revoke, kept) gets that key, with one event.
250
+ */
251
+ function topUp(db, pass, entityType, prefix, keys, after, room) {
252
+ const json = JSON.stringify(keys);
253
+ const walk = walkMarkers(db, pass.now, prefix, after, room, `EXISTS (SELECT 1 FROM json_each(?) k
254
+ WHERE NOT EXISTS (SELECT 1 FROM _substrat_tuples t
255
+ WHERE t.subject = m.subject AND t.object = m.object
256
+ AND t.relation = 'granted:' || k.value))`, json);
257
+ for (const h of walk.found) {
258
+ const added = db.all(`SELECT k.value AS key FROM json_each(?) k
259
+ WHERE NOT EXISTS (SELECT 1 FROM _substrat_tuples t
260
+ WHERE t.subject = ? AND t.object = ? AND t.relation = 'granted:' || k.value)
261
+ ORDER BY k.value`, json, h.subject, h.object).map((m) => m.key);
262
+ for (const key of added) {
263
+ db.run(`INSERT OR IGNORE INTO _substrat_tuples (subject, relation, object) VALUES (?, ?, ?)`, h.subject, `granted:${key}`, h.object);
157
264
  }
158
- budget -= holders.length;
159
- toppedUp += holders.length;
160
- if (budget === 0)
161
- return { toppedUp, retired, done: false };
265
+ const st = kernelOutboxInsertSql(shapeEvent(pass, ENTITY_GRANTS_TOPPED_UP, entityGrantsToppedUpPayload, {
266
+ principal: h.subject.slice(PRINCIPAL.length),
267
+ entity: { entityType, entityId: h.object.slice(prefix.length) },
268
+ added,
269
+ }), pass.version);
270
+ db.run(st.sql, ...st.params);
162
271
  }
163
- return { toppedUp, retired, done: true };
272
+ return walk;
164
273
  }
165
274
  /**
166
- * One bounded batch of a shape's retirement: at most `budget` (person, entity) pairs, each a
167
- * live marker still holding a retired key live there, whose retired keys are tombstoned with one
168
- * event. Keys whose retirement already finished on this scope are skipped, and a short batch
169
- * records the rest finished. Returns how many pairs it took keys from.
275
+ * One bounded walk of a shape's retirement: each live marker still holding a retired key live
276
+ * there has its retired keys tombstoned, with one event. Keys whose retirement already finished
277
+ * on this scope are skipped. The rest are recorded finished only by a `clean` (confirming) walk
278
+ * that reaches the shape's last marker having taken nothing.
170
279
  */
171
- function retire(db, pass, entityType, prefix, gone, budget) {
280
+ function retire(db, pass, entityType, prefix, gone, after, room, clean) {
172
281
  if (gone.length === 0)
173
- return 0;
282
+ return NOTHING_TO_WALK;
174
283
  const [shapeRef, scopeRef] = recordRefs(entityType, pass.scopeId);
175
284
  const finished = new Set(db.all(`SELECT substr(relation, ${RETIRED_RELATION.length + 1}) AS key FROM _substrat_tuples
176
285
  WHERE subject = ? AND object = ? AND revoked_at IS NULL
177
286
  AND relation IN (SELECT '${RETIRED_RELATION}' || value FROM json_each(?))`, shapeRef, scopeRef, JSON.stringify(gone)).map((r) => r.key));
178
287
  const open = gone.filter((k) => !finished.has(k));
179
288
  if (open.length === 0)
180
- return 0;
289
+ return NOTHING_TO_WALK;
181
290
  const json = JSON.stringify(open);
182
- const holders = db.all(`SELECT m.subject, m.object FROM _substrat_tuples m
183
- WHERE m.relation = ? AND ${liveTupleSql('m')}
184
- AND substr(m.subject, 1, ${PRINCIPAL.length}) = '${PRINCIPAL}'
185
- AND substr(m.object, 1, ?) = ?
186
- AND EXISTS (SELECT 1 FROM _substrat_tuples t
187
- WHERE t.subject = m.subject AND t.object = m.object AND t.revoked_at IS NULL
188
- AND t.relation IN (SELECT 'granted:' || value FROM json_each(?)))
189
- ORDER BY m.subject, m.object
190
- LIMIT ?`, ENTITY_SHAPE_MARKER_RELATION, pass.now, prefix.length, prefix, json, budget);
191
- for (const h of holders) {
291
+ const walk = walkMarkers(db, pass.now, prefix, after, room, `EXISTS (SELECT 1 FROM _substrat_tuples t
292
+ WHERE t.subject = m.subject AND t.object = m.object AND t.revoked_at IS NULL
293
+ AND t.relation IN (SELECT 'granted:' || value FROM json_each(?)))`, json);
294
+ for (const h of walk.found) {
192
295
  // Tombstoned and read back in one statement: the keys this holder lost are what it touched.
193
296
  const removed = keysOf(db.all(`UPDATE _substrat_tuples SET revoked_at = ?
194
297
  WHERE subject = ? AND object = ? AND revoked_at IS NULL
@@ -201,12 +304,12 @@ function retire(db, pass, entityType, prefix, gone, budget) {
201
304
  }), pass.version);
202
305
  db.run(st.sql, ...st.params);
203
306
  }
204
- if (holders.length < budget) {
307
+ if (walk.done && clean && walk.found.length === 0) {
205
308
  for (const k of open) {
206
309
  db.run('INSERT OR REPLACE INTO _substrat_tuples (subject, relation, object) VALUES (?, ?, ?)', shapeRef, `${RETIRED_RELATION}${k}`, scopeRef);
207
310
  }
208
311
  }
209
- return holders.length;
312
+ return walk;
210
313
  }
211
314
  /**
212
315
  * A key back in the shape ends its retirement's record (tombstoned, like any tuple), so a later
@@ -240,25 +343,25 @@ function backfill(db, pass, shape, prefix, json, budget) {
240
343
  if (shape.holder === 'self') {
241
344
  // The entity id IS the principal: `owner:<p>` belongs to `principal:<p>` and nobody else.
242
345
  candidates = db.all(`SELECT DISTINCT t.subject, t.object FROM _substrat_tuples t
243
- WHERE substr(t.object, 1, ?) = ?
346
+ WHERE t.object >= ? AND t.object < ?
244
347
  AND t.subject = '${PRINCIPAL}' || substr(t.object, ?)
245
348
  AND t.relation IN (SELECT 'granted:' || value FROM json_each(?))
246
349
  AND ${unmarked('t.subject', 't.object')}
247
350
  ORDER BY t.subject, t.object
248
- LIMIT ?`, prefix.length, prefix, prefix.length + 1, json, budget);
351
+ LIMIT ?`, ...typeRange(prefix), prefix.length + 1, json, budget);
249
352
  }
250
353
  else if (shape.holder === 'grantee') {
251
354
  // Whoever holds a LIVE key of the shape on an entity of this type. Live, unlike the other two
252
355
  // holders: with no record naming the person, a key taken back from them is no evidence they
253
356
  // still belong there, and marking them would hand a revoked portal the next key it gains.
254
357
  candidates = db.all(`SELECT DISTINCT t.subject, t.object FROM _substrat_tuples t
255
- WHERE substr(t.object, 1, ?) = ?
358
+ WHERE t.object >= ? AND t.object < ?
256
359
  AND substr(t.subject, 1, ${PRINCIPAL.length}) = '${PRINCIPAL}'
257
360
  AND t.relation IN (SELECT 'granted:' || value FROM json_each(?))
258
361
  AND ${liveTupleSql('t')}
259
362
  AND ${unmarked('t.subject', 't.object')}
260
363
  ORDER BY t.subject, t.object
261
- LIMIT ?`, prefix.length, prefix, json, pass.now, budget);
364
+ LIMIT ?`, ...typeRange(prefix), json, pass.now, budget);
262
365
  }
263
366
  else {
264
367
  const { table, idColumn, principalColumn } = shape.holder;
@@ -1 +1 @@
1
- {"version":3,"file":"entity-grant-shape.js","sourceRoot":"","sources":["../src/entity-grant-shape.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,4BAA4B,EAC5B,WAAW,EACX,0BAA0B,EAC1B,2BAA2B,EAC3B,eAAe,EACf,OAAO,GAKR,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EA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C;AAED;;;GAGG;AACH,SAAS,UAAU,CACjB,IAAe,EACf,IAAmE,EACnE,MAAoC,EACpC,OAAU;IAEV,OAAO,WAAW,CAAC,KAAK,CAAC;QACvB,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACzD,IAAI;QACJ,aAAa,EAAE,CAAC;QAChB,UAAU,EAAE,IAAI,CAAC,GAAG;QACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,KAAK,EAAE,YAAY;QACnB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,QAAQ,EAAE,MAAM;QAChB,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;KAC/B,CAAC,CAAC;AACL,CAAC"}
@@ -31,11 +31,6 @@ export declare function explicitTupleSql(subject: string, relation: string, obje
31
31
  sql: string;
32
32
  params: Params;
33
33
  };
34
- /** `ctx.grant`'s write — {@link explicitTupleSql} on a `granted:` relation. */
35
- export declare function delegatedGrantSql(principal: string, permission: string, object: string): {
36
- sql: string;
37
- params: Params;
38
- };
39
34
  /** Tombstone a live grant. A repeat revoke, or a revoke of a grant never made, changes nothing. */
40
35
  export declare function delegatedRevokeSql(principal: string, permission: string, object: string, at: string): {
41
36
  sql: string;
@@ -1 +1 @@
1
- {"version":3,"file":"entity-grant.d.ts","sourceRoot":"","sources":["../src/entity-grant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,KAAK,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEvC,qFAAqF;AACrF,eAAO,MAAM,oBAAoB,sBAAsB,CAAC;AAgBxD,mGAAmG;AACnG,wBAAgB,oBAAoB,CAClC,EAAE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,EACf,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GAC1E,IAAI,CAcN;AAQD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAOnH;AAED,mGAAmG;AACnG,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM,GACT;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAA;CAAE,CAM9C"}
@@ -56,10 +56,6 @@ export function explicitTupleSql(subject, relation, object) {
56
56
  params: [subject, relation, object],
57
57
  };
58
58
  }
59
- /** `ctx.grant`'s write — {@link explicitTupleSql} on a `granted:` relation. */
60
- export function delegatedGrantSql(principal, permission, object) {
61
- return explicitTupleSql(...refs(principal, permission, object));
62
- }
63
59
  /** Tombstone a live grant. A repeat revoke, or a revoke of a grant never made, changes nothing. */
64
60
  export function delegatedRevokeSql(principal, permission, object, at) {
65
61
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"entity-grant.js","sourceRoot":"","sources":["../src/entity-grant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,qFAAqF;AACrF,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AAExD,mGAAmG;AACnG,SAAS,oBAAoB,CAAC,EAAa,EAAE,QAAgB,EAAE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U,kBAAkB,CAChC,SAAiB,EACjB,UAAkB,EAClB,MAAc,EACd,EAAU;IAEV,OAAO;QACL,GAAG,EAAE;oFAC2E;QAChF,MAAM,EAAE,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;KACrD,CAAC;AACJ,CAAC"}
@@ -87,11 +87,6 @@ export declare const purgeIndexVersion: (plan: EntityStatePlan) => string;
87
87
  * namespace. Empty for a plan without a purge horizon.
88
88
  */
89
89
  export declare function purgeIndexObjects(plan: EntityStatePlan): DerivedObject[];
90
- /**
91
- * The purge index's DDL. `IF NOT EXISTS` because a dump load runs it again after the rows are
92
- * in; a repair that finds it wrong drops it first (`purgeIndexRepairDdl`).
93
- */
94
- export declare function purgeIndexDdl(plan: EntityStatePlan): string;
95
90
  /** Drop-then-create, for a purge index the catalogue holds under its name but not as emitted. */
96
91
  export declare function purgeIndexRepairDdl(plan: EntityStatePlan): string;
97
92
  /**
@@ -101,18 +96,6 @@ export declare function purgeIndexRepairDdl(plan: EntityStatePlan): string;
101
96
  export declare const entityStateGuardVersion: (plan: EntityStatePlan) => string;
102
97
  /** The prefix of every trigger this module derives — kernel-owned, so the reserved one. */
103
98
  export declare const ENTITY_STATE_TRIGGER_PREFIX = "_substrat_state_";
104
- /**
105
- * The kernel's authorization for ONE move (#119, Codex r2): the row `ctx.archive` & co. write
106
- * just before their `UPDATE` and delete just after it, in the same transaction. The update
107
- * trigger below refuses any change to the columns that has no such row — so the only writer the
108
- * columns admit is the one that can write a `_substrat_*` TABLE, which `ctx.sql` refuses by name
109
- * (a far simpler reading than finding an assignment target in an expression).
110
- *
111
- * Never holds a row between operations: written and removed inside one move, and a move that
112
- * throws rolls back with its operation. Shared by both adapters' `KERNEL_DDL`, like the other
113
- * kernel-owned spine tables, so the two cannot part company.
114
- */
115
- export declare const ENTITY_STATE_MOVES_TABLE = "_substrat_state_moves";
116
99
  export declare const ENTITY_STATE_MOVES_DDL = "\n CREATE TABLE IF NOT EXISTS _substrat_state_moves (\n entity_type TEXT NOT NULL,\n entity_id TEXT NOT NULL,\n PRIMARY KEY (entity_type, entity_id)\n );\n";
117
100
  /**
118
101
  * The invariant below the column guard, as two triggers on the entity's table.