@jam-overture/loom 0.1.0 → 0.2.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 (290) hide show
  1. package/README.md +3 -1
  2. package/dist/application/application.d.ts +109 -0
  3. package/dist/application/application.js +97 -0
  4. package/dist/application/memory.d.ts +20 -0
  5. package/dist/application/memory.js +79 -0
  6. package/dist/application/store.d.ts +101 -0
  7. package/dist/application/store.js +25 -0
  8. package/dist/audience/audience.d.ts +36 -0
  9. package/dist/audience/audience.js +41 -0
  10. package/dist/cli/templates.js +19 -0
  11. package/dist/data/plan.js +0 -0
  12. package/dist/data/resolution.d.ts +23 -1
  13. package/dist/data/resolve.d.ts +30 -3
  14. package/dist/data/resolve.js +11 -3
  15. package/dist/ids.d.ts +10 -0
  16. package/dist/ids.js +11 -1
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.js +1 -0
  19. package/dist/patch.d.ts +54 -0
  20. package/dist/patch.js +44 -0
  21. package/dist/project/closing.d.ts +51 -0
  22. package/dist/project/closing.js +53 -0
  23. package/dist/project/memory.d.ts +20 -0
  24. package/dist/project/memory.js +97 -0
  25. package/dist/project/project.d.ts +90 -0
  26. package/dist/project/project.js +91 -0
  27. package/dist/project/store.d.ts +135 -0
  28. package/dist/project/store.js +41 -0
  29. package/dist/registered.d.ts +64 -0
  30. package/dist/registered.js +118 -0
  31. package/dist/render/behaviour-adjust.d.ts +11 -19
  32. package/dist/render/behaviour-adjust.js +75 -21
  33. package/dist/render/behaviour-present.d.ts +8 -0
  34. package/dist/render/behaviour-present.js +57 -6
  35. package/dist/render/behaviour.d.ts +98 -17
  36. package/dist/render/behaviour.js +91 -26
  37. package/dist/render/control-name.d.ts +68 -0
  38. package/dist/render/control-name.js +37 -0
  39. package/dist/render/diagnostics.d.ts +72 -0
  40. package/dist/render/diagnostics.js +7 -0
  41. package/dist/render/index.d.ts +2 -0
  42. package/dist/render/index.js +2 -0
  43. package/dist/render/reads.d.ts +11 -0
  44. package/dist/render/reads.js +12 -1
  45. package/dist/render/render.js +102 -7
  46. package/dist/render/slots.d.ts +52 -0
  47. package/dist/render/slots.js +24 -0
  48. package/dist/render/theme.d.ts +54 -1
  49. package/dist/render/theme.js +23 -1
  50. package/dist/render/unshown.d.ts +152 -0
  51. package/dist/render/unshown.js +80 -0
  52. package/dist/runtime/analysis.d.ts +94 -9
  53. package/dist/runtime/analysis.js +54 -9
  54. package/dist/runtime/assessment.d.ts +36 -2
  55. package/dist/runtime/assessment.js +27 -2
  56. package/dist/runtime/checks.d.ts +148 -0
  57. package/dist/runtime/checks.js +112 -0
  58. package/dist/runtime/disposition.d.ts +96 -0
  59. package/dist/runtime/disposition.js +46 -0
  60. package/dist/runtime/gate.js +22 -0
  61. package/dist/runtime/index.d.ts +3 -0
  62. package/dist/runtime/index.js +3 -0
  63. package/dist/runtime/irreversibility.d.ts +64 -0
  64. package/dist/runtime/irreversibility.js +45 -0
  65. package/dist/runtime/pipeline.d.ts +43 -0
  66. package/dist/runtime/pipeline.js +10 -2
  67. package/dist/runtime/policy-change.d.ts +93 -0
  68. package/dist/runtime/policy-change.js +299 -0
  69. package/dist/runtime/policy-log.d.ts +406 -0
  70. package/dist/runtime/policy-log.js +285 -0
  71. package/dist/runtime/reversibility.d.ts +11 -9
  72. package/dist/runtime/stakes.d.ts +129 -1
  73. package/dist/runtime/stakes.js +240 -26
  74. package/dist/runtime/vocabulary.d.ts +164 -7
  75. package/dist/runtime/vocabulary.js +181 -8
  76. package/dist/sdk/audit.d.ts +174 -3
  77. package/dist/sdk/audit.js +176 -17
  78. package/dist/sdk/catalogue.d.ts +9 -1
  79. package/dist/sdk/conformance.d.ts +37 -3
  80. package/dist/sdk/conformance.js +25 -4
  81. package/dist/sdk/definition.d.ts +65 -0
  82. package/dist/sdk/definition.js +22 -0
  83. package/dist/sdk/registry.d.ts +29 -2
  84. package/dist/sdk/registry.js +63 -1
  85. package/dist/signals/action-change.d.ts +507 -0
  86. package/dist/signals/action-change.js +265 -0
  87. package/dist/signals/action.d.ts +331 -0
  88. package/dist/signals/action.js +182 -0
  89. package/dist/signals/applied-window.contract.d.ts +23 -0
  90. package/dist/signals/applied-window.contract.js +160 -0
  91. package/dist/signals/arriving.d.ts +210 -0
  92. package/dist/signals/arriving.js +133 -0
  93. package/dist/signals/audiences.d.ts +528 -0
  94. package/dist/signals/audiences.js +255 -0
  95. package/dist/signals/broadcast.d.ts +8 -2
  96. package/dist/signals/broadcast.js +58 -8
  97. package/dist/signals/change.d.ts +378 -0
  98. package/dist/signals/change.js +327 -0
  99. package/dist/signals/collect.d.ts +41 -0
  100. package/dist/signals/collect.js +88 -7
  101. package/dist/signals/copy-change.d.ts +553 -0
  102. package/dist/signals/copy-change.js +377 -0
  103. package/dist/signals/copy.d.ts +337 -0
  104. package/dist/signals/copy.js +211 -0
  105. package/dist/signals/counters.d.ts +46 -0
  106. package/dist/signals/counters.js +102 -0
  107. package/dist/signals/deliver.d.ts +23 -4
  108. package/dist/signals/deliver.js +34 -6
  109. package/dist/signals/deployment-change.d.ts +371 -0
  110. package/dist/signals/deployment-change.js +268 -0
  111. package/dist/signals/deployment.d.ts +265 -0
  112. package/dist/signals/deployment.js +152 -0
  113. package/dist/signals/door.d.ts +92 -0
  114. package/dist/signals/door.js +53 -0
  115. package/dist/signals/fold.d.ts +10 -0
  116. package/dist/signals/fold.js +5 -1
  117. package/dist/signals/form-action.d.ts +302 -0
  118. package/dist/signals/form-action.js +169 -0
  119. package/dist/signals/form-copy.d.ts +523 -0
  120. package/dist/signals/form-copy.js +346 -0
  121. package/dist/signals/forms.d.ts +247 -0
  122. package/dist/signals/forms.js +147 -0
  123. package/dist/signals/funnel-change.d.ts +548 -0
  124. package/dist/signals/funnel-change.js +361 -0
  125. package/dist/signals/funnel.d.ts +532 -0
  126. package/dist/signals/funnel.js +216 -0
  127. package/dist/signals/health.d.ts +497 -0
  128. package/dist/signals/health.js +361 -0
  129. package/dist/signals/index.d.ts +41 -0
  130. package/dist/signals/index.js +41 -0
  131. package/dist/signals/ingest.d.ts +56 -1
  132. package/dist/signals/ingest.js +91 -1
  133. package/dist/signals/journal.d.ts +11 -0
  134. package/dist/signals/kinds.d.ts +8 -6
  135. package/dist/signals/kinds.js +14 -6
  136. package/dist/signals/library-action.d.ts +430 -0
  137. package/dist/signals/library-action.js +336 -0
  138. package/dist/signals/library-change.d.ts +477 -0
  139. package/dist/signals/library-change.js +335 -0
  140. package/dist/signals/library-copy-change.d.ts +498 -0
  141. package/dist/signals/library-copy-change.js +476 -0
  142. package/dist/signals/library-pace.d.ts +319 -0
  143. package/dist/signals/library-pace.js +305 -0
  144. package/dist/signals/library-reach-change.d.ts +636 -0
  145. package/dist/signals/library-reach-change.js +534 -0
  146. package/dist/signals/library-reach.d.ts +377 -0
  147. package/dist/signals/library-reach.js +227 -0
  148. package/dist/signals/library-word-reach-change.d.ts +567 -0
  149. package/dist/signals/library-word-reach-change.js +568 -0
  150. package/dist/signals/library.d.ts +306 -0
  151. package/dist/signals/library.js +178 -0
  152. package/dist/signals/memory.d.ts +9 -0
  153. package/dist/signals/memory.js +105 -14
  154. package/dist/signals/migrate.d.ts +17 -2
  155. package/dist/signals/migrate.js +122 -5
  156. package/dist/signals/notice.d.ts +334 -0
  157. package/dist/signals/notice.js +228 -0
  158. package/dist/signals/pace-change.d.ts +501 -0
  159. package/dist/signals/pace-change.js +310 -0
  160. package/dist/signals/pace.d.ts +296 -0
  161. package/dist/signals/pace.js +291 -0
  162. package/dist/signals/page-views.d.ts +365 -0
  163. package/dist/signals/page-views.js +218 -0
  164. package/dist/signals/parts.d.ts +344 -0
  165. package/dist/signals/parts.js +273 -0
  166. package/dist/signals/postgres.d.ts +16 -2
  167. package/dist/signals/postgres.js +390 -87
  168. package/dist/signals/progress.d.ts +212 -0
  169. package/dist/signals/progress.js +150 -0
  170. package/dist/signals/ratios.d.ts +108 -0
  171. package/dist/signals/ratios.js +40 -0
  172. package/dist/signals/reach.d.ts +309 -0
  173. package/dist/signals/reach.js +93 -0
  174. package/dist/signals/readable.d.ts +34 -0
  175. package/dist/signals/readable.js +34 -0
  176. package/dist/signals/readership.d.ts +381 -0
  177. package/dist/signals/readership.js +308 -0
  178. package/dist/signals/region-pages.d.ts +173 -0
  179. package/dist/signals/region-pages.js +62 -0
  180. package/dist/signals/region.d.ts +287 -0
  181. package/dist/signals/region.js +198 -0
  182. package/dist/signals/retention.d.ts +141 -0
  183. package/dist/signals/retention.js +58 -0
  184. package/dist/signals/rollup.d.ts +67 -3
  185. package/dist/signals/rollup.js +0 -0
  186. package/dist/signals/schema.d.ts +432 -1
  187. package/dist/signals/schema.js +157 -3
  188. package/dist/signals/signal.d.ts +237 -11
  189. package/dist/signals/signal.js +70 -10
  190. package/dist/signals/silence-census.d.ts +205 -0
  191. package/dist/signals/silence-census.js +87 -0
  192. package/dist/signals/silences.d.ts +848 -0
  193. package/dist/signals/silences.js +753 -0
  194. package/dist/signals/tally.d.ts +140 -11
  195. package/dist/signals/window-figures.d.ts +148 -0
  196. package/dist/signals/window-figures.js +42 -0
  197. package/dist/signals/window.d.ts +866 -0
  198. package/dist/signals/window.js +693 -0
  199. package/dist/signals/words.d.ts +24 -0
  200. package/dist/signals/words.js +24 -0
  201. package/dist/store/index.d.ts +19 -0
  202. package/dist/store/index.js +19 -0
  203. package/dist/store/memory.d.ts +2 -1
  204. package/dist/store/memory.js +48 -12
  205. package/dist/store/migrate.d.ts +80 -0
  206. package/dist/store/migrate.js +259 -7
  207. package/dist/store/postgres-applications.d.ts +4 -0
  208. package/dist/store/postgres-applications.js +197 -0
  209. package/dist/store/postgres-holds.d.ts +10 -1
  210. package/dist/store/postgres-holds.js +116 -101
  211. package/dist/store/postgres-policy-log.d.ts +14 -0
  212. package/dist/store/postgres-policy-log.js +240 -0
  213. package/dist/store/postgres-projects.d.ts +4 -0
  214. package/dist/store/postgres-projects.js +217 -0
  215. package/dist/store/postgres.d.ts +16 -1
  216. package/dist/store/postgres.js +59 -9
  217. package/dist/store/replay.d.ts +102 -1
  218. package/dist/store/replay.js +190 -19
  219. package/dist/store/reseed.d.ts +238 -0
  220. package/dist/store/reseed.js +308 -0
  221. package/dist/store/schema.d.ts +450 -2
  222. package/dist/store/schema.js +141 -5
  223. package/dist/store/store.d.ts +29 -6
  224. package/dist/submit/resolve.js +2 -1
  225. package/dist/telemetry/calibration.d.ts +25 -0
  226. package/dist/telemetry/calibration.js +27 -1
  227. package/dist/telemetry/event.d.ts +391 -33
  228. package/dist/telemetry/event.js +84 -20
  229. package/dist/telemetry/index.d.ts +1 -0
  230. package/dist/telemetry/index.js +1 -0
  231. package/dist/telemetry/journal.d.ts +72 -3
  232. package/dist/telemetry/journal.js +9 -0
  233. package/dist/telemetry/lookup.d.ts +27 -0
  234. package/dist/telemetry/lookup.js +18 -0
  235. package/dist/telemetry/memory.js +23 -0
  236. package/dist/telemetry/migrate.js +22 -1
  237. package/dist/telemetry/postgres.d.ts +10 -1
  238. package/dist/telemetry/postgres.js +172 -90
  239. package/dist/telemetry/remeasure.d.ts +78 -0
  240. package/dist/telemetry/remeasure.js +83 -0
  241. package/dist/telemetry/retention.d.ts +2 -2
  242. package/dist/telemetry/schema.d.ts +17 -0
  243. package/dist/telemetry/schema.js +27 -1
  244. package/dist/telemetry/sink.d.ts +2 -2
  245. package/dist/testing/application-contract.d.ts +14 -0
  246. package/dist/testing/application-contract.js +270 -0
  247. package/dist/testing/contracts.d.ts +12 -7
  248. package/dist/testing/contracts.js +12 -7
  249. package/dist/testing/definitions.d.ts +78 -0
  250. package/dist/testing/definitions.js +134 -9
  251. package/dist/testing/doubles.d.ts +103 -0
  252. package/dist/testing/doubles.js +143 -0
  253. package/dist/testing/index.d.ts +2 -2
  254. package/dist/testing/index.js +2 -2
  255. package/dist/testing/journal-contract.js +140 -2
  256. package/dist/testing/model-contract.d.ts +110 -0
  257. package/dist/testing/model-contract.js +150 -0
  258. package/dist/testing/policy-log-contract.d.ts +26 -0
  259. package/dist/testing/policy-log-contract.js +344 -0
  260. package/dist/testing/project-contract.d.ts +14 -0
  261. package/dist/testing/project-contract.js +266 -0
  262. package/dist/testing/reader-signal-contract.d.ts +27 -2
  263. package/dist/testing/reader-signal-contract.js +475 -5
  264. package/dist/testing/store-contract.d.ts +7 -1
  265. package/dist/testing/store-contract.js +84 -3
  266. package/dist/theme/apply.d.ts +20 -1
  267. package/dist/theme/apply.js +5 -3
  268. package/dist/theme/derive.d.ts +22 -0
  269. package/dist/theme/derive.js +54 -1
  270. package/dist/theme/library.js +1 -1
  271. package/dist/theme/measure.d.ts +34 -0
  272. package/dist/theme/measure.js +30 -1
  273. package/dist/theme/palettes.js +7 -7
  274. package/dist/theme/ramp.d.ts +64 -0
  275. package/dist/theme/ramp.js +114 -0
  276. package/dist/theme/registry.d.ts +9 -0
  277. package/dist/theme/registry.js +11 -1
  278. package/dist/theme/separation.d.ts +97 -3
  279. package/dist/theme/separation.js +75 -0
  280. package/dist/tree/compare.d.ts +9 -0
  281. package/dist/tree/compare.js +18 -0
  282. package/dist/write/computed.d.ts +60 -0
  283. package/dist/write/computed.js +61 -0
  284. package/dist/write/held.d.ts +59 -0
  285. package/dist/write/index.d.ts +5 -2
  286. package/dist/write/index.js +5 -2
  287. package/dist/write/reseed.d.ts +151 -0
  288. package/dist/write/reseed.js +184 -0
  289. package/dist/write/revert.js +2 -16
  290. package/package.json +98 -19
