@telorun/analyzer 0.65.0 → 0.66.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 (100) hide show
  1. package/dist/analyzer.d.ts +1 -1
  2. package/dist/analyzer.d.ts.map +1 -1
  3. package/dist/analyzer.js +157 -63
  4. package/dist/call-graph.d.ts.map +1 -1
  5. package/dist/call-graph.js +7 -1
  6. package/dist/cel-environment.d.ts +12 -0
  7. package/dist/cel-environment.d.ts.map +1 -1
  8. package/dist/cel-environment.js +35 -19
  9. package/dist/cel-scope.d.ts.map +1 -1
  10. package/dist/cel-scope.js +24 -4
  11. package/dist/definition-registry.d.ts +24 -0
  12. package/dist/definition-registry.d.ts.map +1 -1
  13. package/dist/definition-registry.js +41 -0
  14. package/dist/eval-paths.d.ts +68 -0
  15. package/dist/eval-paths.d.ts.map +1 -1
  16. package/dist/eval-paths.js +138 -0
  17. package/dist/flatten-for-analyzer.d.ts +1 -1
  18. package/dist/flatten-for-analyzer.js +1 -1
  19. package/dist/import-resolution-diagnostics.d.ts +1 -1
  20. package/dist/import-resolution-diagnostics.js +1 -1
  21. package/dist/index.d.ts +9 -7
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +6 -5
  24. package/dist/manifest-visitor.d.ts.map +1 -1
  25. package/dist/manifest-visitor.js +8 -1
  26. package/dist/migrations/entries/index.d.ts.map +1 -1
  27. package/dist/migrations/entries/index.js +2 -0
  28. package/dist/migrations/entries/schema-prepare-bucket.json +27 -0
  29. package/dist/peer-binding.d.ts +232 -0
  30. package/dist/peer-binding.d.ts.map +1 -0
  31. package/dist/peer-binding.js +418 -0
  32. package/dist/ref-slot.d.ts +13 -0
  33. package/dist/ref-slot.d.ts.map +1 -1
  34. package/dist/ref-slot.js +26 -0
  35. package/dist/reference-field-map.d.ts +28 -0
  36. package/dist/reference-field-map.d.ts.map +1 -1
  37. package/dist/reference-field-map.js +25 -0
  38. package/dist/referrer-rule.d.ts +17 -0
  39. package/dist/referrer-rule.d.ts.map +1 -1
  40. package/dist/referrer-rule.js +4 -1
  41. package/dist/release/index.d.ts +1 -1
  42. package/dist/release/index.js +1 -1
  43. package/dist/resource-rule.d.ts +40 -27
  44. package/dist/resource-rule.d.ts.map +1 -1
  45. package/dist/resource-rule.js +61 -7
  46. package/dist/rule-condition.d.ts +11 -0
  47. package/dist/rule-condition.d.ts.map +1 -1
  48. package/dist/rule-condition.js +13 -0
  49. package/dist/schema-projection.d.ts +106 -4
  50. package/dist/schema-projection.d.ts.map +1 -1
  51. package/dist/schema-projection.js +206 -18
  52. package/dist/telo-version.d.ts +1 -1
  53. package/dist/telo-version.js +1 -1
  54. package/dist/validate-cel-context.d.ts +1 -17
  55. package/dist/validate-cel-context.d.ts.map +1 -1
  56. package/dist/validate-cel-context.js +5 -70
  57. package/dist/validate-reference-forms.d.ts +10 -0
  58. package/dist/validate-reference-forms.d.ts.map +1 -1
  59. package/dist/validate-reference-forms.js +23 -0
  60. package/dist/validate-references.d.ts.map +1 -1
  61. package/dist/validate-references.js +9 -2
  62. package/dist/validate-referrer-rules.d.ts +38 -4
  63. package/dist/validate-referrer-rules.d.ts.map +1 -1
  64. package/dist/validate-referrer-rules.js +139 -31
  65. package/dist/validate-resource-rules.d.ts +11 -2
  66. package/dist/validate-resource-rules.d.ts.map +1 -1
  67. package/dist/validate-resource-rules.js +18 -12
  68. package/dist/validate-schema-projection.d.ts.map +1 -1
  69. package/dist/validate-schema-projection.js +33 -2
  70. package/dist/with-synthetic-positions.d.ts +1 -1
  71. package/dist/with-synthetic-positions.js +1 -1
  72. package/package.json +3 -3
  73. package/src/analyzer.ts +191 -68
  74. package/src/call-graph.ts +7 -1
  75. package/src/cel-environment.ts +48 -19
  76. package/src/cel-scope.ts +24 -6
  77. package/src/definition-registry.ts +42 -0
  78. package/src/eval-paths.ts +152 -0
  79. package/src/flatten-for-analyzer.ts +1 -1
  80. package/src/import-resolution-diagnostics.ts +1 -1
  81. package/src/index.ts +45 -4
  82. package/src/manifest-visitor.ts +8 -1
  83. package/src/migrations/entries/index.ts +2 -0
  84. package/src/migrations/entries/schema-prepare-bucket.json +27 -0
  85. package/src/peer-binding.ts +641 -0
  86. package/src/ref-slot.ts +36 -0
  87. package/src/reference-field-map.ts +42 -0
  88. package/src/referrer-rule.ts +20 -1
  89. package/src/release/index.ts +1 -1
  90. package/src/resource-rule.ts +69 -7
  91. package/src/rule-condition.ts +15 -0
  92. package/src/schema-projection.ts +283 -20
  93. package/src/telo-version.ts +1 -1
  94. package/src/validate-cel-context.ts +6 -71
  95. package/src/validate-reference-forms.ts +22 -0
  96. package/src/validate-references.ts +15 -2
  97. package/src/validate-referrer-rules.ts +215 -28
  98. package/src/validate-resource-rules.ts +26 -12
  99. package/src/validate-schema-projection.ts +50 -1
  100. package/src/with-synthetic-positions.ts +1 -1
