@smthrs/plan 0.0.0-stage → 1.0.0-rc.13

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 (209) hide show
  1. package/CHANGELOG.md +189 -0
  2. package/LICENSE +21 -0
  3. package/README.md +230 -2
  4. package/THIRD_PARTY_NOTICES.md +48 -0
  5. package/dist/cjs/CachePolicy.d.ts +131 -0
  6. package/dist/cjs/CachePolicy.d.ts.map +1 -0
  7. package/dist/cjs/CachePolicy.js +50 -0
  8. package/dist/cjs/CachePolicy.js.map +7 -0
  9. package/dist/cjs/Effects.d.ts +258 -0
  10. package/dist/cjs/Effects.d.ts.map +1 -0
  11. package/dist/cjs/Effects.js +76 -0
  12. package/dist/cjs/Effects.js.map +7 -0
  13. package/dist/cjs/FileSet.d.ts +366 -0
  14. package/dist/cjs/FileSet.d.ts.map +1 -0
  15. package/dist/cjs/FileSet.js +196 -0
  16. package/dist/cjs/FileSet.js.map +7 -0
  17. package/dist/cjs/GraphBuildError.d.ts +120 -0
  18. package/dist/cjs/GraphBuildError.d.ts.map +1 -0
  19. package/dist/cjs/GraphBuildError.js +71 -0
  20. package/dist/cjs/GraphBuildError.js.map +7 -0
  21. package/dist/cjs/KeyMaterial.d.ts +107 -0
  22. package/dist/cjs/KeyMaterial.d.ts.map +1 -0
  23. package/dist/cjs/KeyMaterial.js +64 -0
  24. package/dist/cjs/KeyMaterial.js.map +7 -0
  25. package/dist/cjs/Node.d.ts +685 -0
  26. package/dist/cjs/Node.d.ts.map +1 -0
  27. package/dist/cjs/Node.js +230 -0
  28. package/dist/cjs/Node.js.map +7 -0
  29. package/dist/cjs/Placement.d.ts +117 -0
  30. package/dist/cjs/Placement.d.ts.map +1 -0
  31. package/dist/cjs/Placement.js +46 -0
  32. package/dist/cjs/Placement.js.map +7 -0
  33. package/dist/cjs/Plan.d.ts +489 -0
  34. package/dist/cjs/Plan.d.ts.map +1 -0
  35. package/dist/cjs/Plan.js +511 -0
  36. package/dist/cjs/Plan.js.map +7 -0
  37. package/dist/cjs/PlanDiff.d.ts +77 -0
  38. package/dist/cjs/PlanDiff.d.ts.map +1 -0
  39. package/dist/cjs/PlanDiff.js +149 -0
  40. package/dist/cjs/PlanDiff.js.map +7 -0
  41. package/dist/cjs/Planned.d.ts +121 -0
  42. package/dist/cjs/Planned.d.ts.map +1 -0
  43. package/dist/cjs/Planned.js +72 -0
  44. package/dist/cjs/Planned.js.map +7 -0
  45. package/dist/cjs/Repetition.d.ts +31 -0
  46. package/dist/cjs/Repetition.d.ts.map +1 -0
  47. package/dist/cjs/Repetition.js +36 -0
  48. package/dist/cjs/Repetition.js.map +7 -0
  49. package/dist/cjs/Scheduling.d.ts +89 -0
  50. package/dist/cjs/Scheduling.d.ts.map +1 -0
  51. package/dist/cjs/Scheduling.js +76 -0
  52. package/dist/cjs/Scheduling.js.map +7 -0
  53. package/dist/cjs/StepKey.d.ts +354 -0
  54. package/dist/cjs/StepKey.d.ts.map +1 -0
  55. package/dist/cjs/StepKey.js +313 -0
  56. package/dist/cjs/StepKey.js.map +7 -0
  57. package/dist/cjs/index.d.ts +91 -0
  58. package/dist/cjs/index.d.ts.map +1 -0
  59. package/dist/cjs/index.js +59 -0
  60. package/dist/cjs/index.js.map +7 -0
  61. package/dist/cjs/internal/ConflictAnnotation.d.ts +59 -0
  62. package/dist/cjs/internal/ConflictAnnotation.d.ts.map +1 -0
  63. package/dist/cjs/internal/ConflictAnnotation.js +247 -0
  64. package/dist/cjs/internal/ConflictAnnotation.js.map +7 -0
  65. package/dist/cjs/internal/EffectCandidates.d.ts +19 -0
  66. package/dist/cjs/internal/EffectCandidates.d.ts.map +1 -0
  67. package/dist/cjs/internal/EffectCandidates.js +92 -0
  68. package/dist/cjs/internal/EffectCandidates.js.map +7 -0
  69. package/dist/cjs/internal/JsonMirror.d.ts +34 -0
  70. package/dist/cjs/internal/JsonMirror.d.ts.map +1 -0
  71. package/dist/cjs/internal/JsonMirror.js +195 -0
  72. package/dist/cjs/internal/JsonMirror.js.map +7 -0
  73. package/dist/cjs/internal/SchemaIdentity.d.ts +140 -0
  74. package/dist/cjs/internal/SchemaIdentity.d.ts.map +1 -0
  75. package/dist/cjs/internal/SchemaIdentity.js +718 -0
  76. package/dist/cjs/internal/SchemaIdentity.js.map +7 -0
  77. package/dist/cjs/internal/effects.d.ts +245 -0
  78. package/dist/cjs/internal/effects.d.ts.map +1 -0
  79. package/dist/cjs/internal/effects.js +290 -0
  80. package/dist/cjs/internal/effects.js.map +7 -0
  81. package/dist/cjs/internal/node.d.ts +526 -0
  82. package/dist/cjs/internal/node.d.ts.map +1 -0
  83. package/dist/cjs/internal/node.js +313 -0
  84. package/dist/cjs/internal/node.js.map +7 -0
  85. package/dist/cjs/package.json +1 -0
  86. package/dist/cjs/test/PlanFixtures.d.ts +127 -0
  87. package/dist/cjs/test/PlanFixtures.d.ts.map +1 -0
  88. package/dist/cjs/test/PlanFixtures.js +59 -0
  89. package/dist/cjs/test/PlanFixtures.js.map +7 -0
  90. package/dist/esm/CachePolicy.d.ts +131 -0
  91. package/dist/esm/CachePolicy.d.ts.map +1 -0
  92. package/dist/esm/CachePolicy.js +117 -0
  93. package/dist/esm/CachePolicy.js.map +1 -0
  94. package/dist/esm/Effects.d.ts +258 -0
  95. package/dist/esm/Effects.d.ts.map +1 -0
  96. package/dist/esm/Effects.js +178 -0
  97. package/dist/esm/Effects.js.map +1 -0
  98. package/dist/esm/FileSet.d.ts +366 -0
  99. package/dist/esm/FileSet.d.ts.map +1 -0
  100. package/dist/esm/FileSet.js +398 -0
  101. package/dist/esm/FileSet.js.map +1 -0
  102. package/dist/esm/GraphBuildError.d.ts +120 -0
  103. package/dist/esm/GraphBuildError.d.ts.map +1 -0
  104. package/dist/esm/GraphBuildError.js +145 -0
  105. package/dist/esm/GraphBuildError.js.map +1 -0
  106. package/dist/esm/KeyMaterial.d.ts +107 -0
  107. package/dist/esm/KeyMaterial.d.ts.map +1 -0
  108. package/dist/esm/KeyMaterial.js +92 -0
  109. package/dist/esm/KeyMaterial.js.map +1 -0
  110. package/dist/esm/Node.d.ts +685 -0
  111. package/dist/esm/Node.d.ts.map +1 -0
  112. package/dist/esm/Node.js +591 -0
  113. package/dist/esm/Node.js.map +1 -0
  114. package/dist/esm/Placement.d.ts +117 -0
  115. package/dist/esm/Placement.d.ts.map +1 -0
  116. package/dist/esm/Placement.js +65 -0
  117. package/dist/esm/Placement.js.map +1 -0
  118. package/dist/esm/Plan.d.ts +489 -0
  119. package/dist/esm/Plan.d.ts.map +1 -0
  120. package/dist/esm/Plan.js +718 -0
  121. package/dist/esm/Plan.js.map +1 -0
  122. package/dist/esm/PlanDiff.d.ts +77 -0
  123. package/dist/esm/PlanDiff.d.ts.map +1 -0
  124. package/dist/esm/PlanDiff.js +205 -0
  125. package/dist/esm/PlanDiff.js.map +1 -0
  126. package/dist/esm/Planned.d.ts +121 -0
  127. package/dist/esm/Planned.d.ts.map +1 -0
  128. package/dist/esm/Planned.js +147 -0
  129. package/dist/esm/Planned.js.map +1 -0
  130. package/dist/esm/Repetition.d.ts +31 -0
  131. package/dist/esm/Repetition.d.ts.map +1 -0
  132. package/dist/esm/Repetition.js +24 -0
  133. package/dist/esm/Repetition.js.map +1 -0
  134. package/dist/esm/Scheduling.d.ts +89 -0
  135. package/dist/esm/Scheduling.d.ts.map +1 -0
  136. package/dist/esm/Scheduling.js +82 -0
  137. package/dist/esm/Scheduling.js.map +1 -0
  138. package/dist/esm/StepKey.d.ts +354 -0
  139. package/dist/esm/StepKey.d.ts.map +1 -0
  140. package/dist/esm/StepKey.js +503 -0
  141. package/dist/esm/StepKey.js.map +1 -0
  142. package/dist/esm/index.d.ts +91 -0
  143. package/dist/esm/index.d.ts.map +1 -0
  144. package/dist/esm/index.js +91 -0
  145. package/dist/esm/index.js.map +1 -0
  146. package/dist/esm/internal/ConflictAnnotation.d.ts +59 -0
  147. package/dist/esm/internal/ConflictAnnotation.d.ts.map +1 -0
  148. package/dist/esm/internal/ConflictAnnotation.js +332 -0
  149. package/dist/esm/internal/ConflictAnnotation.js.map +1 -0
  150. package/dist/esm/internal/EffectCandidates.d.ts +19 -0
  151. package/dist/esm/internal/EffectCandidates.d.ts.map +1 -0
  152. package/dist/esm/internal/EffectCandidates.js +86 -0
  153. package/dist/esm/internal/EffectCandidates.js.map +1 -0
  154. package/dist/esm/internal/JsonMirror.d.ts +34 -0
  155. package/dist/esm/internal/JsonMirror.d.ts.map +1 -0
  156. package/dist/esm/internal/JsonMirror.js +204 -0
  157. package/dist/esm/internal/JsonMirror.js.map +1 -0
  158. package/dist/esm/internal/SchemaIdentity.d.ts +140 -0
  159. package/dist/esm/internal/SchemaIdentity.d.ts.map +1 -0
  160. package/dist/esm/internal/SchemaIdentity.js +1002 -0
  161. package/dist/esm/internal/SchemaIdentity.js.map +1 -0
  162. package/dist/esm/internal/effects.d.ts +245 -0
  163. package/dist/esm/internal/effects.d.ts.map +1 -0
  164. package/dist/esm/internal/effects.js +459 -0
  165. package/dist/esm/internal/effects.js.map +1 -0
  166. package/dist/esm/internal/node.d.ts +526 -0
  167. package/dist/esm/internal/node.d.ts.map +1 -0
  168. package/dist/esm/internal/node.js +565 -0
  169. package/dist/esm/internal/node.js.map +1 -0
  170. package/dist/esm/test/PlanFixtures.d.ts +127 -0
  171. package/dist/esm/test/PlanFixtures.d.ts.map +1 -0
  172. package/dist/esm/test/PlanFixtures.js +60 -0
  173. package/dist/esm/test/PlanFixtures.js.map +1 -0
  174. package/docs/README.md +167 -0
  175. package/docs/api.md +1485 -0
  176. package/docs/concepts/authoring-ast.md +204 -0
  177. package/docs/concepts/effects-and-conflicts.md +135 -0
  178. package/docs/concepts/plan-value.md +168 -0
  179. package/docs/concepts/step-keys.md +179 -0
  180. package/docs/guides/author-a-node-graph.md +182 -0
  181. package/docs/guides/compile-a-plan.md +146 -0
  182. package/docs/guides/declare-file-effects.md +143 -0
  183. package/docs/guides/diff-two-plans.md +310 -0
  184. package/docs/installation.md +75 -0
  185. package/docs/quickstart.md +128 -0
  186. package/docs/testing.md +73 -0
  187. package/docs/troubleshooting.md +314 -0
  188. package/package.json +255 -3
  189. package/src/CachePolicy.ts +143 -0
  190. package/src/Effects.ts +302 -0
  191. package/src/FileSet.ts +493 -0
  192. package/src/GraphBuildError.ts +156 -0
  193. package/src/KeyMaterial.ts +111 -0
  194. package/src/Node.ts +974 -0
  195. package/src/Placement.ts +99 -0
  196. package/src/Plan.ts +911 -0
  197. package/src/PlanDiff.ts +244 -0
  198. package/src/Planned.ts +208 -0
  199. package/src/Repetition.ts +33 -0
  200. package/src/Scheduling.ts +154 -0
  201. package/src/StepKey.ts +736 -0
  202. package/src/index.ts +103 -0
  203. package/src/internal/ConflictAnnotation.ts +374 -0
  204. package/src/internal/EffectCandidates.ts +89 -0
  205. package/src/internal/JsonMirror.ts +255 -0
  206. package/src/internal/SchemaIdentity.ts +1096 -0
  207. package/src/internal/effects.ts +543 -0
  208. package/src/internal/node.ts +859 -0
  209. package/src/test/PlanFixtures.ts +76 -0