@@ -1,5 +1,7 @@
1
1
  import type { NodeId } from "../ids.js";
2
2
  import type { PrimitiveType } from "../primitive-type.js";
3
+ import type { BindingReader } from "../render/reads.js";
4
+ import type { SlotPlacer } from "../render/slots.js";
3
5
  import { type Result } from "../result.js";
4
6
  import type { TreeDelta } from "../tree/delta.js";
5
7
  import type { TreeError } from "../tree/errors.js";
@@ -7,7 +9,7 @@ import type { LoomTree } from "../tree/tree.js";
7
9
  import { type InteractivePredicate, type NestedTarget } from "./nesting.js";
8
10
  import { type RedirectedSubmission } from "./redirection.js";
9
11
  import { type RepointedBinding } from "./repointing.js";
10
- import { type InvalidProps, type PrimitiveVocabulary, type PropsVocabulary, type UnknownPrimitive } from "./vocabulary.js";
12
+ import { type InvalidProps, type PrimitiveVocabulary, type PropsVocabulary, type UnknownPrimitive, type UnplacedSlot, type UnreadBinding } from "./vocabulary.js";
11
13
  /**
12
14
  * Facts about what a delta does, extracted before anyone judges it.
13
15
  *
@@ -105,6 +107,55 @@ export type ChangeAnalysis = {
105
107
  * Empty for every host that wires no props vocabulary, which is the default.
106
108
  */