@@ -41,6 +41,9 @@ export class DefinitionRegistry {
41
41
  private readonly fieldMaps = new Map<string, ReferenceFieldMap>();
42
42
  /** Reverse inheritance index: parent kind → direct child kinds. */
43
43
  private readonly extendedBy = new Map<string, string[]>();
44
+ /** Memoized inheritance-resolved schemas. `null` records "resolved to
45
+ * nothing", so a kind with no schema is not re-walked on every resource. */
46
+ private readonly effectiveSchemas = new Map<string, Record<string, unknown> | null>();
44
47
  /** DEPRECATED module identity table: identity string → canonical module name
45
48
  * ("std/pipeline" → "pipeline"). Serves only the legacy
46
49
  * `<namespace>/<module>#<Kind>` form of `x-telo-ref`, kept resolvable for
@@ -57,6 +60,7 @@ export class DefinitionRegistry {
57
60
  // so any already-computed map recomputes against the now-larger def set; the
58
61
  // maps rebuild lazily on first `getFieldMap` (after all defs are registered).
59
62
  this.fieldMaps.clear();
63
+ this.effectiveSchemas.clear();
60
64
  // `capability` populates extendedBy for backward-compat with the legacy pattern where
61
65
  // a concrete definition overloaded `capability: <AbstractKind>` to mean "implements
62
66
  // this abstract." The canonical pattern is `extends` (below). Both populate the index,
@@ -285,6 +289,44 @@ export class DefinitionRegistry {
285
289
  return this.defs.get(kind);
286
290
  }
287
291
 
292
+ /**
293
+ * The kind's AUTHOR-FACING schema — its own merged with everything it
294
+ * inherits along `extends` — memoized per kind.
295
+ *
296
+ * This is what every consumer reading a kind's schema to interpret an
297
+ * INSTANCE must use, because that is the schema the instance was authored
298
+ * against and the one the kernel stamps at definition registration. Reading
299
+ * `resolve(kind).schema` instead sees only what the leaf declared, so an
300
+ * annotation on a parent — a CEL context region, a step body, an error
301
+ * context — is invisible on every child, silently and per consumer. Sharing
302
+ * one memo is what keeps those consumers from drifting apart.
303
+ *
304
+ * Lazy for the same reason `getFieldMap` is: a child registered before its
305
+ * parent still sees the inherited half once both are present.
306
+ */
307
+ effectiveSchema(kind: string): Record<string, unknown> | undefined {
308
+ const cached = this.effectiveSchemas.get(kind);
309
+ if (cached !== undefined) return cached ?? undefined;
310
+ const def = this.defs.get(kind);
311
+ if (!def) return undefined;
312
+ const schema = effectiveAuthorSchema(def, (k) => this.resolve(k)) as
313
+ | Record<string, unknown>
314
+ | undefined;
315
+ this.effectiveSchemas.set(kind, schema ?? null);
316
+ return schema;
317
+ }
318
+
319
+ /** The effective schema for a definition, by the kind it is registered under.
320
+ * Falls back to the definition's own schema when it is not in this registry
321
+ * (a synthesized or not-yet-registered kind), which is the pre-inheritance
322
+ * behaviour and the safe direction: it types less, never wrongly. */
323
+ effectiveSchemaOf(definition: ResourceDefinition | undefined): Record<string, unknown> | undefined {
324
+ if (!definition) return undefined;
325
+ const { name, module: mod } = definition.metadata;
326
+ const resolved = this.effectiveSchema(mod ? `${mod}.${name}` : name);
327
+ return resolved ?? (definition.schema as Record<string, unknown> | undefined);
328
+ }
329
+
288
330
  /** Returns the reference field map for the given kind, computed lazily from the
289
331
  * kind's AUTHOR-FACING (inheritance-resolved) schema and memoized. Lazy so a
290
332
  * child registered before its parent still sees the parent's inherited ref
package/src/eval-paths.ts CHANGED
@@ -1,3 +1,27 @@
1
+ /**
2
+ * WHERE IS CEL EVALUATED — the one reader, and the one decision built on it.
3
+ *
4
+ * Two independent ways a value is evaluated, and every consumer needs both:
5
+ * `x-telo-eval` names a field directly, while a REGION annotation
6
+ * (`x-telo-context` / `x-telo-step-context` / `x-telo-error-context`, or a step
7
+ * body) covers everything beneath it — which is how `Run.Choice`'s rows and an
8
+ * `Http.Api` route's `returns:` entries hold expressions while declaring no
9
+ * annotation of their own.
10
+ *
11
+ * The consumers are on both sides of the runtime: `telo check` decides whether a
12
+ * `!cel` here is live (`CEL_IN_NON_EVAL_FIELD`) or resolved at startup
13
+ * (`OBSERVED_STATE_IN_STARTUP_FIELD`), the kernel decides what to expand, and
14
+ * the editor decides whether to offer an expression at all. The editor's answer
15
+ * is a CLAIM that `telo check` will accept what it writes, so a second
16
+ * implementation there is a promise nothing keeps — it read `x-telo-eval` alone
17
+ * and left every predicate inside a region as a bare checkbox, with no way to
18
+ * write the expression the field exists to hold.
19
+ *
20
+ * Browser-safe: no Node built-ins.
21
+ */
22
+
23
+ import { isStepSlot } from "./step-slot.js";
24
+
1
25
  /**
2
26
  * The single containment rule for `x-telo-eval` paths, shared by every matcher so
3
27
  * the analyzer's coverage decision and the kernel's expansion/exclusion can't
@@ -66,3 +90,131 @@ function collectEvalPathsNode(
66
90
  }
67
91
  }
68
92
  }
93
+
94
+ /** Schema keys that declare a CEL-bearing region: a field carrying any of these
95
+ * is evaluated at runtime, so a `!cel` inside it (or a descendant) is live. A
96
+ * STEP BODY is one too, and says so through the grammar its items point at
97
+ * rather than through a key — {@link isStepSlot} reads either spelling. */
98
+ const CEL_REGION_KEYS = [
99
+ "x-telo-context",
100
+ "x-telo-step-context",
101
+ "x-telo-error-context",
102
+ ] as const;
103
+
104
+ /** True when this schema node declares a CEL-bearing region. Node-level, so a
105
+ * consumer holding one schema (an editor rendering one field) asks it directly
106
+ * rather than deriving scopes it would then have to match against. */
107
+ export function declaresCelRegion(schema: unknown): boolean {
108
+ if (!schema || typeof schema !== "object") return false;
109
+ const node = schema as Record<string, unknown>;
110
+ return CEL_REGION_KEYS.some((key) => node[key] !== undefined) || isStepSlot(node);
111
+ }
112
+
113
+ /**
114
+ * Walk a JSON Schema tree and collect the JSONPath scopes of every field that
115
+ * declares a CEL-bearing region (`x-telo-context` / `x-telo-step-context` /
116
+ * `x-telo-error-context`). Used — alongside `x-telo-eval` paths — to decide
117
+ * whether a `!cel` expression sits in a slot the runtime actually evaluates.
118
+ * Scopes use the same `$.a.b[*]` form as `extractContextsFromSchema`, matched
119
+ * against expression paths with `pathMatchesScope`.
120
+ */
121
+ export function extractCelRegionScopes(schema: Record<string, any>, path = "$"): string[] {
122
+ if (!schema || typeof schema !== "object") return [];
123
+ const out: string[] = [];
124
+
125
+ if (declaresCelRegion(schema)) out.push(path);
126
+
127
+ if (schema.properties) {
128
+ for (const [key, value] of Object.entries(schema.properties as Record<string, any>)) {
129
+ out.push(...extractCelRegionScopes(value, `${path}.${key}`));
130
+ }
131
+ }
132
+ if (schema.items && typeof schema.items === "object") {
133
+ out.push(...extractCelRegionScopes(schema.items, `${path}[*]`));
134
+ }
135
+ for (const key of ["oneOf", "anyOf", "allOf"] as const) {
136
+ if (Array.isArray(schema[key])) {
137
+ for (const subschema of schema[key]) out.push(...extractCelRegionScopes(subschema, path));
138
+ }
139
+ }
140
+
141
+ return out;
142
+ }
143
+
144
+ /**
145
+ * Returns true when a CEL expression path (from walkCelExpressions, e.g. "routes[0].inputs.q")
146
+ * falls within the scope of a context (e.g. "$.routes[*].inputs").
147
+ *
148
+ * The scope is matched directly (no sibling sharing): a context at "$.routes[*].inputs" only
149
+ * applies to expressions whose path starts with "routes[N].inputs", not to other sibling fields.
150
+ */
151
+ export function pathMatchesScope(exprPath: string, scope: string): boolean {
152
+ const stripped = scope.startsWith("$.") ? scope.slice(2) : scope;
153
+ if (!stripped) return false;
154
+
155
+ // Split on wildcard array segments; each [*] must match a concrete [N] in exprPath
156
+ const parts = stripped.split("[*]");
157
+ let remaining = exprPath;
158
+ for (let i = 0; i < parts.length; i++) {
159
+ const part = parts[i]!;
160
+ if (!remaining.startsWith(part)) return false;
161
+ remaining = remaining.slice(part.length);
162
+ if (i < parts.length - 1) {
163
+ // Expect a concrete array index like [0], [12], ...
164
+ const m = remaining.match(/^\[\d+\]/);
165
+ if (!m) return false;
166
+ remaining = remaining.slice(m[0].length);
167
+ }
168
+ }
169
+ // Expression must end here or continue into a child path
170
+ return remaining === "" || remaining[0] === "." || remaining[0] === "[";
171
+ }
172
+
173
+ /** Every place a schema says its values are evaluated: the `x-telo-eval` paths,
174
+ * by mode, plus the scopes of the regions that cover their contents. */
175
+ export interface CelEvalSites {
176
+ compile: readonly string[];
177
+ runtime: readonly string[];
178
+ regions: readonly string[];
179
+ }
180
+
181
+ export const NO_CEL_EVAL_SITES: CelEvalSites = { compile: [], runtime: [], regions: [] };
182
+
183
+ export function celEvalSites(schema: Record<string, any> | undefined): CelEvalSites {
184
+ if (!schema) return NO_CEL_EVAL_SITES;
185
+ const { compile, runtime } = buildEvalPaths(schema);
186
+ return { compile, runtime, regions: extractCelRegionScopes(schema) };
187
+ }
188
+
189
+ /** The union of several schemas' sites — a kind's own and its capability
190
+ * abstract's, which is how a `Telo.Provider`'s implicit compile-eval reaches
191
+ * fields the provider never annotated. */
192
+ export function mergeCelEvalSites(...sites: CelEvalSites[]): CelEvalSites {
193
+ return {
194
+ compile: sites.flatMap((s) => s.compile),
195
+ runtime: sites.flatMap((s) => s.runtime),
196
+ regions: sites.flatMap((s) => s.regions),
197
+ };
198
+ }
199
+
200
+ /**
201
+ * Whether the value at `path` is evaluated, and when — null for a field whose
202
+ * value is read as a literal.
203
+ *
204
+ * `compile` wins over `runtime`, and both win over a region: a field's own
205
+ * annotation is more specific than the region it sits in, which is the same
206
+ * precedence a nested annotation has over an enclosing one. A region resolves to
207
+ * `runtime` because that is what a region IS — a per-invocation scope naming
208
+ * what its expressions can read.
209
+ *
210
+ * `path` is the `walkCelExpressions` spelling (`routes[0].returns[1].when`).
211
+ */
212
+ export function celEvalModeAt(
213
+ sites: CelEvalSites,
214
+ path: string,
215
+ ): "compile" | "runtime" | null {
216
+ if (evalPathsCover(sites.compile, path)) return "compile";
217
+ if (evalPathsCover(sites.runtime, path)) return "runtime";
218
+ if (sites.regions.some((scope) => pathMatchesScope(path, scope))) return "runtime";
219
+ return null;
220
+ }
@@ -23,7 +23,7 @@ export function parseExportEntry(entry: string): ParsedExportEntry {
23
23
  }
24
24
 
25
25
  /** The import-boundary forwarding rule, shared by `flattenForAnalyzer` (the
26
- * CLI / kernel loader path) and the telo-editor's workspace projection so the
26
+ * CLI / kernel loader path) and telo studio's workspace projection so the
27
27
  * two cannot drift. Given one module's stamped manifests and whether that
28
28
  * module is the analysis entry (root), returns the manifests that cross into
29
29
  * the consumer's flat analysis list:
@@ -46,7 +46,7 @@ function messageFor(e: GraphLoadError, code: ReturnType<typeof classify>): strin
46
46
  /**
47
47
  * Convert a graph's import failures (`graph.errors`) into structured, coded
48
48
  * diagnostics. This is the single source of truth for surfacing a broken
49
- * import — every host (CLI, VS Code, telo-editor) routes these instead of each
49
+ * import — every host (CLI, VS Code, telo studio) routes these instead of each
50
50
  * re-deriving the channel and drifting (the VS Code extension used to drop it
51
51
  * entirely, showing nothing for a broken import).
52
52
  *
package/src/index.ts CHANGED
@@ -24,7 +24,16 @@ export {
24
24
  type ParsedExportEntry,
25
25
  type ReExportSpec,
26
26
  } from "./flatten-for-analyzer.js";
27
- export { buildEvalPaths, evalPathCovers } from "./eval-paths.js";
27
+ export {
28
+ buildEvalPaths,
29
+ celEvalModeAt,
30
+ celEvalSites,
31
+ declaresCelRegion,
32
+ evalPathCovers,
33
+ mergeCelEvalSites,
34
+ NO_CEL_EVAL_SITES,
35
+ } from "./eval-paths.js";
36
+ export type { CelEvalSites } from "./eval-paths.js";
28
37
  export {
29
38
  BINDINGS_ANNOTATION,
30
39
  bindingContextProperties,
@@ -96,8 +105,17 @@ export type {
96
105
  ResourceGraphNode,
97
106
  StepGraphNode,
98
107
  } from "./call-graph.js";
99
- export { buildReferenceFieldMap, isRefEntry, isScopeEntry } from "./reference-field-map.js";
100
- export type { ReferenceFieldMap, RefFieldEntry } from "./reference-field-map.js";
108
+ export {
109
+ buildReferenceFieldMap,
110
+ isRefEntry,
111
+ isScopeEntry,
112
+ satisfiesValueBranch,
113
+ } from "./reference-field-map.js";
114
+ export type {
115
+ ReferenceFieldMap,
116
+ RefFieldEntry,
117
+ ValueBranchValidator,
118
+ } from "./reference-field-map.js";
101
119
  export {
102
120
  hasDeclaredUse,
103
121
  isRefSlot,
@@ -181,6 +199,8 @@ export {
181
199
  readRawResourceRules,
182
200
  resolveRuleSubjects,
183
201
  findDynamicLeaf,
202
+ dynamicNode,
203
+ type DynamicLeaf,
184
204
  type ResourceRule,
185
205
  type ResourceRuleSeverity,
186
206
  type RuleSubject,
@@ -211,11 +231,32 @@ export {
211
231
  type ReferrerRuleIssue,
212
232
  type ReferrerRuleFinding,
213
233
  type ReferrerRuleDiagnostic,
234
+ type ReferrerRuleContext,
235
+ type ReferrerRuleDeclarationContext,
214
236
  } from "./validate-referrer-rules.js";
215
- export { RULE_BUDGET_MS } from "./rule-condition.js";
237
+ export {
238
+ PeerBinder,
239
+ analyzerPeerBinder,
240
+ analyzerPeersTarget,
241
+ entryBoundary,
242
+ navigatePath,
243
+ referenceValueOf,
244
+ shapeMatches,
245
+ type DeclarationLookup,
246
+ type PeerAliasScope,
247
+ type PeerBinderEnv,
248
+ type PeerBinderRegistry,
249
+ type PeerBinding,
250
+ type PeerBindingFailure,
251
+ type PeerBindingResult,
252
+ type PeersTarget,
253
+ } from "./peer-binding.js";
254
+ export { RULE_BUDGET_MS, UNTAGGED_CONDITION } from "./rule-condition.js";
216
255
  export {
217
256
  readSchemaProjection,
257
+ type ProjectionReference,
218
258
  readSchemaMap,
259
+ schemaMapBranch,
219
260
  readProjectionFrom,
220
261
  readProjectionRef,
221
262
  manifestListScope,
@@ -359,7 +359,14 @@ export function visitManifest(
359
359
  }
360
360
 
361
361
  if (wantsCel) {
362
- const contexts = definition?.schema ? extractContextsFromSchema(definition.schema) : [];
362
+ // The INHERITANCE-RESOLVED schema: an `extends` child is authored against
363
+ // merge(parent, own), so a context region the parent declares is in force
364
+ // on the child. Reading the child's own schema typed the region on
365
+ // whichever kind happened to declare it and left every descendant's
366
+ // expressions unchecked — silently, which for a typing rule means the
367
+ // check simply stops existing.
368
+ const authorSchema = registry.effectiveSchemaOf(definition);
369
+ const contexts = authorSchema ? extractContextsFromSchema(authorSchema) : [];
363
370
  walkCelExpressions(r, "", (expr, path, engineName, surface) => {
364
371
  let contextSchema: Record<string, any> | undefined;
365
372
  let matchedScope: string | undefined;
@@ -2,9 +2,11 @@
2
2
  // Source: analyzer/migrations/*.json (lexically ordered).
3
3
  import e0 from "./normalize-value-types.json" with { type: "json" };
4
4
  import e1 from "./ref-slot-scalar-type.json" with { type: "json" };
5
+ import e2 from "./schema-prepare-bucket.json" with { type: "json" };
5
6
 
6
7
  /** Every entry file, in the order the driver applies them. */
7
8
  export const MIGRATION_ENTRY_FILES: ReadonlyArray<readonly [file: string, data: unknown]> = [
8
9
  ["normalize-value-types.json", e0],
9
10
  ["ref-slot-scalar-type.json", e1],
11
+ ["schema-prepare-bucket.json", e2],
10
12
  ];
@@ -0,0 +1,27 @@
1
+ {
2
+ "$comment": "`inKind` names the two backend schema kinds by their canonical `<module>.<Kind>` spelling, which is what a document's `kind:` carries after alias resolution. `under` is the key itself: the bucket is a top-level field of the resource, so the region and the match are the same node \u2014 the tightest containment this vocabulary can state. NAMING A MODULE'S KIND FROM A CORE ENTRY IS A DEBT, not a pattern: it is the one place the analyzer knows a standard-library kind by name. It is contained because `inKind` is a filter \u2014 an entry naming an absent kind matches nothing \u2014 and it MOVES into `modules/postgres` and `modules/sqlite` when the module-migration surface lands. Do not add another; see analyzer/migrations/README.md.",
3
+ "id": "schema-prepare-bucket",
4
+ "code": "SQL_BEFORE_MIGRATIONS_RENAMED",
5
+ "severity": "warning",
6
+ "reason": "`beforeMigrations:` is now `prepare:`. Every documented use of it was data preparation for a narrowing the reconciliation pass is about to attempt \u2014 backfill before NOT NULL, make values fit before a length reduction, convert before a non-widening type change \u2014 and each is what a refusal already tells the author to write. The old name said where it ran relative to the OTHER bucket; the new one says what it is for, which is what those refusals need to name. Nothing re-runs: the ledger stores the migration key alone, so moving an entry between the two maps changes no history.",
7
+ "rules": [
8
+ {
9
+ "match": {
10
+ "key": "beforeMigrations",
11
+ "inKind": [
12
+ "Postgres.Schema",
13
+ "SQLite.Schema"
14
+ ],
15
+ "under": [
16
+ "beforeMigrations"
17
+ ]
18
+ },
19
+ "patch": [
20
+ {
21
+ "op": "rename-key",
22
+ "to": "prepare"
23
+ }
24
+ ]
25
+ }
26
+ ]
27
+ }