@@ -0,0 +1,314 @@
1
+ ---
2
+ title: "Troubleshooting"
3
+ description: "Every refusal @smthrs/plan raises, what causes it, and what to change: build errors, compile errors, and key material errors."
4
+ ---
5
+
6
+ Every failure this package reports is typed and carries a code. Find the code
7
+ and read the matching section. The full error schemas are in the
8
+ [API reference](./api.md).
9
+
10
+ Three error types, from three layers:
11
+
12
+ | Type | Raised by |
13
+ | ------------------ | ---------------------------------------------- |
14
+ | `GraphBuildError` | Building a node graph, before there is a plan. |
15
+ | `PlanError` | `Plan.compile` and `Plan.append`. |
16
+ | `KeyMaterialError` | The step-key compiler. |
17
+
18
+ Persistence raises a fourth, `PlanStoreError`, from
19
+ [`@smthrs/plan-store`](/api/plan-store); its
20
+ [troubleshooting page](../../plan-store/docs/troubleshooting.md) covers
21
+ every code.
22
+
23
+ ## GraphBuildError
24
+
25
+ Thrown, not failed, because the author reading it is mid-body. Each one names
26
+ the site through `node` plus the recorded property `path`, and states the fix in
27
+ `message`.
28
+
29
+ ### planned_value_computed
30
+
31
+ **What happened.** A body computed on a step result. The message names the
32
+ value and the operation:
33
+
34
+ ```text
35
+ Planned value read-pr.count was computed at plan time by Symbol.toPrimitive.
36
+ Use Node.map to compute, Node.branch to decide, or pass the value into a payload.
37
+ ```
38
+
39
+ Template interpolation, `String(value)`, arithmetic through a coercion,
40
+ `JSON.stringify` of a payload holding one, calling it, `in`, and enumerating it
41
+ all land here.
42
+
43
+ **What to change.** Do the computation where it belongs. `Node.map` transforms a
44
+ result, `Node.branch` decides on one, and passing the value into a payload field
45
+ or reading a field off it stays a reference.
46
+
47
+ `Boolean(value)` and `value === other` cannot be refused, because JavaScript
48
+ exposes no trap for them. They reveal only proxy truthiness or identity and
49
+ never the planned result, so a decision written that way is silently wrong. Use
50
+ `Node.branch`.
51
+
52
+ ### invalid_all_member
53
+
54
+ **What happened.** `Node.all` received something that is not a node at the named
55
+ member.
56
+
57
+ **What to change.** Pass a node. An object that merely carries `Node.TypeId` is
58
+ not one: the marker is a public string, and every combinator reads `ast` as
59
+ trusted topology, so a lookalike is refused exactly like any other non-node.
60
+
61
+ ### invalid_join
62
+
63
+ **What happened.** `Node.race`, `Node.any`, or `Node.quorum` received a non-node
64
+ member, no members, or a quorum count outside 1 to its member count. `node` names
65
+ the member, or the combinator for a count.
66
+
67
+ **What to change.** Pass at least one node, and a whole-number quorum its members
68
+ can reach.
69
+
70
+ ### invalid_continuation
71
+
72
+ **What happened.** A branch arm, a catch arm, or a direct `andThen`
73
+ continuation did not return a node. `node` says which: `branch/subject/then`,
74
+ `catch/subject`, or `andThen/next`.
75
+
76
+ **What to change.** Return a node from the arm. An arm that has nothing to do
77
+ returns `Node.succeed(value)`.
78
+
79
+ ### invalid_priority
80
+
81
+ **What happened.** `Node.priority` received a value that is not a safe integer.
82
+
83
+ **What to change.** Pass a safe integer. No ordering could compare anything
84
+ else.
85
+
86
+ ### invalid_payload
87
+
88
+ **What happened.** A payload member cannot be captured as inert JSON without
89
+ running author code or losing identity: an accessor, or a prototype with no
90
+ `toJSON`. The message names the path:
91
+
92
+ ```text
93
+ Plan payload at $.config.timeout is an accessor
94
+ ```
95
+
96
+ **What to change.** Pass data. Read the accessor yourself and put the value in
97
+ the payload, or give the object a `toJSON` that returns data.
98
+
99
+ ### cyclic_payload
100
+
101
+ **What happened.** A payload member has a `toJSON` that returns its own
102
+ receiver. It once collapsed to an empty object, which keyed two different values
103
+ identically.
104
+
105
+ **What to change.** Return data from `toJSON`, not the object itself.
106
+
107
+ ### The codes this package does not raise
108
+
109
+ `GraphBuildErrorCode` also carries `recursion_requires_boundary`,
110
+ `placement_requires_boundary`, `graph_too_deep`, `duplicate_node`,
111
+ `payload_too_deep`, `unstable_callback`, `effect_outside_envelope`,
112
+ `effect_mode_widening`, `effect_tier_widening`, and
113
+ `capability_outside_grant`. Those come from
114
+ [`@smthrs/flow`](/api/flow)'s graph walk, which shares this vocabulary.
115
+
116
+ Six more come from [`@smthrs/core`](/api/core)'s graph builder, which raises
117
+ this error rather than a second class of its own: `write_conflict` for two work
118
+ nodes overlapping under `onConflict: "fail"`, where `node` names the first of
119
+ the pair and `Graph.conflicts` carries both; `missing_key_material` for a node
120
+ that reached key compilation without any; `dependency_cycle` for a dependency
121
+ set that cannot be ordered, where `node` names a node in the cycle;
122
+ `plan_too_large` for a node, edge, conflict, or effect-path limit crossed, where
123
+ `node` names the node whose admission crossed it; `payload_too_large` for one
124
+ plan value with more members than the bound, where `path` names the offending
125
+ value path; and `invalid_node` for a malformed node AST. All six are fatal.
126
+
127
+ The code set is closed so a caller can switch on it across all three packages.
128
+
129
+ The last four are the effect-authority refusals. `Effects` above defines the
130
+ rule: a declaration may narrow the envelope enclosing it and never widen it.
131
+
132
+ ```text
133
+ Flow "build/write-dist" at "root.flow" declares a path its caller's effect
134
+ envelope does not cover: etc/hosts.
135
+ ```
136
+
137
+ `effect_outside_envelope` names the escaping paths, `effect_mode_widening`
138
+ means an `expected` declaration sits inside a `hermetic` envelope, and
139
+ `effect_tier_widening` means a tier rose where it may only narrow. All three
140
+ are fatal: widen the caller's declared effects, or narrow the callee's.
141
+
142
+ `capability_outside_grant` is the one advisory code. The call still runs, with
143
+ the capability dropped, so declare it on the caller or stop requiring it on the
144
+ callee.
145
+
146
+ `unstable_callback` deserves its own note because the fix lives in your flow
147
+ body. `Graph.build` with `callbackIdentity: "stable"` refuses a callback whose
148
+ identity is process-local:
149
+
150
+ ```text
151
+ Callback run at "review" has process-local identity and cannot enter a stable graph.
152
+ ```
153
+
154
+ Wrap the callback in `Node.capture` and declare every semantic capture,
155
+ including the version of any imported implementation, so it keys by content
156
+ instead of by process.
157
+
158
+ ## PlanError
159
+
160
+ Failed, not thrown: `compile` and `append` return an Effect.
161
+
162
+ ### cycle
163
+
164
+ **What happened.** Either material dependencies close a cycle:
165
+
166
+ ```text
167
+ Plan cycle through node run-tests
168
+ ```
169
+
170
+ or a reader-after-writer edge contradicts an inferred ordering:
171
+
172
+ ```text
173
+ Plan cycle: node lint reads dist/bundle.js, which node bundle produces, so lint must
174
+ follow bundle, but bundle already depends on lint through bundle -> report -> lint
175
+ ```
176
+
177
+ **What to change.** For the first, break the dependency loop in the declarations.
178
+ For the second, inspect the inferred producer and `serialize` edges. If the
179
+ reader needs the new output, put the producer first or separate unrelated
180
+ overlapping writes. If it intentionally reads the earlier version, express that
181
+ sequence with a `Ref` or `Pending` dependency path from the writer to the reader.
182
+ Explicit read-before-write sequencing is valid; declaration order alone is not
183
+ an explicit version choice. Two unordered nodes that each need the other's new
184
+ output still form a cycle and must be split into stages.
185
+
186
+ ### unknown_dependency
187
+
188
+ **What happened.** A `Ref` or `Pending` names a node that is neither in the
189
+ drafts nor already in the plan.
190
+
191
+ **What to change.** Check the `from` spelling against the node ids in the same
192
+ compile. On an `append`, remember that the reference may name a node from an
193
+ earlier generation, which is legal, but not one that was never recorded.
194
+
195
+ ### duplicate_node
196
+
197
+ **What happened.** A draft reuses an id the plan already holds.
198
+
199
+ **What to change.** Rename one of them. A node id is durable dispatch identity,
200
+ so two nodes may never share one.
201
+
202
+ ### overlap_forbidden
203
+
204
+ **What happened.** Two nodes that both asked for the `fail` verdict genuinely
205
+ write overlapping paths, and no dependency path orders them:
206
+
207
+ ```text
208
+ Nodes bundle and minify both write dist/bundle.js
209
+ ```
210
+
211
+ **What to change.** `fail` is the verdict for a flow that promises disjointness,
212
+ so the declaration is the thing that broke the promise. Narrow one write set,
213
+ add a dependency that orders the pair, or change `conflictStrategy` to
214
+ `serialize` if serializing is acceptable after all.
215
+
216
+ ### invalid_effects
217
+
218
+ **What happened.** One path is declared as both a write and a removal.
219
+
220
+ **What to change.** Pick one. A removal mutates the world exactly as a write
221
+ does, and both plan passes fold the two together, so the pair is a contradiction
222
+ rather than a refinement.
223
+
224
+ ### invalid_node
225
+
226
+ **What happened.** The broadest code, covering everything a draft can get
227
+ wrong: an empty plan id, flow, or node id; a priority that is not a safe
228
+ integer; a `kind`, `conflictStrategy`, or `runtimeStrategy` outside its literal
229
+ set; key material or an effect declaration this release cannot decode, which
230
+ includes a path that is not workspace-relative; and a material payload holding
231
+ an accessor or an unsupported prototype.
232
+
233
+ The message names the node and, for a payload, the path:
234
+
235
+ ```text
236
+ Node run-tests has invalid material payload at $.config.timeout
237
+ ```
238
+
239
+ **What to change.** Read the message. Every case names the exact field. For a
240
+ path refusal, [Declare the files a node touches](./guides/declare-file-effects.md)
241
+ lists the forms `workspaceRelative` rejects and why each one is a correctness
242
+ hole rather than a style rule.
243
+
244
+ ### graph_too_large
245
+
246
+ **What happened.** The plan would hold more than `Plan.maximumPlanNodes` nodes,
247
+ which is 10,000, or effect analysis exceeded 250,000 candidate pairs or
248
+ 10,000,000 work units.
249
+
250
+ ```text
251
+ A plan may contain at most 10000 nodes, received 12000
252
+ ```
253
+
254
+ **What to change.** Split the work across flow boundaries. The node ceiling is checked
255
+ before effect analysis. A separate work budget bounds dense conflicts and
256
+ reachability updates, and applies across generations during verification.
257
+
258
+ ### invalid_plan
259
+
260
+ **What happened.** `Plan.verify` decoded a plan whose content does not hold
261
+ together. Every [`@smthrs/plan-store`](/api/plan-store) read and write runs it,
262
+ so this surfaces from `record`, `append`, and `get`, never from `compile`:
263
+
264
+ ```text
265
+ Plan approval digest does not match its compiled content
266
+ Plan nodes do not match their compiled keys, effects, ordering, or generations
267
+ Node run-tests has an invalid or out-of-order generation
268
+ ```
269
+
270
+ **What to change.** Pass the value `Plan.compile` or `Plan.append` returned.
271
+ A plan that fails here was assembled by hand, mutated after compiling, or
272
+ edited in the database. The store raises a `PlanStoreError` of the same name for
273
+ its own preconditions.
274
+
275
+ ## KeyMaterialError
276
+
277
+ ### non_content_material
278
+
279
+ **What happened.** `StepKey.fromKeyMaterial` or `StepKey.dispatchIdentity` was
280
+ asked for a key on material whose `kind` is `compensable` or `irreversible`.
281
+
282
+ **What to change.** Only `sealed` work gets a cross-run content key. Use
283
+ `StepKey.planIdentity` when compiling any tier's declaration, and
284
+ `StepKey.ordinal` when dispatching the other tiers: it mints a run-local key.
285
+ Do not change an action to `sealed` merely to make it plannable.
286
+
287
+ ### missing_dependency
288
+
289
+ **What happened.** A `Ref` or `Pending` resolved to nothing usable: no entry for
290
+ `from`, an entry that is not an own data property, or a digest that is not a
291
+ string. On the dispatch path, a missing settled result.
292
+
293
+ **What to change.** Supply every dependency the material names. A `Ref` naming
294
+ `toString` or `constructor` lands here on purpose, because a prototype-named
295
+ dependency would otherwise resolve to an inherited function and collide.
296
+
297
+ If you see this from a scheduler, a dependent dispatched before its dependency
298
+ settled. The halt rule is what guarantees it cannot: a dependent of failed or
299
+ skipped work never dispatches.
300
+
301
+ ### invalid_environment
302
+
303
+ **What happened.** An `EnvironmentIdentity` that is neither properly declared
304
+ nor properly run-scoped:
305
+
306
+ ```text
307
+ Undeclared environment identity requires a non-empty runScope
308
+ Declared environment identity must not include runScope
309
+ Environment identity requires a boolean declared field
310
+ ```
311
+
312
+ **What to change.** `declared: true` carries no `runScope`. `declared: false`
313
+ carries a non-empty one, which pins the key to a single run so a step whose
314
+ environment is unknown never serves a cross-run hit.
package/package.json CHANGED
@@ -1,6 +1,258 @@
1
1
  {
2
2
  "name": "@smthrs/plan",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "type": "module",
4
+ "version": "1.0.0-rc.13",
5
+ "license": "MIT",
6
+ "smthrs": {
7
+ "group": "engine"
8
+ },
9
+ "description": "The persisted flows plan: a keyed action graph, its append-only store, and its diff",
10
+ "homepage": "https://github.com/smithersai/smithers",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/smithersai/smithers.git",
14
+ "directory": "packages/smithers/flows/plan"
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/smithersai/smithers/issues"
18
+ },
19
+ "tags": [
20
+ "typescript",
21
+ "effect",
22
+ "plan",
23
+ "graph"
24
+ ],
25
+ "keywords": [
26
+ "typescript",
27
+ "effect",
28
+ "plan",
29
+ "graph"
30
+ ],
31
+ "engines": {
32
+ "node": ">=26.4.0"
33
+ },
34
+ "sideEffects": [],
35
+ "exports": {
36
+ "./package.json": "./package.json",
37
+ ".": {
38
+ "import": {
39
+ "types": "./dist/esm/index.d.ts",
40
+ "default": "./dist/esm/index.js"
41
+ },
42
+ "require": {
43
+ "types": "./dist/cjs/index.d.ts",
44
+ "default": "./dist/cjs/index.js"
45
+ }
46
+ },
47
+ "./GraphBuildError": {
48
+ "import": {
49
+ "types": "./dist/esm/GraphBuildError.d.ts",
50
+ "default": "./dist/esm/GraphBuildError.js"
51
+ },
52
+ "require": {
53
+ "types": "./dist/cjs/GraphBuildError.d.ts",
54
+ "default": "./dist/cjs/GraphBuildError.js"
55
+ }
56
+ },
57
+ "./Node": {
58
+ "import": {
59
+ "types": "./dist/esm/Node.d.ts",
60
+ "default": "./dist/esm/Node.js"
61
+ },
62
+ "require": {
63
+ "types": "./dist/cjs/Node.d.ts",
64
+ "default": "./dist/cjs/Node.js"
65
+ }
66
+ },
67
+ "./Planned": {
68
+ "import": {
69
+ "types": "./dist/esm/Planned.d.ts",
70
+ "default": "./dist/esm/Planned.js"
71
+ },
72
+ "require": {
73
+ "types": "./dist/cjs/Planned.d.ts",
74
+ "default": "./dist/cjs/Planned.js"
75
+ }
76
+ },
77
+ "./internal/*": null,
78
+ "./*/index": null,
79
+ "./Effects": {
80
+ "import": {
81
+ "types": "./dist/esm/Effects.d.ts",
82
+ "default": "./dist/esm/Effects.js"
83
+ },
84
+ "require": {
85
+ "types": "./dist/cjs/Effects.d.ts",
86
+ "default": "./dist/cjs/Effects.js"
87
+ }
88
+ },
89
+ "./CachePolicy": {
90
+ "import": {
91
+ "types": "./dist/esm/CachePolicy.d.ts",
92
+ "default": "./dist/esm/CachePolicy.js"
93
+ },
94
+ "require": {
95
+ "types": "./dist/cjs/CachePolicy.d.ts",
96
+ "default": "./dist/cjs/CachePolicy.js"
97
+ }
98
+ },
99
+ "./Repetition": {
100
+ "import": {
101
+ "types": "./dist/esm/Repetition.d.ts",
102
+ "default": "./dist/esm/Repetition.js"
103
+ },
104
+ "require": {
105
+ "types": "./dist/cjs/Repetition.d.ts",
106
+ "default": "./dist/cjs/Repetition.js"
107
+ }
108
+ },
109
+ "./FileSet": {
110
+ "import": {
111
+ "types": "./dist/esm/FileSet.d.ts",
112
+ "default": "./dist/esm/FileSet.js"
113
+ },
114
+ "require": {
115
+ "types": "./dist/cjs/FileSet.d.ts",
116
+ "default": "./dist/cjs/FileSet.js"
117
+ }
118
+ },
119
+ "./KeyMaterial": {
120
+ "import": {
121
+ "types": "./dist/esm/KeyMaterial.d.ts",
122
+ "default": "./dist/esm/KeyMaterial.js"
123
+ },
124
+ "require": {
125
+ "types": "./dist/cjs/KeyMaterial.d.ts",
126
+ "default": "./dist/cjs/KeyMaterial.js"
127
+ }
128
+ },
129
+ "./Migrations": null,
130
+ "./Plan": {
131
+ "import": {
132
+ "types": "./dist/esm/Plan.d.ts",
133
+ "default": "./dist/esm/Plan.js"
134
+ },
135
+ "require": {
136
+ "types": "./dist/cjs/Plan.d.ts",
137
+ "default": "./dist/cjs/Plan.js"
138
+ }
139
+ },
140
+ "./Placement": {
141
+ "import": {
142
+ "types": "./dist/esm/Placement.d.ts",
143
+ "default": "./dist/esm/Placement.js"
144
+ },
145
+ "require": {
146
+ "types": "./dist/cjs/Placement.d.ts",
147
+ "default": "./dist/cjs/Placement.js"
148
+ }
149
+ },
150
+ "./PlanDiff": {
151
+ "import": {
152
+ "types": "./dist/esm/PlanDiff.d.ts",
153
+ "default": "./dist/esm/PlanDiff.js"
154
+ },
155
+ "require": {
156
+ "types": "./dist/cjs/PlanDiff.d.ts",
157
+ "default": "./dist/cjs/PlanDiff.js"
158
+ }
159
+ },
160
+ "./PlanStore": null,
161
+ "./StepKey": {
162
+ "import": {
163
+ "types": "./dist/esm/StepKey.d.ts",
164
+ "default": "./dist/esm/StepKey.js"
165
+ },
166
+ "require": {
167
+ "types": "./dist/cjs/StepKey.d.ts",
168
+ "default": "./dist/cjs/StepKey.js"
169
+ }
170
+ },
171
+ "./Scheduling": {
172
+ "import": {
173
+ "types": "./dist/esm/Scheduling.d.ts",
174
+ "default": "./dist/esm/Scheduling.js"
175
+ },
176
+ "require": {
177
+ "types": "./dist/cjs/Scheduling.d.ts",
178
+ "default": "./dist/cjs/Scheduling.js"
179
+ }
180
+ },
181
+ "./index": {
182
+ "import": {
183
+ "types": "./dist/esm/index.d.ts",
184
+ "default": "./dist/esm/index.js"
185
+ },
186
+ "require": {
187
+ "types": "./dist/cjs/index.d.ts",
188
+ "default": "./dist/cjs/index.js"
189
+ }
190
+ },
191
+ "./test/PlanFixtures": {
192
+ "import": {
193
+ "types": "./dist/esm/test/PlanFixtures.d.ts",
194
+ "default": "./dist/esm/test/PlanFixtures.js"
195
+ },
196
+ "require": {
197
+ "types": "./dist/cjs/test/PlanFixtures.d.ts",
198
+ "default": "./dist/cjs/test/PlanFixtures.js"
199
+ }
200
+ }
201
+ },
202
+ "files": [
203
+ "src/**/*.ts",
204
+ "dist/**/*.js",
205
+ "dist/**/*.js.map",
206
+ "dist/**/*.d.ts",
207
+ "dist/**/*.d.ts.map",
208
+ "dist/**/package.json",
209
+ "LICENSE",
210
+ "THIRD_PARTY_NOTICES.md",
211
+ "README.md",
212
+ "CHANGELOG.md",
213
+ "docs/"
214
+ ],
215
+ "publishConfig": {
216
+ "access": "public",
217
+ "provenance": true,
218
+ "tag": "next"
219
+ },
220
+ "dependencies": {
221
+ "@smthrs/crypto": "1.0.0-rc.13",
222
+ "@smthrs/keys": "1.0.0-rc.13",
223
+ "@smthrs/canonical": "1.0.0-rc.13"
224
+ },
225
+ "devDependencies": {
226
+ "@effect/language-service": "0.87.2",
227
+ "@effect/platform-node": "4.0.5",
228
+ "@effect/vitest": "4.0.5",
229
+ "@eslint/js": "9.39.5",
230
+ "@types/node": "26.4.1",
231
+ "@vitest/coverage-v8": "5.0.0",
232
+ "dprint": "0.57.1",
233
+ "effect": "4.0.5",
234
+ "esbuild": "0.28.2",
235
+ "eslint": "9.39.5",
236
+ "eslint-import-resolver-typescript": "4.4.5",
237
+ "eslint-plugin-import": "2.32.0",
238
+ "eslint-plugin-jsdoc": "64.3.4",
239
+ "eslint-plugin-unicorn": "65.0.0",
240
+ "madge": "8.0.0",
241
+ "typescript": "5.9.3",
242
+ "typescript-eslint": "8.69.0",
243
+ "vitest": "5.0.0",
244
+ "fast-check": "4.9.0"
245
+ },
246
+ "peerDependencies": {
247
+ "effect": "4.0.5"
248
+ },
249
+ "scripts": {
250
+ "lint": "eslint src --max-warnings=0 && dprint check",
251
+ "format": "dprint fmt",
252
+ "build": "node scripts/build.mjs",
253
+ "check": "tsc -b tsconfig.json && tsc -p tsconfig.test.json --noEmit",
254
+ "circular": "node scripts/circular.mjs",
255
+ "test": "vitest",
256
+ "coverage": "vitest --coverage"
257
+ }
6
258
  }