107
109
  readonly invalidProps: readonly InvalidProps[];
110
+ /**
111
+ * Questions this change would leave on the page that no primitive will look
112
+ * at — a node asking under a name its own primitive says it does not read.
113
+ *
114
+ * The one fact in this record about a change that *works*. The page draws,
115
+ * every node is registered, every schema is satisfied; the host pays a round
116
+ * trip to its own source on every render and the region shows its empty state,
117
+ * because the answer arrives under a name nobody opens (0181).
118
+ *
119
+ * Measured on both trees, like `invalidProps` and unlike `unknownPrimitives`,
120
+ * and for that factor's reason twice over: a `configure` can put `loom:data` on
121
+ * a node that had none, and a `configure` can rename the *prop* that names the
122
+ * binding (0184), so two operations in one delta can argue about it and only
123
+ * the tree at the end says what a reader will be served.
124
+ *
125
+ * Keyed by node **and name** where `invalidProps` is keyed by node alone, and
126
+ * the difference is the harm rather than an oversight. A node whose props fail
127
+ * is a hole, and a page has one hole there however many ways it is wrong; a
128
+ * node asking three questions nothing reads is three wasted round trips, and a
129
+ * change that adds the third is answerable for the third.
130
+ *
131
+ * Empty for every host that hands no reader, which is the default.
132
+ */
133
+ readonly unreadBindings: readonly UnreadBinding[];
134
+ /**
135
+ * Content this change would put in a region of a primitive that places no
136
+ * region of that name, so the content and everything under it is dropped.
137
+ *
138
+ * The second fact in this record about a change that *works*, beside
139
+ * `unreadBindings` and quieter than it. The page draws, every node is
140
+ * registered, every schema is satisfied, nothing is fetched and wasted — and
141
+ * a paragraph the author wrote is not on the page, with nothing anywhere
142
+ * saying so until the render seam gained a diagnostic for it (0249).
143
+ *
144
+ * Measured on both trees, like `unreadBindings` and unlike
145
+ * `unknownPrimitives`, and for the reason that factor's comment gives twice
146
+ * over. A `move` can carry a slot child under a new parent that places no
147
+ * such region, which is the case `unknownPrimitives` has no analogue of: a
148
+ * type cannot be changed, and a region's fate depends on the parent it ends
149
+ * up under rather than on the node itself.
150
+ *
151
+ * Keyed by node **and name** where `invalidProps` is keyed by node alone, for
152
+ * `unreadBindings`' reason: a node that drops two regions has dropped two
153
+ * pieces of content, and a change that adds the second is answerable for the
154
+ * second.
155
+ *
156
+ * Empty for every host that hands no placer, which is the default.
157
+ */
158
+ readonly unplacedSlots: readonly UnplacedSlot[];
108
159
  /**
109
160
  * Forms this change points somewhere else — a node that posted to one
110
161
  * registered endpoint before and posts to another after.
@@ -132,18 +183,52 @@ export type ChangeAnalysis = {
132
183
  */
133
184
  readonly shallowestAffectedDepth: number;
134
185
  };
186
+ /**
187
+ * What a host's primitives are, in the five senses the write path can ask about.
188
+ *
189
+ * Every member is optional and every default is the no-op a deployment that has
190
+ * wired nothing already got, so `analyzeDelta(tree, delta)` measures exactly
191
+ * what it measured before this record existed.
192
+ *
193
+ * **A record rather than trailing parameters, which is a change of shape and
194
+ * not of behaviour.** Until 0252 these were four positional optionals, and the
195
+ * function's own comment had predicted each of the last three arriving to find
196
+ * the shape at its limit. The argument for leaving them positional was that
197
+ * collecting them is a breaking change to a published function; the argument
198
+ * that won is `StakeInput`'s, one module over — *an input that can be left off
199
+ * the end is one that will be* — and a fifth made the order something no caller
200
+ * could hold in their head. There is no middle shape: four positional optionals
201
+ * and a record of the fifth would be the worst of both.
202
+ *
203
+ * The names are the parameters' own, so a caller that passed them positionally
204
+ * reaches the same answers by writing down which one it meant.
205
+ *
206
+ * `| undefined` on each member rather than optionality alone, for
207
+ * `WriteCheckSeams`' reason: a caller holding an `X | undefined` at an optional
208
+ * seam is the ordinary case — `assessChange` is one — and making it rebuild the
209
+ * record to say so would put the presence test in two places.
210
+ */
211
+ export type ChangeVocabulary = {
212
+ /** Which primitives render a target, so a target inside one is reachable (0068). */
213
+ readonly isInteractive?: InteractivePredicate | undefined;
214
+ /** Which primitive types this deployment can draw at all (0173). */
215
+ readonly isRegistered?: PrimitiveVocabulary | undefined;
216
+ /** What each primitive accepts, as its own schema's verdict (0179). */
217
+ readonly checkProps?: PropsVocabulary | undefined;
218
+ /** What each primitive reads an answer under (0208). */
219
+ readonly reads?: BindingReader | undefined;
220
+ /** What each primitive places a named region for (0252). */
221
+ readonly places?: SlotPlacer | undefined;
222
+ };
135
223
  /**
136
224
  * Walks the delta forward so each operation is measured against the tree it
137
225
  * actually observes — an operation may target a node an earlier operation in
138
226
  * the same delta inserted.
139
227
  *
140
- * The three vocabularies are separate trailing parameters rather than one
141
- * record, which is not the shape `StakeInput` argues for. This function is
142
- * published and a lesson calls it by hand, so collecting them would be a
143
- * breaking change to teach nothing, and a third one arriving is the second time
144
- * that has been true; what keeps them from being forgotten is that
145
- * `assessChange` is the only caller that assembles them, and it passes all
146
- * three in one expression.
228
+ * The vocabularies arrive as one optional record (`ChangeVocabulary`, above).
229
+ * What keeps any of them from being forgotten is unchanged by that: `assessChange`
230
+ * is still the only caller that assembles them, and it still does it in one
231
+ * expression.
147
232
  */
148
- export declare const analyzeDelta: (tree: LoomTree, delta: TreeDelta, isInteractive?: InteractivePredicate, isRegistered?: PrimitiveVocabulary, checkProps?: PropsVocabulary) => Result<ChangeAnalysis, TreeError>;
233
+ export declare const analyzeDelta: (tree: LoomTree, delta: TreeDelta, vocabulary?: ChangeVocabulary) => Result<ChangeAnalysis, TreeError>;
149
234
  //# sourceMappingURL=analysis.d.ts.map
@@ -4,7 +4,7 @@ import { findNode, pathToNode, walkTree } from "../tree/navigation.js";
4
4
  import { nestedTargetsIn, NOTHING_INTERACTIVE, } from "./nesting.js";
5
5
  import { redirectedSubmissionsBetween } from "./redirection.js";
6
6
  import { repointedBindingsBetween } from "./repointing.js";
7
- import { EVERY_TYPE_REGISTERED, EVERY_TYPE_UNDECLARED, invalidPropsIn, unknownPrimitivesIn, } from "./vocabulary.js";
7
+ import { EVERY_TYPE_REGISTERED, EVERY_TYPE_UNDECLARED, invalidPropsIn, NOTHING_DECLARED, NOTHING_PLACED, unknownPrimitivesIn, unplacedSlotsIn, unreadBindingsIn, } from "./vocabulary.js";
8
8
  const elementTypesIn = (node) => Array.from(walkTree(node)).flatMap((current) => current.kind === "element" ? [current.type] : []);
9
9
  const nodeCount = (node) => Array.from(walkTree(node)).length;
10
10
  const depthOf = (root, nodeId) => {
@@ -139,20 +139,63 @@ const introducedInvalidProps = (before, after, checkProps) => {
139
139
  const inherited = new Set(invalidPropsIn(before, checkProps).map((invalid) => invalid.nodeId));
140
140
  return produced.filter((invalid) => !inherited.has(invalid.nodeId));
141
141
  };
142
+ /** Node and name together; a name is only unique within the node that asks it. */
143
+ const unreadKey = (unread) => `${unread.nodeId} ${unread.name}`;
144
+ /**
145
+ * The wasted questions this delta is answerable for: the ones unread in the tree
146
+ * it produces, less the ones already unread in the tree it started from.
147
+ *
148
+ * Keyed on both halves, unlike `introducedInvalidProps` and for the reason the
149
+ * field's own comment gives: two unread names on one node are two round trips,
150
+ * so a change that adds the second inherits the first and answers for the
151
+ * second. `questionsIn` in `repointing.ts` keys the same pair the same way, and
152
+ * for the same reason — a name means nothing without the node asking it.
153
+ *
154
+ * The before-walk is skipped when the result has none, which is the ordinary
155
+ * case and — with `NOTHING_DECLARED` — the only case on a deployment that has
156
+ * handed no reader.
157
+ */
158
+ const introducedUnreadBindings = (before, after, reads) => {
159
+ const produced = unreadBindingsIn(after, reads);
160
+ if (produced.length === 0)
161
+ return produced;
162
+ const inherited = new Set(unreadBindingsIn(before, reads).map(unreadKey));
163
+ return produced.filter((unread) => !inherited.has(unreadKey(unread)));
164
+ };
165
+ /** Node and name together, for the reason `unreadKey` gives one module over. */
166
+ const unplacedKey = (unplaced) => `${unplaced.nodeId} ${unplaced.name}`;
167
+ /**
168
+ * The dropped content this delta is answerable for: the regions unplaced in the
169
+ * tree it produces, less the ones already unplaced in the tree it started from.
170
+ *
171
+ * Keyed on both halves, like `introducedUnreadBindings` and unlike
172
+ * `introducedInvalidProps`: a node filling two regions nothing places loses two
173
+ * pieces of content, so a change that adds the second inherits the first and
174
+ * answers for the second.
175
+ *
176
+ * The before-walk is skipped when the result has none, which is the ordinary
177
+ * case and — with `NOTHING_PLACED` — the only case on a deployment that has
178
+ * handed no placer.
179
+ */
180
+ const introducedUnplacedSlots = (before, after, places) => {
181
+ const produced = unplacedSlotsIn(after, places);
182
+ if (produced.length === 0)
183
+ return produced;
184
+ const inherited = new Set(unplacedSlotsIn(before, places).map(unplacedKey));
185
+ return produced.filter((unplaced) => !inherited.has(unplacedKey(unplaced)));
186
+ };
142
187
  /**
143
188
  * Walks the delta forward so each operation is measured against the tree it
144
189
  * actually observes — an operation may target a node an earlier operation in
145
190
  * the same delta inserted.
146
191
  *
147
- * The three vocabularies are separate trailing parameters rather than one
148
- * record, which is not the shape `StakeInput` argues for. This function is
149
- * published and a lesson calls it by hand, so collecting them would be a
150
- * breaking change to teach nothing, and a third one arriving is the second time
151
- * that has been true; what keeps them from being forgotten is that
152
- * `assessChange` is the only caller that assembles them, and it passes all
153
- * three in one expression.
192
+ * The vocabularies arrive as one optional record (`ChangeVocabulary`, above).
193
+ * What keeps any of them from being forgotten is unchanged by that: `assessChange`
194
+ * is still the only caller that assembles them, and it still does it in one
195
+ * expression.
154
196
  */
155
- export const analyzeDelta = (tree, delta, isInteractive = NOTHING_INTERACTIVE, isRegistered = EVERY_TYPE_REGISTERED, checkProps = EVERY_TYPE_UNDECLARED) => {
197
+ export const analyzeDelta = (tree, delta, vocabulary = {}) => {
198
+ const { isInteractive = NOTHING_INTERACTIVE, isRegistered = EVERY_TYPE_REGISTERED, checkProps = EVERY_TYPE_UNDECLARED, reads = NOTHING_DECLARED, places = NOTHING_PLACED, } = vocabulary;
156
199
  const tally = emptyTally();
157
200
  let state = tree.root;
158
201
  for (const operation of delta.operations) {
@@ -179,6 +222,8 @@ export const analyzeDelta = (tree, delta, isInteractive = NOTHING_INTERACTIVE, i
179
222
  nestedTargets: introducedNestedTargets(tree.root, state, isInteractive),
180
223
  unknownPrimitives: tally.unknown,
181
224
  invalidProps: introducedInvalidProps(tree.root, state, checkProps),
225
+ unreadBindings: introducedUnreadBindings(tree.root, state, reads),
226
+ unplacedSlots: introducedUnplacedSlots(tree.root, state, places),
182
227
  redirectedSubmissions: redirectedSubmissionsBetween(tree.root, state),
183
228
  repointedBindings: repointedBindingsBetween(tree.root, state),
184
229
  shallowestAffectedDepth: Number.isFinite(tally.shallowest) ? tally.shallowest : 0,
@@ -3,11 +3,11 @@ import { type Result } from "../result.js";
3
3
  import type { TreeError } from "../tree/errors.js";
4
4
  import type { LoomTree } from "../tree/tree.js";
5
5
  import { type ChangeAnalysis } from "./analysis.js";
6
+ import { type WriteCheck, type WriteCheckSeams } from "./checks.js";
6
7
  import type { GatePolicy } from "./policy.js";
7
8
  import type { ProposedChange } from "./proposal.js";
8
9
  import { type Reversibility } from "./reversibility.js";
9
10
  import { type StakeAssessment } from "./stakes.js";
10
- import { type PropsVocabulary } from "./vocabulary.js";
11
11
  /**
12
12
  * Everything the Gate is allowed to look at, gathered in one pass. Assembling
13
13
  * this is the last step that touches the tree; the Gate itself sees only this
@@ -17,6 +17,13 @@ import { type PropsVocabulary } from "./vocabulary.js";
17
17
  * rather than a rejected one. That distinction matters downstream: an
18
18
  * inapplicable proposal is an interpreter bug, not a policy decision.
19
19
  *
20
+ * It is also where *which* of the write path's optional checks were in place is
21
+ * written down, because this is the last function that can know: a seam reaches
22
+ * the decision as an argument here and is a closure by the time anything else
23
+ * sees it. `wiredChecks` is a fact this function holds about its own call rather
24
+ * than a claim relayed from a caller, which is what lets the Gate stamp it on a
25
+ * disposition the same way it stamps the policy it consulted.
26
+ *
20
27
  * This is also where a proposal's own declaration about what it writes over is
21
28
  * folded into the damage estimate (0035), so the Gate keeps seeing two axes and
22
29
  * a policy rather than growing a third input. The policy's vocabulary — which
@@ -30,6 +37,33 @@ export type ChangeAssessment = {
30
37
  readonly analysis: ChangeAnalysis;
31
38
  readonly stakes: StakeAssessment;
32
39
  readonly reversibility: Reversibility;
40
+ /**
41
+ * Which optional checks the caller handed this assessment, in canonical order.
42
+ *
43
+ * Always present and empty when none were, rather than omitted: a measurement
44
+ * is being recorded here, and an assessment that left the field out would be
45
+ * one a reader could not distinguish from a deployment that checks nothing.
46
+ * The disposition this ends up on is where absence means something else, and
47
+ * says so.
48
+ */
49
+ readonly wiredChecks: readonly WriteCheck[];
33
50
  };
34
- export declare const assessChange: (tree: LoomTree, proposal: ProposedChange, policy: GatePolicy, inverseDeltaId: DeltaId, checkProps?: PropsVocabulary) => Result<ChangeAssessment, TreeError>;
51
+ export declare const assessChange: (tree: LoomTree, proposal: ProposedChange, policy: GatePolicy, inverseDeltaId: DeltaId,
52
+ /**
53
+ * The optional seams, as one record and with each member absent rather than
54
+ * defaulted, so that *handed nothing* and *handed the sentinel* stay two
55
+ * different calls. The analysis below falls back to the same no-ops a default
56
+ * would have supplied, so nothing about a decision changes; what changes is
57
+ * that `wiredChecks` can report what arrived instead of reporting what the
58
+ * signature filled in.
59
+ *
60
+ * `WriteCheckSeams` itself rather than a shape of this function's own, which
61
+ * is what makes the two uses below one fact read twice: what is passed to the
62
+ * analysis is, by construction, what is recorded as having been wired. These
63
+ * were two trailing parameters until the collection (0252), and the third
64
+ * would have been the one nobody could order — the same pressure that
65
+ * collected `analyzeDelta`'s vocabularies, arriving at the caller that
66
+ * assembles them.
67
+ */
68
+ seams?: WriteCheckSeams) => Result<ChangeAssessment, TreeError>;
35
69
  //# sourceMappingURL=assessment.d.ts.map
@@ -1,13 +1,38 @@
1
1
  import { flatMapResult, mapResult } from "../result.js";
2
2
  import { analyzeDelta } from "./analysis.js";
3
+ import { wiredChecksOf } from "./checks.js";
3
4
  import { interactivePredicateFor } from "./nesting.js";
4
5
  import { assessReversibility } from "./reversibility.js";
5
6
  import { assessStakes } from "./stakes.js";
6
- import { EVERY_TYPE_UNDECLARED, primitiveVocabularyFor } from "./vocabulary.js";
7
- export const assessChange = (tree, proposal, policy, inverseDeltaId, checkProps = EVERY_TYPE_UNDECLARED) => flatMapResult(analyzeDelta(tree, proposal.delta, interactivePredicateFor(policy.interactiveTypes), primitiveVocabularyFor(policy.registeredPrimitiveTypes), checkProps), (analysis) => mapResult(assessReversibility(tree, proposal.delta, analysis, policy, inverseDeltaId), (reversibility) => ({
7
+ import { primitiveVocabularyFor } from "./vocabulary.js";
8
+ export const assessChange = (tree, proposal, policy, inverseDeltaId,
9
+ /**
10
+ * The optional seams, as one record and with each member absent rather than
11
+ * defaulted, so that *handed nothing* and *handed the sentinel* stay two
12
+ * different calls. The analysis below falls back to the same no-ops a default
13
+ * would have supplied, so nothing about a decision changes; what changes is
14
+ * that `wiredChecks` can report what arrived instead of reporting what the
15
+ * signature filled in.
16
+ *
17
+ * `WriteCheckSeams` itself rather than a shape of this function's own, which
18
+ * is what makes the two uses below one fact read twice: what is passed to the
19
+ * analysis is, by construction, what is recorded as having been wired. These
20
+ * were two trailing parameters until the collection (0252), and the third
21
+ * would have been the one nobody could order — the same pressure that
22
+ * collected `analyzeDelta`'s vocabularies, arriving at the caller that
23
+ * assembles them.
24
+ */
25
+ seams = {}) => flatMapResult(analyzeDelta(tree, proposal.delta, {
26
+ isInteractive: interactivePredicateFor(policy.interactiveTypes),
27
+ isRegistered: primitiveVocabularyFor(policy.registeredPrimitiveTypes),
28
+ checkProps: seams.propsVocabulary,
29
+ reads: seams.bindingReader,
30
+ places: seams.slotPlacer,
31
+ }), (analysis) => mapResult(assessReversibility(tree, proposal.delta, analysis, policy, inverseDeltaId), (reversibility) => ({
8
32
  proposal,
9
33
  analysis,
10
34
  stakes: assessStakes({ analysis, discards: proposal.discards ?? [] }, policy),
11
35
  reversibility,
36
+ wiredChecks: wiredChecksOf(seams),
12
37
  })));
13
38
  //# sourceMappingURL=assessment.js.map
@@ -0,0 +1,148 @@
1
+ import { z } from "zod";
2
+ import type { BindingReader } from "../render/reads.js";
3
+ import type { SlotPlacer } from "../render/slots.js";
4
+ import type { PropsVocabulary } from "./vocabulary.js";
5
+ /**
6
+ * Which of the write path's optional checks a runtime was actually holding when
7
+ * it judged a change.
8
+ *
9
+ * `policyFingerprintOf` proves that two judgments consulted the same rules, and
10
+ * a reader is entitled to hear that as *the same thing judged both*. It is not
11
+ * quite that. 0179 keeps a props vocabulary off the policy on purpose — it is a
12
+ * function, and a policy is a Zod-parsed serialisable value — so a deployment
13
+ * that wires one on Tuesday produces dispositions on Wednesday whose fingerprint
14
+ * is byte-identical to Monday's. The policy did not change. What decided did.
15
+ *
16
+ * That gap was filed on 21 September as a stated limit, and the thing that made
17
+ * it worth closing arrived afterwards: 0208 wired a second seam the same way, so
18
+ * there were two inputs that could turn an `accepted` into a `rejected` and
19
+ * leave no trace of having been consulted — three since 0252. A refusal rate
20
+ * that moved in the week somebody wired a registry into the write path is
21
+ * either explained by that wiring or is a fault, and nothing in this repository
22
+ * could tell those apart.
23
+ *
24
+ * **These are named rather than digested, and that is the design.** A policy has
25
+ * fourteen knobs of host data, so what it contains can only be compared as a
26
+ * hash; the seams are three, their names are Loom's own, and a list of them is
27
+ * something a person can read against their own composition root. The
28
+ * fingerprint's own doc comment makes the argument for the other side of this
29
+ * trade — *a digest is not something a person can look up in their own
30
+ * configuration* — and here there is nothing to look up, because the record says
31
+ * `props` or it does not.
32
+ *
33
+ * Naming also means this needs no shape half. A fingerprint carries one because
34
+ * adding a knob to the policy would otherwise change every digest in the corpus
35
+ * and make every host look as though it had edited a policy it never touched.
36
+ * Adding a *check* changes no existing list: a judgment from a version that had
37
+ * two checks and wired both says `props, bindings`, and so does a judgment from a
38
+ * version that has three and wired the same two. They compare equal, which is
39
+ * correct — a check that was not wired and a check that did not yet exist were
40
+ * applied exactly as much as each other.
41
+ *
42
+ * What this does not reach: whether a wired seam's *answers* changed. A props
43
+ * vocabulary is `propsVocabularyFor(registry)`, so tightening one primitive's
44
+ * schema changes what it refuses while this record stays identical. The runtime
45
+ * cannot read a function, and a record that implied otherwise would be worse than
46
+ * one with a single clear meaning — so this says which checks were in place and
47
+ * nothing about what they concluded.
48
+ */
49
+ export declare const writeCheckSchema: z.ZodEnum<["props", "bindings", "regions"]>;
50
+ /**
51
+ * One check the write path performs only when a composition root hands it the
52
+ * seam to perform it with.
53
+ *
54
+ * - `props` — the node's own primitive accepts the props it would carry (0179).
55
+ * - `bindings` — something will read the answer a bound node asks for (0208).
56
+ * - `regions` — the primitive places the named region a node fills (0252).
57
+ *
58
+ * The type-name vocabulary is deliberately not here. *Which primitives exist at
59
+ * all* is `registeredPrimitiveTypes`, a policy field, so it is already inside the
60
+ * fingerprint and an empty list already reads as a host that has not spoken
61
+ * (0173). Listing it again would record one input twice and leave a reader
62
+ * unable to tell which of the two records to believe.
63
+ */
64
+ export type WriteCheck = z.infer<typeof writeCheckSchema>;
65
+ /**
66
+ * Every check this version of Loom has a seam for, in the order a composition
67
+ * root meets them — which is also the order `assessChange` takes them, and the
68
+ * canonical order `wiredChecksOf` writes a list in, so that two runtimes holding
69
+ * the same checks produce the same list rather than two spellings of it.
70
+ */
71
+ export declare const WRITE_CHECKS: readonly WriteCheck[];
72
+ /**
73
+ * The seams, as much of them as reading the record needs.
74
+ *
75
+ * A structural subset of `CompositionRuntime` rather than that type's
76
+ * declaration: the composition root is where a host writes what it is wiring,
77
+ * with the doc comments explaining each seam, and splitting it to win a guard
78
+ * rail here would have cost a reading surface — lesson 5 prints the runtime
79
+ * whole, and a type assembled from two files cannot be printed whole.
80
+ *
81
+ * So the correspondence is held from the test side instead, where
82
+ * `checks.test.ts` enumerates `CompositionRuntime`'s optional fields and makes a
83
+ * seam added there a compile error until somebody decides whether it is a check.
84
+ *
85
+ * `| undefined` on each field rather than the runtime's stricter optionality,
86
+ * because *absent* and *present and `undefined`* are two different things on the
87
+ * record a host declares — rightly, since a host that writes a key means to say
88
+ * something — and one answer here: this call was handed no seam. A caller holding
89
+ * an `X | undefined` is the ordinary case at an optional seam, and making it
90
+ * rebuild the object to say so would put the presence test in two places.
91
+ */
92
+ export type WriteCheckSeams = {
93
+ readonly propsVocabulary?: PropsVocabulary | undefined;
94
+ readonly bindingReader?: BindingReader | undefined;
95
+ readonly slotPlacer?: SlotPlacer | undefined;
96
+ };
97
+ /**
98
+ * Which checks a composition root wired, in canonical order.
99
+ *
100
+ * Presence and never behaviour: a host that hands `EVERY_TYPE_UNDECLARED` across
101
+ * the props seam is recorded as having wired a props check, because it did. The
102
+ * alternative was to recognise that one sentinel and quietly believe every other
103
+ * no-op a host might write, which would make the record mean *this seam does
104
+ * something* in some cases and *this seam was handed over* in the rest. One clear
105
+ * meaning is worth more than a special case, and the sentinels exist as defaults
106
+ * rather than as something a composition root reaches for.
107
+ */
108
+ export declare const wiredChecksOf: (seams: WriteCheckSeams) => readonly WriteCheck[];
109
+ /**
110
+ * The same checks, in canonical order and without repetition.
111
+ *
112
+ * Which checks were in place is a membership test, so neither the order a caller
113
+ * holds them in nor a repeat may change what two lists say about each other.
114
+ * `wiredChecksOf` already answers in this form; this is for a list that arrived
115
+ * from a record, a wire or a host's own hand.
116
+ */
117
+ export declare const canonicalChecksOf: (checks: readonly WriteCheck[]) => readonly WriteCheck[];
118
+ /**
119
+ * What a set of recorded check lists says about a run of judgments.
120
+ *
121
+ * - `unrecorded` — nothing carried the field. Every one of those judgments
122
+ * predates it, and no amount of reading will recover what was wired.
123
+ * - `single` — one set of checks judged all of them. The apparatus held.
124
+ * - `changed` — two judgments were made with different checks in place, so a
125
+ * reader comparing their outcomes is comparing two write paths.
126
+ *
127
+ * There is no `incomparable` here, which is the one way this differs from
128
+ * `rulesetContinuityOf`, and the reason is the argument at the top of this
129
+ * module: a check list is made of Loom's own names, so lists from either side of
130
+ * an upgrade compare directly and an honest "cannot tell" is never needed.
131
+ *
132
+ * `single` is a statement about the lists present and nothing else. A run that
133
+ * also holds judgments carrying no list is not thereby shown constant, which is
134
+ * why the count of those belongs beside this rather than folded into it — the
135
+ * bargain `rulesetContinuityOf` strikes with `unfingerprinted`, for its reason.
136
+ */
137
+ export type ChecksContinuity = "unrecorded" | "single" | "changed";
138
+ export declare const checksContinuityOf: (wired: readonly (readonly WriteCheck[])[]) => ChecksContinuity;
139
+ /**
140
+ * A check list for a reader, with a word for the empty one.
141
+ *
142
+ * An empty list is a real and common state — a deployment that has wired neither
143
+ * seam — and a row rendering it as blank space reads as missing data rather than
144
+ * as the answer. "none" is a word rather than a name, which is why it is written
145
+ * here and not spelled into `WriteCheck`.
146
+ */
147
+ export declare const describeWiredChecks: (checks: readonly WriteCheck[]) => string;
148
+ //# sourceMappingURL=checks.d.ts.map
@@ -0,0 +1,112 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Which of the write path's optional checks a runtime was actually holding when
4
+ * it judged a change.
5
+ *
6
+ * `policyFingerprintOf` proves that two judgments consulted the same rules, and
7
+ * a reader is entitled to hear that as *the same thing judged both*. It is not
8
+ * quite that. 0179 keeps a props vocabulary off the policy on purpose — it is a
9
+ * function, and a policy is a Zod-parsed serialisable value — so a deployment
10
+ * that wires one on Tuesday produces dispositions on Wednesday whose fingerprint
11
+ * is byte-identical to Monday's. The policy did not change. What decided did.
12
+ *
13
+ * That gap was filed on 21 September as a stated limit, and the thing that made
14
+ * it worth closing arrived afterwards: 0208 wired a second seam the same way, so
15
+ * there were two inputs that could turn an `accepted` into a `rejected` and
16
+ * leave no trace of having been consulted — three since 0252. A refusal rate
17
+ * that moved in the week somebody wired a registry into the write path is
18
+ * either explained by that wiring or is a fault, and nothing in this repository
19
+ * could tell those apart.
20
+ *
21
+ * **These are named rather than digested, and that is the design.** A policy has
22
+ * fourteen knobs of host data, so what it contains can only be compared as a
23
+ * hash; the seams are three, their names are Loom's own, and a list of them is
24
+ * something a person can read against their own composition root. The
25
+ * fingerprint's own doc comment makes the argument for the other side of this
26
+ * trade — *a digest is not something a person can look up in their own
27
+ * configuration* — and here there is nothing to look up, because the record says
28
+ * `props` or it does not.
29
+ *
30
+ * Naming also means this needs no shape half. A fingerprint carries one because
31
+ * adding a knob to the policy would otherwise change every digest in the corpus
32
+ * and make every host look as though it had edited a policy it never touched.
33
+ * Adding a *check* changes no existing list: a judgment from a version that had
34
+ * two checks and wired both says `props, bindings`, and so does a judgment from a
35
+ * version that has three and wired the same two. They compare equal, which is
36
+ * correct — a check that was not wired and a check that did not yet exist were
37
+ * applied exactly as much as each other.
38
+ *
39
+ * What this does not reach: whether a wired seam's *answers* changed. A props
40
+ * vocabulary is `propsVocabularyFor(registry)`, so tightening one primitive's
41
+ * schema changes what it refuses while this record stays identical. The runtime
42
+ * cannot read a function, and a record that implied otherwise would be worse than
43
+ * one with a single clear meaning — so this says which checks were in place and
44
+ * nothing about what they concluded.
45
+ */
46
+ export const writeCheckSchema = z.enum(["props", "bindings", "regions"]);
47
+ /**
48
+ * Every check this version of Loom has a seam for, in the order a composition
49
+ * root meets them — which is also the order `assessChange` takes them, and the
50
+ * canonical order `wiredChecksOf` writes a list in, so that two runtimes holding
51
+ * the same checks produce the same list rather than two spellings of it.
52
+ */
53
+ export const WRITE_CHECKS = writeCheckSchema.options;
54
+ /**
55
+ * Where each check's seam is found, so the record is read off the declaration
56
+ * rather than kept beside it.
57
+ *
58
+ * The mapped type is the guard rail: a member added to `writeCheckSchema` is a
59
+ * compile error here until somebody says which seam supplies it. The other
60
+ * direction — a seam a composition root can hand over that no check reads — is a
61
+ * compile error in `checks.test.ts`, which enumerates the runtime's own optional
62
+ * fields rather than this type's.
63
+ *
64
+ * `unknown` rather than the seam's own type, because presence is the whole of
65
+ * what is asked. Nothing here calls a seam, and a reader of this record that
66
+ * believed it had been called would be believing more than it says.
67
+ */
68
+ const SEAM_OF = {
69
+ props: (seams) => seams.propsVocabulary,
70
+ bindings: (seams) => seams.bindingReader,
71
+ regions: (seams) => seams.slotPlacer,
72
+ };
73
+ /**
74
+ * Which checks a composition root wired, in canonical order.
75
+ *
76
+ * Presence and never behaviour: a host that hands `EVERY_TYPE_UNDECLARED` across
77
+ * the props seam is recorded as having wired a props check, because it did. The
78
+ * alternative was to recognise that one sentinel and quietly believe every other
79
+ * no-op a host might write, which would make the record mean *this seam does
80
+ * something* in some cases and *this seam was handed over* in the rest. One clear
81
+ * meaning is worth more than a special case, and the sentinels exist as defaults
82
+ * rather than as something a composition root reaches for.
83
+ */
84
+ export const wiredChecksOf = (seams) => WRITE_CHECKS.filter((check) => SEAM_OF[check](seams) !== undefined);
85
+ /**
86
+ * The same checks, in canonical order and without repetition.
87
+ *
88
+ * Which checks were in place is a membership test, so neither the order a caller
89
+ * holds them in nor a repeat may change what two lists say about each other.
90
+ * `wiredChecksOf` already answers in this form; this is for a list that arrived
91
+ * from a record, a wire or a host's own hand.
92
+ */
93
+ export const canonicalChecksOf = (checks) => WRITE_CHECKS.filter((check) => checks.includes(check));
94
+ export const checksContinuityOf = (wired) => {
95
+ const distinct = new Set(wired.map((checks) => canonicalChecksOf(checks).join(",")));
96
+ if (distinct.size === 0)
97
+ return "unrecorded";
98
+ return distinct.size === 1 ? "single" : "changed";
99
+ };
100
+ /**
101
+ * A check list for a reader, with a word for the empty one.
102
+ *
103
+ * An empty list is a real and common state — a deployment that has wired neither
104
+ * seam — and a row rendering it as blank space reads as missing data rather than
105
+ * as the answer. "none" is a word rather than a name, which is why it is written
106
+ * here and not spelled into `WriteCheck`.
107
+ */
108
+ export const describeWiredChecks = (checks) => {
109
+ const canonical = canonicalChecksOf(checks);
110
+ return canonical.length === 0 ? "none" : canonical.join(", ");
111
+ };
112
+ //# sourceMappingURL=checks.js.map