@mmnto/totem 1.78.0 → 1.80.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 (64) hide show
  1. package/dist/artifacts/panel.d.ts +48 -48
  2. package/dist/artifacts/schema.d.ts +40 -40
  3. package/dist/compiler-schema.d.ts +2455 -35
  4. package/dist/compiler-schema.d.ts.map +1 -1
  5. package/dist/compiler-schema.js +229 -1
  6. package/dist/compiler-schema.js.map +1 -1
  7. package/dist/compiler-schema.test.js +249 -2
  8. package/dist/compiler-schema.test.js.map +1 -1
  9. package/dist/compiler.d.ts +2 -2
  10. package/dist/compiler.d.ts.map +1 -1
  11. package/dist/compiler.js +1 -1
  12. package/dist/compiler.js.map +1 -1
  13. package/dist/config-schema.d.ts +6 -6
  14. package/dist/index.d.ts +10 -4
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +4 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/spine/authored-rule.d.ts +1358 -0
  19. package/dist/spine/authored-rule.d.ts.map +1 -0
  20. package/dist/spine/authored-rule.js +313 -0
  21. package/dist/spine/authored-rule.js.map +1 -0
  22. package/dist/spine/authored-rule.test.d.ts +2 -0
  23. package/dist/spine/authored-rule.test.d.ts.map +1 -0
  24. package/dist/spine/authored-rule.test.js +226 -0
  25. package/dist/spine/authored-rule.test.js.map +1 -0
  26. package/dist/spine/authoring-ledger.d.ts +204 -0
  27. package/dist/spine/authoring-ledger.d.ts.map +1 -0
  28. package/dist/spine/authoring-ledger.js +220 -0
  29. package/dist/spine/authoring-ledger.js.map +1 -0
  30. package/dist/spine/authoring-ledger.test.d.ts +2 -0
  31. package/dist/spine/authoring-ledger.test.d.ts.map +1 -0
  32. package/dist/spine/authoring-ledger.test.js +144 -0
  33. package/dist/spine/authoring-ledger.test.js.map +1 -0
  34. package/dist/spine/candidate-rule.d.ts +32 -0
  35. package/dist/spine/candidate-rule.d.ts.map +1 -1
  36. package/dist/spine/candidate-rule.js +2 -2
  37. package/dist/spine/candidate-rule.js.map +1 -1
  38. package/dist/spine/classify.d.ts +5 -5
  39. package/dist/spine/compile.d.ts +16 -4
  40. package/dist/spine/compile.d.ts.map +1 -1
  41. package/dist/spine/compile.js +23 -0
  42. package/dist/spine/compile.js.map +1 -1
  43. package/dist/spine/compile.test.js +72 -0
  44. package/dist/spine/compile.test.js.map +1 -1
  45. package/dist/spine/corpus-dispositions.d.ts +22 -22
  46. package/dist/spine/extract.d.ts +2 -2
  47. package/dist/spine/extract.d.ts.map +1 -1
  48. package/dist/spine/extract.js +5 -4
  49. package/dist/spine/extract.js.map +1 -1
  50. package/dist/spine/ledgers.d.ts +46 -21
  51. package/dist/spine/ledgers.d.ts.map +1 -1
  52. package/dist/spine/ledgers.js +16 -8
  53. package/dist/spine/ledgers.js.map +1 -1
  54. package/dist/spine/rule-policy.d.ts +27 -0
  55. package/dist/spine/rule-policy.d.ts.map +1 -0
  56. package/dist/spine/rule-policy.js +43 -0
  57. package/dist/spine/rule-policy.js.map +1 -0
  58. package/dist/spine/rule-policy.test.d.ts +2 -0
  59. package/dist/spine/rule-policy.test.d.ts.map +1 -0
  60. package/dist/spine/rule-policy.test.js +31 -0
  61. package/dist/spine/rule-policy.test.js.map +1 -0
  62. package/dist/spine/windtunnel-lock.d.ts +14 -14
  63. package/dist/store/lance-schema.d.ts +2 -2
  64. package/package.json +1 -1
@@ -36,6 +36,15 @@ export declare const AstGrepYamlRuleSchema: z.ZodObject<{
36
36
  rule: z.ZodRecord<z.ZodString, z.ZodUnknown>;
37
37
  }, z.ZodTypeAny, "passthrough">>;
38
38
  export type AstGrepYamlRule = NapiConfig;
39
+ /**
40
+ * True iff `s` is a well-formed ISO-8601 date/timestamp AND a REAL calendar date.
41
+ * `Date.parse` alone is insufficient: it NORMALIZES day-overflow (`2026-02-31` → Mar 3,
42
+ * `2026-02-29` non-leap → Mar 1) instead of rejecting it (#2259 CR re-review). The
43
+ * `Date.UTC` round-trip validates the date HEAD's calendar independently of any timezone
44
+ * in the time component — a negative offset can legitimately shift the UTC day, so the
45
+ * head, not the parsed instant, is what must round-trip.
46
+ */
47
+ export declare function isIso8601CalendarDate(s: string): boolean;
39
48
  /**
40
49
  * mmnto-ai/totem#2183 — the §3.1 provenance leg of the ADR-110 Gate-1
41
50
  * legitimacy bar: the identity of the merged-PR history a regenerated rule was
@@ -45,8 +54,25 @@ export type AstGrepYamlRule = NapiConfig;
45
54
  * zero-trust), the single source of truth `deriveRuleClass` reads. Control
46
55
  * *evidence* (which PRs/fixtures proved each control) rides the wind-tunnel
47
56
  * manifest (ADR-110 §6), not the per-rule marker.
57
+ *
58
+ * **ADR-112 — this is the MINED variant of the `ProvenanceRecord` union.** The
59
+ * wire shape is otherwise UNCHANGED: `kind` is OPTIONAL and absent on every
60
+ * pre-ADR-112 record, so a legacy mined provenance parses + reserializes
61
+ * BYTE-IDENTICAL (no added key — `canonicalStringify` omits the undefined
62
+ * discriminator exactly as it omits an absent `unverified`), preserving the
63
+ * non-mutating-refine manifest-hash discipline. Absence ⇒ `'mined'` via
64
+ * `provenanceKind()`; the miner path types its provenance as
65
+ * `MinedProvenanceRecord` (the documented mining-only boundary), so its readers
66
+ * of `mergedPr` / `commitSha` stay type-safe without narrowing.
48
67
  */
49
- export declare const ProvenanceRecordSchema: z.ZodObject<{
68
+ export declare const MinedProvenanceWireSchema: z.ZodObject<{
69
+ /**
70
+ * ADR-112 discriminator. OPTIONAL on the mined wire so legacy records (which
71
+ * have no `kind`) round-trip byte-identical; absence is read as `'mined'` by
72
+ * `provenanceKind()`. A new mined artifact MAY carry `kind: 'mined'` only
73
+ * where the resulting hash churn is intentional.
74
+ */
75
+ kind: z.ZodOptional<z.ZodLiteral<"mined">>;
50
76
  /** Merged PR the rule was mined from (positive integer PR number). */
51
77
  mergedPr: z.ZodNumber;
52
78
  /**
@@ -64,12 +90,865 @@ export declare const ProvenanceRecordSchema: z.ZodObject<{
64
90
  mergedPr: number;
65
91
  reviewThread: string;
66
92
  commitSha: string;
93
+ kind?: "mined" | undefined;
67
94
  }, {
68
95
  mergedPr: number;
69
96
  reviewThread: string;
70
97
  commitSha: string;
98
+ kind?: "mined" | undefined;
71
99
  }>;
100
+ export type MinedProvenanceRecord = z.infer<typeof MinedProvenanceWireSchema>;
101
+ /**
102
+ * ADR-112 §4 — the preimage-differential SOURCE for one fixture, a discriminated
103
+ * union on `kind` (declared PER FIXTURE; not a fixed binding to landed commits).
104
+ * The materializer (slice C/D) fires the matcher on the preimage and asserts it
105
+ * is SILENT on the postimage — a matcher that fires only on the fixed form is
106
+ * fix-shaped and is NOT a legitimate positive control (FM(i)):
107
+ * - `lesson` (PRIMARY, review-caught repos): the lesson corpus' `badExample`
108
+ * (preimage — fire) / `goodExample` (postimage — silent). `lessonRef` is an
109
+ * IMMUTABLE lesson id/hash (the `hashLesson` codomain, `LESSON_REF_RE`),
110
+ * never a path/mutable alias (§8 identity discipline).
111
+ * - `commit` (FALLBACK, land-then-fix repos): the pre-fix parent
112
+ * (`preimageCommitSha` — fire) / post-fix merge (`mergeCommitSha` — silent).
113
+ *
114
+ * `z.discriminatedUnion` (not `z.union`): both branches carry a REQUIRED literal
115
+ * `kind`, so Zod routes a parse error to the matched branch instead of emitting
116
+ * "no union member matched" noise (cf. `cert-corpus-seed.ts`'s `window`). The
117
+ * OPTIONAL-discriminator round-trip reason `ProvenanceRecordSchema` documents for
118
+ * its `z.union` does NOT apply — `preimageSource` is a new field with no persisted
119
+ * authored set. Each branch is `.strict()` so a cross-branch key (e.g. a
120
+ * `badExample` under `kind:'commit'`) fails LOUD (FM(d) posture) rather than being
121
+ * silently stripped. All refines are NON-mutating (no `.trim()`) to preserve the
122
+ * manifest-hash stability discipline.
123
+ */
124
+ export declare const PreimageSourceSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
125
+ kind: z.ZodLiteral<"lesson">;
126
+ /** IMMUTABLE lesson id/hash (the 16-hex `hashLesson` codomain) — never a path/mutable alias (§4/§8). */
127
+ lessonRef: z.ZodString;
128
+ /**
129
+ * The defect PREIMAGE exemplar the matcher must FIRE on (§4). This is a lesson
130
+ * corpus `badExample` — distinct from `CompiledRuleBaseSchema.badExample` (an
131
+ * optional human-readable code snippet on a compiled rule); here it is the
132
+ * load-bearing positive-control preimage, so non-empty is required.
133
+ */
134
+ badExample: z.ZodEffects<z.ZodString, string, string>;
135
+ /** The fixed POSTIMAGE exemplar the matcher must stay SILENT on (§4) — a lesson `goodExample`. */
136
+ goodExample: z.ZodEffects<z.ZodString, string, string>;
137
+ }, "strict", z.ZodTypeAny, {
138
+ kind: "lesson";
139
+ lessonRef: string;
140
+ badExample: string;
141
+ goodExample: string;
142
+ }, {
143
+ kind: "lesson";
144
+ lessonRef: string;
145
+ badExample: string;
146
+ goodExample: string;
147
+ }>, z.ZodObject<{
148
+ kind: z.ZodLiteral<"commit">;
149
+ /** The PARENT (pre-fix) commit where the DEFECT is present — the matcher must FIRE on this (ADR-112 §4). */
150
+ preimageCommitSha: z.ZodString;
151
+ /** The PR's merge/squash commit — the post-fix (defect-absent) anchor; the matcher must stay SILENT on this. */
152
+ mergeCommitSha: z.ZodString;
153
+ }, "strict", z.ZodTypeAny, {
154
+ kind: "commit";
155
+ preimageCommitSha: string;
156
+ mergeCommitSha: string;
157
+ }, {
158
+ kind: "commit";
159
+ preimageCommitSha: string;
160
+ mergeCommitSha: string;
161
+ }>]>;
162
+ export type PreimageSource = z.infer<typeof PreimageSourceSchema>;
163
+ /**
164
+ * ADR-112 §3 — one real lc instance an authored rule claims to catch. ALL such
165
+ * fixtures are TRAIN-side (the §5 leakage guard); the preimage-differential
166
+ * (§4) is evaluated in slice C/D, but the record CARRIES the declared
167
+ * `preimageSource` (lesson | commit) + the defect locus here so derivation is
168
+ * possible. `matchedSpan` + `contentHash` are the line-drift-stable locus
169
+ * (cf. `firingLabelId`), not just the file.
170
+ */
171
+ export declare const AuthoredFixtureSchema: z.ZodEffects<z.ZodObject<{
172
+ /** The PR where the defect was caught/introduced (the in-corpus anchor). */
173
+ pr: z.ZodNumber;
174
+ /** The §4 preimage-differential source — lesson-anchored (PRIMARY) or commit-pair (FALLBACK). */
175
+ preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
176
+ kind: z.ZodLiteral<"lesson">;
177
+ /** IMMUTABLE lesson id/hash (the 16-hex `hashLesson` codomain) — never a path/mutable alias (§4/§8). */
178
+ lessonRef: z.ZodString;
179
+ /**
180
+ * The defect PREIMAGE exemplar the matcher must FIRE on (§4). This is a lesson
181
+ * corpus `badExample` — distinct from `CompiledRuleBaseSchema.badExample` (an
182
+ * optional human-readable code snippet on a compiled rule); here it is the
183
+ * load-bearing positive-control preimage, so non-empty is required.
184
+ */
185
+ badExample: z.ZodEffects<z.ZodString, string, string>;
186
+ /** The fixed POSTIMAGE exemplar the matcher must stay SILENT on (§4) — a lesson `goodExample`. */
187
+ goodExample: z.ZodEffects<z.ZodString, string, string>;
188
+ }, "strict", z.ZodTypeAny, {
189
+ kind: "lesson";
190
+ lessonRef: string;
191
+ badExample: string;
192
+ goodExample: string;
193
+ }, {
194
+ kind: "lesson";
195
+ lessonRef: string;
196
+ badExample: string;
197
+ goodExample: string;
198
+ }>, z.ZodObject<{
199
+ kind: z.ZodLiteral<"commit">;
200
+ /** The PARENT (pre-fix) commit where the DEFECT is present — the matcher must FIRE on this (ADR-112 §4). */
201
+ preimageCommitSha: z.ZodString;
202
+ /** The PR's merge/squash commit — the post-fix (defect-absent) anchor; the matcher must stay SILENT on this. */
203
+ mergeCommitSha: z.ZodString;
204
+ }, "strict", z.ZodTypeAny, {
205
+ kind: "commit";
206
+ preimageCommitSha: string;
207
+ mergeCommitSha: string;
208
+ }, {
209
+ kind: "commit";
210
+ preimageCommitSha: string;
211
+ mergeCommitSha: string;
212
+ }>]>;
213
+ /** File the defect locus lives in. */
214
+ filePath: z.ZodEffects<z.ZodString, string, string>;
215
+ /** Line-range or AST-node path — the defect locus, not just the file. */
216
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
217
+ /** Span content hash, line-drift-stable (cf. `firingLabelId`). */
218
+ contentHash: z.ZodEffects<z.ZodString, string, string>;
219
+ }, "strict", z.ZodTypeAny, {
220
+ pr: number;
221
+ preimageSource: {
222
+ kind: "lesson";
223
+ lessonRef: string;
224
+ badExample: string;
225
+ goodExample: string;
226
+ } | {
227
+ kind: "commit";
228
+ preimageCommitSha: string;
229
+ mergeCommitSha: string;
230
+ };
231
+ filePath: string;
232
+ matchedSpan: string;
233
+ contentHash: string;
234
+ }, {
235
+ pr: number;
236
+ preimageSource: {
237
+ kind: "lesson";
238
+ lessonRef: string;
239
+ badExample: string;
240
+ goodExample: string;
241
+ } | {
242
+ kind: "commit";
243
+ preimageCommitSha: string;
244
+ mergeCommitSha: string;
245
+ };
246
+ filePath: string;
247
+ matchedSpan: string;
248
+ contentHash: string;
249
+ }>, {
250
+ pr: number;
251
+ preimageSource: {
252
+ kind: "lesson";
253
+ lessonRef: string;
254
+ badExample: string;
255
+ goodExample: string;
256
+ } | {
257
+ kind: "commit";
258
+ preimageCommitSha: string;
259
+ mergeCommitSha: string;
260
+ };
261
+ filePath: string;
262
+ matchedSpan: string;
263
+ contentHash: string;
264
+ }, {
265
+ pr: number;
266
+ preimageSource: {
267
+ kind: "lesson";
268
+ lessonRef: string;
269
+ badExample: string;
270
+ goodExample: string;
271
+ } | {
272
+ kind: "commit";
273
+ preimageCommitSha: string;
274
+ mergeCommitSha: string;
275
+ };
276
+ filePath: string;
277
+ matchedSpan: string;
278
+ contentHash: string;
279
+ }>;
280
+ export type AuthoredFixture = z.infer<typeof AuthoredFixtureSchema>;
281
+ /**
282
+ * ADR-112 §3 — the AUTHORED variant of the `ProvenanceRecord` union. A
283
+ * hand-authored rule is anchored to a real historical DEFECT (the pre-image,
284
+ * NOT its fix — ADR-110 §4 TP-def) via ≥1 train-side `positiveFixtures` entry.
285
+ * `kind: 'authored'` is REQUIRED (the discriminator), so this can never be
286
+ * mistaken for a mined record and an authored record can never round-trip as
287
+ * mined. Attributable (`author` never anonymous); the embargo/ledger
288
+ * attestations ride the §8 authoring-ledger, not this marker.
289
+ */
290
+ export declare const AuthoredProvenanceRecordSchema: z.ZodObject<{
291
+ kind: z.ZodLiteral<"authored">;
292
+ /** Agent-id or operator handle — attributable, never anonymous. */
293
+ author: z.ZodEffects<z.ZodString, string, string>;
294
+ /** ISO-8601 authoring date — a real calendar date (`YYYY-MM-DD`) or a full timestamp. */
295
+ authoredAt: z.ZodEffects<z.ZodString, string, string>;
296
+ /** The declared DEFECT the rule targets — the pre-image, not its fix. */
297
+ targetDefect: z.ZodEffects<z.ZodString, string, string>;
298
+ /** ≥1 real lc instance the rule claims to catch — ALL train-side (§5). */
299
+ positiveFixtures: z.ZodArray<z.ZodEffects<z.ZodObject<{
300
+ /** The PR where the defect was caught/introduced (the in-corpus anchor). */
301
+ pr: z.ZodNumber;
302
+ /** The §4 preimage-differential source — lesson-anchored (PRIMARY) or commit-pair (FALLBACK). */
303
+ preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
304
+ kind: z.ZodLiteral<"lesson">;
305
+ /** IMMUTABLE lesson id/hash (the 16-hex `hashLesson` codomain) — never a path/mutable alias (§4/§8). */
306
+ lessonRef: z.ZodString;
307
+ /**
308
+ * The defect PREIMAGE exemplar the matcher must FIRE on (§4). This is a lesson
309
+ * corpus `badExample` — distinct from `CompiledRuleBaseSchema.badExample` (an
310
+ * optional human-readable code snippet on a compiled rule); here it is the
311
+ * load-bearing positive-control preimage, so non-empty is required.
312
+ */
313
+ badExample: z.ZodEffects<z.ZodString, string, string>;
314
+ /** The fixed POSTIMAGE exemplar the matcher must stay SILENT on (§4) — a lesson `goodExample`. */
315
+ goodExample: z.ZodEffects<z.ZodString, string, string>;
316
+ }, "strict", z.ZodTypeAny, {
317
+ kind: "lesson";
318
+ lessonRef: string;
319
+ badExample: string;
320
+ goodExample: string;
321
+ }, {
322
+ kind: "lesson";
323
+ lessonRef: string;
324
+ badExample: string;
325
+ goodExample: string;
326
+ }>, z.ZodObject<{
327
+ kind: z.ZodLiteral<"commit">;
328
+ /** The PARENT (pre-fix) commit where the DEFECT is present — the matcher must FIRE on this (ADR-112 §4). */
329
+ preimageCommitSha: z.ZodString;
330
+ /** The PR's merge/squash commit — the post-fix (defect-absent) anchor; the matcher must stay SILENT on this. */
331
+ mergeCommitSha: z.ZodString;
332
+ }, "strict", z.ZodTypeAny, {
333
+ kind: "commit";
334
+ preimageCommitSha: string;
335
+ mergeCommitSha: string;
336
+ }, {
337
+ kind: "commit";
338
+ preimageCommitSha: string;
339
+ mergeCommitSha: string;
340
+ }>]>;
341
+ /** File the defect locus lives in. */
342
+ filePath: z.ZodEffects<z.ZodString, string, string>;
343
+ /** Line-range or AST-node path — the defect locus, not just the file. */
344
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
345
+ /** Span content hash, line-drift-stable (cf. `firingLabelId`). */
346
+ contentHash: z.ZodEffects<z.ZodString, string, string>;
347
+ }, "strict", z.ZodTypeAny, {
348
+ pr: number;
349
+ preimageSource: {
350
+ kind: "lesson";
351
+ lessonRef: string;
352
+ badExample: string;
353
+ goodExample: string;
354
+ } | {
355
+ kind: "commit";
356
+ preimageCommitSha: string;
357
+ mergeCommitSha: string;
358
+ };
359
+ filePath: string;
360
+ matchedSpan: string;
361
+ contentHash: string;
362
+ }, {
363
+ pr: number;
364
+ preimageSource: {
365
+ kind: "lesson";
366
+ lessonRef: string;
367
+ badExample: string;
368
+ goodExample: string;
369
+ } | {
370
+ kind: "commit";
371
+ preimageCommitSha: string;
372
+ mergeCommitSha: string;
373
+ };
374
+ filePath: string;
375
+ matchedSpan: string;
376
+ contentHash: string;
377
+ }>, {
378
+ pr: number;
379
+ preimageSource: {
380
+ kind: "lesson";
381
+ lessonRef: string;
382
+ badExample: string;
383
+ goodExample: string;
384
+ } | {
385
+ kind: "commit";
386
+ preimageCommitSha: string;
387
+ mergeCommitSha: string;
388
+ };
389
+ filePath: string;
390
+ matchedSpan: string;
391
+ contentHash: string;
392
+ }, {
393
+ pr: number;
394
+ preimageSource: {
395
+ kind: "lesson";
396
+ lessonRef: string;
397
+ badExample: string;
398
+ goodExample: string;
399
+ } | {
400
+ kind: "commit";
401
+ preimageCommitSha: string;
402
+ mergeCommitSha: string;
403
+ };
404
+ filePath: string;
405
+ matchedSpan: string;
406
+ contentHash: string;
407
+ }>, "many">;
408
+ /** Declared near-misses the rule must stay silent on (feeds §6 negative controls). */
409
+ negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
410
+ /** The PR where the defect was caught/introduced (the in-corpus anchor). */
411
+ pr: z.ZodNumber;
412
+ /** The §4 preimage-differential source — lesson-anchored (PRIMARY) or commit-pair (FALLBACK). */
413
+ preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
414
+ kind: z.ZodLiteral<"lesson">;
415
+ /** IMMUTABLE lesson id/hash (the 16-hex `hashLesson` codomain) — never a path/mutable alias (§4/§8). */
416
+ lessonRef: z.ZodString;
417
+ /**
418
+ * The defect PREIMAGE exemplar the matcher must FIRE on (§4). This is a lesson
419
+ * corpus `badExample` — distinct from `CompiledRuleBaseSchema.badExample` (an
420
+ * optional human-readable code snippet on a compiled rule); here it is the
421
+ * load-bearing positive-control preimage, so non-empty is required.
422
+ */
423
+ badExample: z.ZodEffects<z.ZodString, string, string>;
424
+ /** The fixed POSTIMAGE exemplar the matcher must stay SILENT on (§4) — a lesson `goodExample`. */
425
+ goodExample: z.ZodEffects<z.ZodString, string, string>;
426
+ }, "strict", z.ZodTypeAny, {
427
+ kind: "lesson";
428
+ lessonRef: string;
429
+ badExample: string;
430
+ goodExample: string;
431
+ }, {
432
+ kind: "lesson";
433
+ lessonRef: string;
434
+ badExample: string;
435
+ goodExample: string;
436
+ }>, z.ZodObject<{
437
+ kind: z.ZodLiteral<"commit">;
438
+ /** The PARENT (pre-fix) commit where the DEFECT is present — the matcher must FIRE on this (ADR-112 §4). */
439
+ preimageCommitSha: z.ZodString;
440
+ /** The PR's merge/squash commit — the post-fix (defect-absent) anchor; the matcher must stay SILENT on this. */
441
+ mergeCommitSha: z.ZodString;
442
+ }, "strict", z.ZodTypeAny, {
443
+ kind: "commit";
444
+ preimageCommitSha: string;
445
+ mergeCommitSha: string;
446
+ }, {
447
+ kind: "commit";
448
+ preimageCommitSha: string;
449
+ mergeCommitSha: string;
450
+ }>]>;
451
+ /** File the defect locus lives in. */
452
+ filePath: z.ZodEffects<z.ZodString, string, string>;
453
+ /** Line-range or AST-node path — the defect locus, not just the file. */
454
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
455
+ /** Span content hash, line-drift-stable (cf. `firingLabelId`). */
456
+ contentHash: z.ZodEffects<z.ZodString, string, string>;
457
+ }, "strict", z.ZodTypeAny, {
458
+ pr: number;
459
+ preimageSource: {
460
+ kind: "lesson";
461
+ lessonRef: string;
462
+ badExample: string;
463
+ goodExample: string;
464
+ } | {
465
+ kind: "commit";
466
+ preimageCommitSha: string;
467
+ mergeCommitSha: string;
468
+ };
469
+ filePath: string;
470
+ matchedSpan: string;
471
+ contentHash: string;
472
+ }, {
473
+ pr: number;
474
+ preimageSource: {
475
+ kind: "lesson";
476
+ lessonRef: string;
477
+ badExample: string;
478
+ goodExample: string;
479
+ } | {
480
+ kind: "commit";
481
+ preimageCommitSha: string;
482
+ mergeCommitSha: string;
483
+ };
484
+ filePath: string;
485
+ matchedSpan: string;
486
+ contentHash: string;
487
+ }>, {
488
+ pr: number;
489
+ preimageSource: {
490
+ kind: "lesson";
491
+ lessonRef: string;
492
+ badExample: string;
493
+ goodExample: string;
494
+ } | {
495
+ kind: "commit";
496
+ preimageCommitSha: string;
497
+ mergeCommitSha: string;
498
+ };
499
+ filePath: string;
500
+ matchedSpan: string;
501
+ contentHash: string;
502
+ }, {
503
+ pr: number;
504
+ preimageSource: {
505
+ kind: "lesson";
506
+ lessonRef: string;
507
+ badExample: string;
508
+ goodExample: string;
509
+ } | {
510
+ kind: "commit";
511
+ preimageCommitSha: string;
512
+ mergeCommitSha: string;
513
+ };
514
+ filePath: string;
515
+ matchedSpan: string;
516
+ contentHash: string;
517
+ }>, "many">>;
518
+ }, "strip", z.ZodTypeAny, {
519
+ kind: "authored";
520
+ author: string;
521
+ authoredAt: string;
522
+ targetDefect: string;
523
+ positiveFixtures: {
524
+ pr: number;
525
+ preimageSource: {
526
+ kind: "lesson";
527
+ lessonRef: string;
528
+ badExample: string;
529
+ goodExample: string;
530
+ } | {
531
+ kind: "commit";
532
+ preimageCommitSha: string;
533
+ mergeCommitSha: string;
534
+ };
535
+ filePath: string;
536
+ matchedSpan: string;
537
+ contentHash: string;
538
+ }[];
539
+ negativeFixtures?: {
540
+ pr: number;
541
+ preimageSource: {
542
+ kind: "lesson";
543
+ lessonRef: string;
544
+ badExample: string;
545
+ goodExample: string;
546
+ } | {
547
+ kind: "commit";
548
+ preimageCommitSha: string;
549
+ mergeCommitSha: string;
550
+ };
551
+ filePath: string;
552
+ matchedSpan: string;
553
+ contentHash: string;
554
+ }[] | undefined;
555
+ }, {
556
+ kind: "authored";
557
+ author: string;
558
+ authoredAt: string;
559
+ targetDefect: string;
560
+ positiveFixtures: {
561
+ pr: number;
562
+ preimageSource: {
563
+ kind: "lesson";
564
+ lessonRef: string;
565
+ badExample: string;
566
+ goodExample: string;
567
+ } | {
568
+ kind: "commit";
569
+ preimageCommitSha: string;
570
+ mergeCommitSha: string;
571
+ };
572
+ filePath: string;
573
+ matchedSpan: string;
574
+ contentHash: string;
575
+ }[];
576
+ negativeFixtures?: {
577
+ pr: number;
578
+ preimageSource: {
579
+ kind: "lesson";
580
+ lessonRef: string;
581
+ badExample: string;
582
+ goodExample: string;
583
+ } | {
584
+ kind: "commit";
585
+ preimageCommitSha: string;
586
+ mergeCommitSha: string;
587
+ };
588
+ filePath: string;
589
+ matchedSpan: string;
590
+ contentHash: string;
591
+ }[] | undefined;
592
+ }>;
593
+ export type AuthoredProvenanceRecord = z.infer<typeof AuthoredProvenanceRecordSchema>;
594
+ /**
595
+ * ADR-112 §3 — `provenance` is a discriminated UNION on `kind`
596
+ * (`mined | authored`), the first multi-producer attribute on a rule
597
+ * (Consequence 3). Built as a `z.union` (NOT `z.discriminatedUnion`) on
598
+ * purpose: the mined wire keeps `kind` OPTIONAL for byte-identical legacy
599
+ * round-trip, which a required-discriminator schema cannot express. The two
600
+ * branches are disjoint on their required fields (`authored` requires
601
+ * `kind:'authored'` + author/targetDefect/fixtures; the mined branch is the
602
+ * only one a legacy `{mergedPr, reviewThread, commitSha}` record satisfies), so
603
+ * the union is unambiguous. `Authored` is listed FIRST so a record carrying
604
+ * `kind:'authored'` never matches the mined branch.
605
+ */
606
+ export declare const ProvenanceRecordSchema: z.ZodUnion<[z.ZodObject<{
607
+ kind: z.ZodLiteral<"authored">;
608
+ /** Agent-id or operator handle — attributable, never anonymous. */
609
+ author: z.ZodEffects<z.ZodString, string, string>;
610
+ /** ISO-8601 authoring date — a real calendar date (`YYYY-MM-DD`) or a full timestamp. */
611
+ authoredAt: z.ZodEffects<z.ZodString, string, string>;
612
+ /** The declared DEFECT the rule targets — the pre-image, not its fix. */
613
+ targetDefect: z.ZodEffects<z.ZodString, string, string>;
614
+ /** ≥1 real lc instance the rule claims to catch — ALL train-side (§5). */
615
+ positiveFixtures: z.ZodArray<z.ZodEffects<z.ZodObject<{
616
+ /** The PR where the defect was caught/introduced (the in-corpus anchor). */
617
+ pr: z.ZodNumber;
618
+ /** The §4 preimage-differential source — lesson-anchored (PRIMARY) or commit-pair (FALLBACK). */
619
+ preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
620
+ kind: z.ZodLiteral<"lesson">;
621
+ /** IMMUTABLE lesson id/hash (the 16-hex `hashLesson` codomain) — never a path/mutable alias (§4/§8). */
622
+ lessonRef: z.ZodString;
623
+ /**
624
+ * The defect PREIMAGE exemplar the matcher must FIRE on (§4). This is a lesson
625
+ * corpus `badExample` — distinct from `CompiledRuleBaseSchema.badExample` (an
626
+ * optional human-readable code snippet on a compiled rule); here it is the
627
+ * load-bearing positive-control preimage, so non-empty is required.
628
+ */
629
+ badExample: z.ZodEffects<z.ZodString, string, string>;
630
+ /** The fixed POSTIMAGE exemplar the matcher must stay SILENT on (§4) — a lesson `goodExample`. */
631
+ goodExample: z.ZodEffects<z.ZodString, string, string>;
632
+ }, "strict", z.ZodTypeAny, {
633
+ kind: "lesson";
634
+ lessonRef: string;
635
+ badExample: string;
636
+ goodExample: string;
637
+ }, {
638
+ kind: "lesson";
639
+ lessonRef: string;
640
+ badExample: string;
641
+ goodExample: string;
642
+ }>, z.ZodObject<{
643
+ kind: z.ZodLiteral<"commit">;
644
+ /** The PARENT (pre-fix) commit where the DEFECT is present — the matcher must FIRE on this (ADR-112 §4). */
645
+ preimageCommitSha: z.ZodString;
646
+ /** The PR's merge/squash commit — the post-fix (defect-absent) anchor; the matcher must stay SILENT on this. */
647
+ mergeCommitSha: z.ZodString;
648
+ }, "strict", z.ZodTypeAny, {
649
+ kind: "commit";
650
+ preimageCommitSha: string;
651
+ mergeCommitSha: string;
652
+ }, {
653
+ kind: "commit";
654
+ preimageCommitSha: string;
655
+ mergeCommitSha: string;
656
+ }>]>;
657
+ /** File the defect locus lives in. */
658
+ filePath: z.ZodEffects<z.ZodString, string, string>;
659
+ /** Line-range or AST-node path — the defect locus, not just the file. */
660
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
661
+ /** Span content hash, line-drift-stable (cf. `firingLabelId`). */
662
+ contentHash: z.ZodEffects<z.ZodString, string, string>;
663
+ }, "strict", z.ZodTypeAny, {
664
+ pr: number;
665
+ preimageSource: {
666
+ kind: "lesson";
667
+ lessonRef: string;
668
+ badExample: string;
669
+ goodExample: string;
670
+ } | {
671
+ kind: "commit";
672
+ preimageCommitSha: string;
673
+ mergeCommitSha: string;
674
+ };
675
+ filePath: string;
676
+ matchedSpan: string;
677
+ contentHash: string;
678
+ }, {
679
+ pr: number;
680
+ preimageSource: {
681
+ kind: "lesson";
682
+ lessonRef: string;
683
+ badExample: string;
684
+ goodExample: string;
685
+ } | {
686
+ kind: "commit";
687
+ preimageCommitSha: string;
688
+ mergeCommitSha: string;
689
+ };
690
+ filePath: string;
691
+ matchedSpan: string;
692
+ contentHash: string;
693
+ }>, {
694
+ pr: number;
695
+ preimageSource: {
696
+ kind: "lesson";
697
+ lessonRef: string;
698
+ badExample: string;
699
+ goodExample: string;
700
+ } | {
701
+ kind: "commit";
702
+ preimageCommitSha: string;
703
+ mergeCommitSha: string;
704
+ };
705
+ filePath: string;
706
+ matchedSpan: string;
707
+ contentHash: string;
708
+ }, {
709
+ pr: number;
710
+ preimageSource: {
711
+ kind: "lesson";
712
+ lessonRef: string;
713
+ badExample: string;
714
+ goodExample: string;
715
+ } | {
716
+ kind: "commit";
717
+ preimageCommitSha: string;
718
+ mergeCommitSha: string;
719
+ };
720
+ filePath: string;
721
+ matchedSpan: string;
722
+ contentHash: string;
723
+ }>, "many">;
724
+ /** Declared near-misses the rule must stay silent on (feeds §6 negative controls). */
725
+ negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
726
+ /** The PR where the defect was caught/introduced (the in-corpus anchor). */
727
+ pr: z.ZodNumber;
728
+ /** The §4 preimage-differential source — lesson-anchored (PRIMARY) or commit-pair (FALLBACK). */
729
+ preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
730
+ kind: z.ZodLiteral<"lesson">;
731
+ /** IMMUTABLE lesson id/hash (the 16-hex `hashLesson` codomain) — never a path/mutable alias (§4/§8). */
732
+ lessonRef: z.ZodString;
733
+ /**
734
+ * The defect PREIMAGE exemplar the matcher must FIRE on (§4). This is a lesson
735
+ * corpus `badExample` — distinct from `CompiledRuleBaseSchema.badExample` (an
736
+ * optional human-readable code snippet on a compiled rule); here it is the
737
+ * load-bearing positive-control preimage, so non-empty is required.
738
+ */
739
+ badExample: z.ZodEffects<z.ZodString, string, string>;
740
+ /** The fixed POSTIMAGE exemplar the matcher must stay SILENT on (§4) — a lesson `goodExample`. */
741
+ goodExample: z.ZodEffects<z.ZodString, string, string>;
742
+ }, "strict", z.ZodTypeAny, {
743
+ kind: "lesson";
744
+ lessonRef: string;
745
+ badExample: string;
746
+ goodExample: string;
747
+ }, {
748
+ kind: "lesson";
749
+ lessonRef: string;
750
+ badExample: string;
751
+ goodExample: string;
752
+ }>, z.ZodObject<{
753
+ kind: z.ZodLiteral<"commit">;
754
+ /** The PARENT (pre-fix) commit where the DEFECT is present — the matcher must FIRE on this (ADR-112 §4). */
755
+ preimageCommitSha: z.ZodString;
756
+ /** The PR's merge/squash commit — the post-fix (defect-absent) anchor; the matcher must stay SILENT on this. */
757
+ mergeCommitSha: z.ZodString;
758
+ }, "strict", z.ZodTypeAny, {
759
+ kind: "commit";
760
+ preimageCommitSha: string;
761
+ mergeCommitSha: string;
762
+ }, {
763
+ kind: "commit";
764
+ preimageCommitSha: string;
765
+ mergeCommitSha: string;
766
+ }>]>;
767
+ /** File the defect locus lives in. */
768
+ filePath: z.ZodEffects<z.ZodString, string, string>;
769
+ /** Line-range or AST-node path — the defect locus, not just the file. */
770
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
771
+ /** Span content hash, line-drift-stable (cf. `firingLabelId`). */
772
+ contentHash: z.ZodEffects<z.ZodString, string, string>;
773
+ }, "strict", z.ZodTypeAny, {
774
+ pr: number;
775
+ preimageSource: {
776
+ kind: "lesson";
777
+ lessonRef: string;
778
+ badExample: string;
779
+ goodExample: string;
780
+ } | {
781
+ kind: "commit";
782
+ preimageCommitSha: string;
783
+ mergeCommitSha: string;
784
+ };
785
+ filePath: string;
786
+ matchedSpan: string;
787
+ contentHash: string;
788
+ }, {
789
+ pr: number;
790
+ preimageSource: {
791
+ kind: "lesson";
792
+ lessonRef: string;
793
+ badExample: string;
794
+ goodExample: string;
795
+ } | {
796
+ kind: "commit";
797
+ preimageCommitSha: string;
798
+ mergeCommitSha: string;
799
+ };
800
+ filePath: string;
801
+ matchedSpan: string;
802
+ contentHash: string;
803
+ }>, {
804
+ pr: number;
805
+ preimageSource: {
806
+ kind: "lesson";
807
+ lessonRef: string;
808
+ badExample: string;
809
+ goodExample: string;
810
+ } | {
811
+ kind: "commit";
812
+ preimageCommitSha: string;
813
+ mergeCommitSha: string;
814
+ };
815
+ filePath: string;
816
+ matchedSpan: string;
817
+ contentHash: string;
818
+ }, {
819
+ pr: number;
820
+ preimageSource: {
821
+ kind: "lesson";
822
+ lessonRef: string;
823
+ badExample: string;
824
+ goodExample: string;
825
+ } | {
826
+ kind: "commit";
827
+ preimageCommitSha: string;
828
+ mergeCommitSha: string;
829
+ };
830
+ filePath: string;
831
+ matchedSpan: string;
832
+ contentHash: string;
833
+ }>, "many">>;
834
+ }, "strip", z.ZodTypeAny, {
835
+ kind: "authored";
836
+ author: string;
837
+ authoredAt: string;
838
+ targetDefect: string;
839
+ positiveFixtures: {
840
+ pr: number;
841
+ preimageSource: {
842
+ kind: "lesson";
843
+ lessonRef: string;
844
+ badExample: string;
845
+ goodExample: string;
846
+ } | {
847
+ kind: "commit";
848
+ preimageCommitSha: string;
849
+ mergeCommitSha: string;
850
+ };
851
+ filePath: string;
852
+ matchedSpan: string;
853
+ contentHash: string;
854
+ }[];
855
+ negativeFixtures?: {
856
+ pr: number;
857
+ preimageSource: {
858
+ kind: "lesson";
859
+ lessonRef: string;
860
+ badExample: string;
861
+ goodExample: string;
862
+ } | {
863
+ kind: "commit";
864
+ preimageCommitSha: string;
865
+ mergeCommitSha: string;
866
+ };
867
+ filePath: string;
868
+ matchedSpan: string;
869
+ contentHash: string;
870
+ }[] | undefined;
871
+ }, {
872
+ kind: "authored";
873
+ author: string;
874
+ authoredAt: string;
875
+ targetDefect: string;
876
+ positiveFixtures: {
877
+ pr: number;
878
+ preimageSource: {
879
+ kind: "lesson";
880
+ lessonRef: string;
881
+ badExample: string;
882
+ goodExample: string;
883
+ } | {
884
+ kind: "commit";
885
+ preimageCommitSha: string;
886
+ mergeCommitSha: string;
887
+ };
888
+ filePath: string;
889
+ matchedSpan: string;
890
+ contentHash: string;
891
+ }[];
892
+ negativeFixtures?: {
893
+ pr: number;
894
+ preimageSource: {
895
+ kind: "lesson";
896
+ lessonRef: string;
897
+ badExample: string;
898
+ goodExample: string;
899
+ } | {
900
+ kind: "commit";
901
+ preimageCommitSha: string;
902
+ mergeCommitSha: string;
903
+ };
904
+ filePath: string;
905
+ matchedSpan: string;
906
+ contentHash: string;
907
+ }[] | undefined;
908
+ }>, z.ZodObject<{
909
+ /**
910
+ * ADR-112 discriminator. OPTIONAL on the mined wire so legacy records (which
911
+ * have no `kind`) round-trip byte-identical; absence is read as `'mined'` by
912
+ * `provenanceKind()`. A new mined artifact MAY carry `kind: 'mined'` only
913
+ * where the resulting hash churn is intentional.
914
+ */
915
+ kind: z.ZodOptional<z.ZodLiteral<"mined">>;
916
+ /** Merged PR the rule was mined from (positive integer PR number). */
917
+ mergedPr: z.ZodNumber;
918
+ /**
919
+ * Reference to the review thread that adjudicated the rule. Rejects empty and
920
+ * whitespace-only via a NON-MUTATING refinement (greptile/CR #2186): a
921
+ * `.trim()` transform would silently normalize a padded value on parse, so a
922
+ * stamped rule's on-disk JSON could differ from its parsed form and churn the
923
+ * manifest hash on the next `verify-manifest`. `.refine` validates without
924
+ * mutating, so the stored value round-trips byte-identically.
925
+ */
926
+ reviewThread: z.ZodEffects<z.ZodString, string, string>;
927
+ /** Full 40-hex git commit SHA the rule was frozen at. */
928
+ commitSha: z.ZodString;
929
+ }, "strip", z.ZodTypeAny, {
930
+ mergedPr: number;
931
+ reviewThread: string;
932
+ commitSha: string;
933
+ kind?: "mined" | undefined;
934
+ }, {
935
+ mergedPr: number;
936
+ reviewThread: string;
937
+ commitSha: string;
938
+ kind?: "mined" | undefined;
939
+ }>]>;
72
940
  export type ProvenanceRecord = z.infer<typeof ProvenanceRecordSchema>;
941
+ /**
942
+ * ADR-112 — the canonical reader of a provenance record's producer kind. An
943
+ * absent discriminator (every legacy mined record) reads as `'mined'`. Use this
944
+ * + the guards below instead of touching `.kind` directly, so the
945
+ * absent-⇒-mined default lives in exactly one place (Tenet 20).
946
+ */
947
+ export declare function provenanceKind(p: ProvenanceRecord): 'mined' | 'authored';
948
+ /** ADR-112 — type-narrowing guard for the mined branch (mined-only field reads). */
949
+ export declare function isMinedProvenance(p: ProvenanceRecord): p is MinedProvenanceRecord;
950
+ /** ADR-112 — type-narrowing guard for the authored branch. */
951
+ export declare function isAuthoredProvenance(p: ProvenanceRecord): p is AuthoredProvenanceRecord;
73
952
  /**
74
953
  * mmnto-ai/totem#2183 — the three **peer** legs of the ADR-110 §3 legitimacy
75
954
  * bar, mapping 1:1 onto the strategy#666 Tenet-9 three-check so the Gate-1
@@ -80,7 +959,316 @@ export type ProvenanceRecord = z.infer<typeof ProvenanceRecordSchema>;
80
959
  * failed one); the evidence behind each pass lives in the wind-tunnel manifest.
81
960
  */
82
961
  export declare const LegitimacySchema: z.ZodObject<{
83
- provenance: z.ZodObject<{
962
+ provenance: z.ZodUnion<[z.ZodObject<{
963
+ kind: z.ZodLiteral<"authored">;
964
+ /** Agent-id or operator handle — attributable, never anonymous. */
965
+ author: z.ZodEffects<z.ZodString, string, string>;
966
+ /** ISO-8601 authoring date — a real calendar date (`YYYY-MM-DD`) or a full timestamp. */
967
+ authoredAt: z.ZodEffects<z.ZodString, string, string>;
968
+ /** The declared DEFECT the rule targets — the pre-image, not its fix. */
969
+ targetDefect: z.ZodEffects<z.ZodString, string, string>;
970
+ /** ≥1 real lc instance the rule claims to catch — ALL train-side (§5). */
971
+ positiveFixtures: z.ZodArray<z.ZodEffects<z.ZodObject<{
972
+ /** The PR where the defect was caught/introduced (the in-corpus anchor). */
973
+ pr: z.ZodNumber;
974
+ /** The §4 preimage-differential source — lesson-anchored (PRIMARY) or commit-pair (FALLBACK). */
975
+ preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
976
+ kind: z.ZodLiteral<"lesson">;
977
+ /** IMMUTABLE lesson id/hash (the 16-hex `hashLesson` codomain) — never a path/mutable alias (§4/§8). */
978
+ lessonRef: z.ZodString;
979
+ /**
980
+ * The defect PREIMAGE exemplar the matcher must FIRE on (§4). This is a lesson
981
+ * corpus `badExample` — distinct from `CompiledRuleBaseSchema.badExample` (an
982
+ * optional human-readable code snippet on a compiled rule); here it is the
983
+ * load-bearing positive-control preimage, so non-empty is required.
984
+ */
985
+ badExample: z.ZodEffects<z.ZodString, string, string>;
986
+ /** The fixed POSTIMAGE exemplar the matcher must stay SILENT on (§4) — a lesson `goodExample`. */
987
+ goodExample: z.ZodEffects<z.ZodString, string, string>;
988
+ }, "strict", z.ZodTypeAny, {
989
+ kind: "lesson";
990
+ lessonRef: string;
991
+ badExample: string;
992
+ goodExample: string;
993
+ }, {
994
+ kind: "lesson";
995
+ lessonRef: string;
996
+ badExample: string;
997
+ goodExample: string;
998
+ }>, z.ZodObject<{
999
+ kind: z.ZodLiteral<"commit">;
1000
+ /** The PARENT (pre-fix) commit where the DEFECT is present — the matcher must FIRE on this (ADR-112 §4). */
1001
+ preimageCommitSha: z.ZodString;
1002
+ /** The PR's merge/squash commit — the post-fix (defect-absent) anchor; the matcher must stay SILENT on this. */
1003
+ mergeCommitSha: z.ZodString;
1004
+ }, "strict", z.ZodTypeAny, {
1005
+ kind: "commit";
1006
+ preimageCommitSha: string;
1007
+ mergeCommitSha: string;
1008
+ }, {
1009
+ kind: "commit";
1010
+ preimageCommitSha: string;
1011
+ mergeCommitSha: string;
1012
+ }>]>;
1013
+ /** File the defect locus lives in. */
1014
+ filePath: z.ZodEffects<z.ZodString, string, string>;
1015
+ /** Line-range or AST-node path — the defect locus, not just the file. */
1016
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
1017
+ /** Span content hash, line-drift-stable (cf. `firingLabelId`). */
1018
+ contentHash: z.ZodEffects<z.ZodString, string, string>;
1019
+ }, "strict", z.ZodTypeAny, {
1020
+ pr: number;
1021
+ preimageSource: {
1022
+ kind: "lesson";
1023
+ lessonRef: string;
1024
+ badExample: string;
1025
+ goodExample: string;
1026
+ } | {
1027
+ kind: "commit";
1028
+ preimageCommitSha: string;
1029
+ mergeCommitSha: string;
1030
+ };
1031
+ filePath: string;
1032
+ matchedSpan: string;
1033
+ contentHash: string;
1034
+ }, {
1035
+ pr: number;
1036
+ preimageSource: {
1037
+ kind: "lesson";
1038
+ lessonRef: string;
1039
+ badExample: string;
1040
+ goodExample: string;
1041
+ } | {
1042
+ kind: "commit";
1043
+ preimageCommitSha: string;
1044
+ mergeCommitSha: string;
1045
+ };
1046
+ filePath: string;
1047
+ matchedSpan: string;
1048
+ contentHash: string;
1049
+ }>, {
1050
+ pr: number;
1051
+ preimageSource: {
1052
+ kind: "lesson";
1053
+ lessonRef: string;
1054
+ badExample: string;
1055
+ goodExample: string;
1056
+ } | {
1057
+ kind: "commit";
1058
+ preimageCommitSha: string;
1059
+ mergeCommitSha: string;
1060
+ };
1061
+ filePath: string;
1062
+ matchedSpan: string;
1063
+ contentHash: string;
1064
+ }, {
1065
+ pr: number;
1066
+ preimageSource: {
1067
+ kind: "lesson";
1068
+ lessonRef: string;
1069
+ badExample: string;
1070
+ goodExample: string;
1071
+ } | {
1072
+ kind: "commit";
1073
+ preimageCommitSha: string;
1074
+ mergeCommitSha: string;
1075
+ };
1076
+ filePath: string;
1077
+ matchedSpan: string;
1078
+ contentHash: string;
1079
+ }>, "many">;
1080
+ /** Declared near-misses the rule must stay silent on (feeds §6 negative controls). */
1081
+ negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1082
+ /** The PR where the defect was caught/introduced (the in-corpus anchor). */
1083
+ pr: z.ZodNumber;
1084
+ /** The §4 preimage-differential source — lesson-anchored (PRIMARY) or commit-pair (FALLBACK). */
1085
+ preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1086
+ kind: z.ZodLiteral<"lesson">;
1087
+ /** IMMUTABLE lesson id/hash (the 16-hex `hashLesson` codomain) — never a path/mutable alias (§4/§8). */
1088
+ lessonRef: z.ZodString;
1089
+ /**
1090
+ * The defect PREIMAGE exemplar the matcher must FIRE on (§4). This is a lesson
1091
+ * corpus `badExample` — distinct from `CompiledRuleBaseSchema.badExample` (an
1092
+ * optional human-readable code snippet on a compiled rule); here it is the
1093
+ * load-bearing positive-control preimage, so non-empty is required.
1094
+ */
1095
+ badExample: z.ZodEffects<z.ZodString, string, string>;
1096
+ /** The fixed POSTIMAGE exemplar the matcher must stay SILENT on (§4) — a lesson `goodExample`. */
1097
+ goodExample: z.ZodEffects<z.ZodString, string, string>;
1098
+ }, "strict", z.ZodTypeAny, {
1099
+ kind: "lesson";
1100
+ lessonRef: string;
1101
+ badExample: string;
1102
+ goodExample: string;
1103
+ }, {
1104
+ kind: "lesson";
1105
+ lessonRef: string;
1106
+ badExample: string;
1107
+ goodExample: string;
1108
+ }>, z.ZodObject<{
1109
+ kind: z.ZodLiteral<"commit">;
1110
+ /** The PARENT (pre-fix) commit where the DEFECT is present — the matcher must FIRE on this (ADR-112 §4). */
1111
+ preimageCommitSha: z.ZodString;
1112
+ /** The PR's merge/squash commit — the post-fix (defect-absent) anchor; the matcher must stay SILENT on this. */
1113
+ mergeCommitSha: z.ZodString;
1114
+ }, "strict", z.ZodTypeAny, {
1115
+ kind: "commit";
1116
+ preimageCommitSha: string;
1117
+ mergeCommitSha: string;
1118
+ }, {
1119
+ kind: "commit";
1120
+ preimageCommitSha: string;
1121
+ mergeCommitSha: string;
1122
+ }>]>;
1123
+ /** File the defect locus lives in. */
1124
+ filePath: z.ZodEffects<z.ZodString, string, string>;
1125
+ /** Line-range or AST-node path — the defect locus, not just the file. */
1126
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
1127
+ /** Span content hash, line-drift-stable (cf. `firingLabelId`). */
1128
+ contentHash: z.ZodEffects<z.ZodString, string, string>;
1129
+ }, "strict", z.ZodTypeAny, {
1130
+ pr: number;
1131
+ preimageSource: {
1132
+ kind: "lesson";
1133
+ lessonRef: string;
1134
+ badExample: string;
1135
+ goodExample: string;
1136
+ } | {
1137
+ kind: "commit";
1138
+ preimageCommitSha: string;
1139
+ mergeCommitSha: string;
1140
+ };
1141
+ filePath: string;
1142
+ matchedSpan: string;
1143
+ contentHash: string;
1144
+ }, {
1145
+ pr: number;
1146
+ preimageSource: {
1147
+ kind: "lesson";
1148
+ lessonRef: string;
1149
+ badExample: string;
1150
+ goodExample: string;
1151
+ } | {
1152
+ kind: "commit";
1153
+ preimageCommitSha: string;
1154
+ mergeCommitSha: string;
1155
+ };
1156
+ filePath: string;
1157
+ matchedSpan: string;
1158
+ contentHash: string;
1159
+ }>, {
1160
+ pr: number;
1161
+ preimageSource: {
1162
+ kind: "lesson";
1163
+ lessonRef: string;
1164
+ badExample: string;
1165
+ goodExample: string;
1166
+ } | {
1167
+ kind: "commit";
1168
+ preimageCommitSha: string;
1169
+ mergeCommitSha: string;
1170
+ };
1171
+ filePath: string;
1172
+ matchedSpan: string;
1173
+ contentHash: string;
1174
+ }, {
1175
+ pr: number;
1176
+ preimageSource: {
1177
+ kind: "lesson";
1178
+ lessonRef: string;
1179
+ badExample: string;
1180
+ goodExample: string;
1181
+ } | {
1182
+ kind: "commit";
1183
+ preimageCommitSha: string;
1184
+ mergeCommitSha: string;
1185
+ };
1186
+ filePath: string;
1187
+ matchedSpan: string;
1188
+ contentHash: string;
1189
+ }>, "many">>;
1190
+ }, "strip", z.ZodTypeAny, {
1191
+ kind: "authored";
1192
+ author: string;
1193
+ authoredAt: string;
1194
+ targetDefect: string;
1195
+ positiveFixtures: {
1196
+ pr: number;
1197
+ preimageSource: {
1198
+ kind: "lesson";
1199
+ lessonRef: string;
1200
+ badExample: string;
1201
+ goodExample: string;
1202
+ } | {
1203
+ kind: "commit";
1204
+ preimageCommitSha: string;
1205
+ mergeCommitSha: string;
1206
+ };
1207
+ filePath: string;
1208
+ matchedSpan: string;
1209
+ contentHash: string;
1210
+ }[];
1211
+ negativeFixtures?: {
1212
+ pr: number;
1213
+ preimageSource: {
1214
+ kind: "lesson";
1215
+ lessonRef: string;
1216
+ badExample: string;
1217
+ goodExample: string;
1218
+ } | {
1219
+ kind: "commit";
1220
+ preimageCommitSha: string;
1221
+ mergeCommitSha: string;
1222
+ };
1223
+ filePath: string;
1224
+ matchedSpan: string;
1225
+ contentHash: string;
1226
+ }[] | undefined;
1227
+ }, {
1228
+ kind: "authored";
1229
+ author: string;
1230
+ authoredAt: string;
1231
+ targetDefect: string;
1232
+ positiveFixtures: {
1233
+ pr: number;
1234
+ preimageSource: {
1235
+ kind: "lesson";
1236
+ lessonRef: string;
1237
+ badExample: string;
1238
+ goodExample: string;
1239
+ } | {
1240
+ kind: "commit";
1241
+ preimageCommitSha: string;
1242
+ mergeCommitSha: string;
1243
+ };
1244
+ filePath: string;
1245
+ matchedSpan: string;
1246
+ contentHash: string;
1247
+ }[];
1248
+ negativeFixtures?: {
1249
+ pr: number;
1250
+ preimageSource: {
1251
+ kind: "lesson";
1252
+ lessonRef: string;
1253
+ badExample: string;
1254
+ goodExample: string;
1255
+ } | {
1256
+ kind: "commit";
1257
+ preimageCommitSha: string;
1258
+ mergeCommitSha: string;
1259
+ };
1260
+ filePath: string;
1261
+ matchedSpan: string;
1262
+ contentHash: string;
1263
+ }[] | undefined;
1264
+ }>, z.ZodObject<{
1265
+ /**
1266
+ * ADR-112 discriminator. OPTIONAL on the mined wire so legacy records (which
1267
+ * have no `kind`) round-trip byte-identical; absence is read as `'mined'` by
1268
+ * `provenanceKind()`. A new mined artifact MAY carry `kind: 'mined'` only
1269
+ * where the resulting hash churn is intentional.
1270
+ */
1271
+ kind: z.ZodOptional<z.ZodLiteral<"mined">>;
84
1272
  /** Merged PR the rule was mined from (positive integer PR number). */
85
1273
  mergedPr: z.ZodNumber;
86
1274
  /**
@@ -98,11 +1286,13 @@ export declare const LegitimacySchema: z.ZodObject<{
98
1286
  mergedPr: number;
99
1287
  reviewThread: string;
100
1288
  commitSha: string;
1289
+ kind?: "mined" | undefined;
101
1290
  }, {
102
1291
  mergedPr: number;
103
1292
  reviewThread: string;
104
1293
  commitSha: string;
105
- }>;
1294
+ kind?: "mined" | undefined;
1295
+ }>]>;
106
1296
  positiveControl: z.ZodBoolean;
107
1297
  negativeControl: z.ZodBoolean;
108
1298
  }, "strip", z.ZodTypeAny, {
@@ -110,6 +1300,44 @@ export declare const LegitimacySchema: z.ZodObject<{
110
1300
  mergedPr: number;
111
1301
  reviewThread: string;
112
1302
  commitSha: string;
1303
+ kind?: "mined" | undefined;
1304
+ } | {
1305
+ kind: "authored";
1306
+ author: string;
1307
+ authoredAt: string;
1308
+ targetDefect: string;
1309
+ positiveFixtures: {
1310
+ pr: number;
1311
+ preimageSource: {
1312
+ kind: "lesson";
1313
+ lessonRef: string;
1314
+ badExample: string;
1315
+ goodExample: string;
1316
+ } | {
1317
+ kind: "commit";
1318
+ preimageCommitSha: string;
1319
+ mergeCommitSha: string;
1320
+ };
1321
+ filePath: string;
1322
+ matchedSpan: string;
1323
+ contentHash: string;
1324
+ }[];
1325
+ negativeFixtures?: {
1326
+ pr: number;
1327
+ preimageSource: {
1328
+ kind: "lesson";
1329
+ lessonRef: string;
1330
+ badExample: string;
1331
+ goodExample: string;
1332
+ } | {
1333
+ kind: "commit";
1334
+ preimageCommitSha: string;
1335
+ mergeCommitSha: string;
1336
+ };
1337
+ filePath: string;
1338
+ matchedSpan: string;
1339
+ contentHash: string;
1340
+ }[] | undefined;
113
1341
  };
114
1342
  positiveControl: boolean;
115
1343
  negativeControl: boolean;
@@ -118,6 +1346,44 @@ export declare const LegitimacySchema: z.ZodObject<{
118
1346
  mergedPr: number;
119
1347
  reviewThread: string;
120
1348
  commitSha: string;
1349
+ kind?: "mined" | undefined;
1350
+ } | {
1351
+ kind: "authored";
1352
+ author: string;
1353
+ authoredAt: string;
1354
+ targetDefect: string;
1355
+ positiveFixtures: {
1356
+ pr: number;
1357
+ preimageSource: {
1358
+ kind: "lesson";
1359
+ lessonRef: string;
1360
+ badExample: string;
1361
+ goodExample: string;
1362
+ } | {
1363
+ kind: "commit";
1364
+ preimageCommitSha: string;
1365
+ mergeCommitSha: string;
1366
+ };
1367
+ filePath: string;
1368
+ matchedSpan: string;
1369
+ contentHash: string;
1370
+ }[];
1371
+ negativeFixtures?: {
1372
+ pr: number;
1373
+ preimageSource: {
1374
+ kind: "lesson";
1375
+ lessonRef: string;
1376
+ badExample: string;
1377
+ goodExample: string;
1378
+ } | {
1379
+ kind: "commit";
1380
+ preimageCommitSha: string;
1381
+ mergeCommitSha: string;
1382
+ };
1383
+ filePath: string;
1384
+ matchedSpan: string;
1385
+ contentHash: string;
1386
+ }[] | undefined;
121
1387
  };
122
1388
  positiveControl: boolean;
123
1389
  negativeControl: boolean;
@@ -309,7 +1575,316 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
309
1575
  * signal and preserves pre-#2183 manifest hashes via canonicalStringify.
310
1576
  */
311
1577
  legitimacy: z.ZodOptional<z.ZodObject<{
312
- provenance: z.ZodObject<{
1578
+ provenance: z.ZodUnion<[z.ZodObject<{
1579
+ kind: z.ZodLiteral<"authored">;
1580
+ /** Agent-id or operator handle — attributable, never anonymous. */
1581
+ author: z.ZodEffects<z.ZodString, string, string>;
1582
+ /** ISO-8601 authoring date — a real calendar date (`YYYY-MM-DD`) or a full timestamp. */
1583
+ authoredAt: z.ZodEffects<z.ZodString, string, string>;
1584
+ /** The declared DEFECT the rule targets — the pre-image, not its fix. */
1585
+ targetDefect: z.ZodEffects<z.ZodString, string, string>;
1586
+ /** ≥1 real lc instance the rule claims to catch — ALL train-side (§5). */
1587
+ positiveFixtures: z.ZodArray<z.ZodEffects<z.ZodObject<{
1588
+ /** The PR where the defect was caught/introduced (the in-corpus anchor). */
1589
+ pr: z.ZodNumber;
1590
+ /** The §4 preimage-differential source — lesson-anchored (PRIMARY) or commit-pair (FALLBACK). */
1591
+ preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1592
+ kind: z.ZodLiteral<"lesson">;
1593
+ /** IMMUTABLE lesson id/hash (the 16-hex `hashLesson` codomain) — never a path/mutable alias (§4/§8). */
1594
+ lessonRef: z.ZodString;
1595
+ /**
1596
+ * The defect PREIMAGE exemplar the matcher must FIRE on (§4). This is a lesson
1597
+ * corpus `badExample` — distinct from `CompiledRuleBaseSchema.badExample` (an
1598
+ * optional human-readable code snippet on a compiled rule); here it is the
1599
+ * load-bearing positive-control preimage, so non-empty is required.
1600
+ */
1601
+ badExample: z.ZodEffects<z.ZodString, string, string>;
1602
+ /** The fixed POSTIMAGE exemplar the matcher must stay SILENT on (§4) — a lesson `goodExample`. */
1603
+ goodExample: z.ZodEffects<z.ZodString, string, string>;
1604
+ }, "strict", z.ZodTypeAny, {
1605
+ kind: "lesson";
1606
+ lessonRef: string;
1607
+ badExample: string;
1608
+ goodExample: string;
1609
+ }, {
1610
+ kind: "lesson";
1611
+ lessonRef: string;
1612
+ badExample: string;
1613
+ goodExample: string;
1614
+ }>, z.ZodObject<{
1615
+ kind: z.ZodLiteral<"commit">;
1616
+ /** The PARENT (pre-fix) commit where the DEFECT is present — the matcher must FIRE on this (ADR-112 §4). */
1617
+ preimageCommitSha: z.ZodString;
1618
+ /** The PR's merge/squash commit — the post-fix (defect-absent) anchor; the matcher must stay SILENT on this. */
1619
+ mergeCommitSha: z.ZodString;
1620
+ }, "strict", z.ZodTypeAny, {
1621
+ kind: "commit";
1622
+ preimageCommitSha: string;
1623
+ mergeCommitSha: string;
1624
+ }, {
1625
+ kind: "commit";
1626
+ preimageCommitSha: string;
1627
+ mergeCommitSha: string;
1628
+ }>]>;
1629
+ /** File the defect locus lives in. */
1630
+ filePath: z.ZodEffects<z.ZodString, string, string>;
1631
+ /** Line-range or AST-node path — the defect locus, not just the file. */
1632
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
1633
+ /** Span content hash, line-drift-stable (cf. `firingLabelId`). */
1634
+ contentHash: z.ZodEffects<z.ZodString, string, string>;
1635
+ }, "strict", z.ZodTypeAny, {
1636
+ pr: number;
1637
+ preimageSource: {
1638
+ kind: "lesson";
1639
+ lessonRef: string;
1640
+ badExample: string;
1641
+ goodExample: string;
1642
+ } | {
1643
+ kind: "commit";
1644
+ preimageCommitSha: string;
1645
+ mergeCommitSha: string;
1646
+ };
1647
+ filePath: string;
1648
+ matchedSpan: string;
1649
+ contentHash: string;
1650
+ }, {
1651
+ pr: number;
1652
+ preimageSource: {
1653
+ kind: "lesson";
1654
+ lessonRef: string;
1655
+ badExample: string;
1656
+ goodExample: string;
1657
+ } | {
1658
+ kind: "commit";
1659
+ preimageCommitSha: string;
1660
+ mergeCommitSha: string;
1661
+ };
1662
+ filePath: string;
1663
+ matchedSpan: string;
1664
+ contentHash: string;
1665
+ }>, {
1666
+ pr: number;
1667
+ preimageSource: {
1668
+ kind: "lesson";
1669
+ lessonRef: string;
1670
+ badExample: string;
1671
+ goodExample: string;
1672
+ } | {
1673
+ kind: "commit";
1674
+ preimageCommitSha: string;
1675
+ mergeCommitSha: string;
1676
+ };
1677
+ filePath: string;
1678
+ matchedSpan: string;
1679
+ contentHash: string;
1680
+ }, {
1681
+ pr: number;
1682
+ preimageSource: {
1683
+ kind: "lesson";
1684
+ lessonRef: string;
1685
+ badExample: string;
1686
+ goodExample: string;
1687
+ } | {
1688
+ kind: "commit";
1689
+ preimageCommitSha: string;
1690
+ mergeCommitSha: string;
1691
+ };
1692
+ filePath: string;
1693
+ matchedSpan: string;
1694
+ contentHash: string;
1695
+ }>, "many">;
1696
+ /** Declared near-misses the rule must stay silent on (feeds §6 negative controls). */
1697
+ negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1698
+ /** The PR where the defect was caught/introduced (the in-corpus anchor). */
1699
+ pr: z.ZodNumber;
1700
+ /** The §4 preimage-differential source — lesson-anchored (PRIMARY) or commit-pair (FALLBACK). */
1701
+ preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1702
+ kind: z.ZodLiteral<"lesson">;
1703
+ /** IMMUTABLE lesson id/hash (the 16-hex `hashLesson` codomain) — never a path/mutable alias (§4/§8). */
1704
+ lessonRef: z.ZodString;
1705
+ /**
1706
+ * The defect PREIMAGE exemplar the matcher must FIRE on (§4). This is a lesson
1707
+ * corpus `badExample` — distinct from `CompiledRuleBaseSchema.badExample` (an
1708
+ * optional human-readable code snippet on a compiled rule); here it is the
1709
+ * load-bearing positive-control preimage, so non-empty is required.
1710
+ */
1711
+ badExample: z.ZodEffects<z.ZodString, string, string>;
1712
+ /** The fixed POSTIMAGE exemplar the matcher must stay SILENT on (§4) — a lesson `goodExample`. */
1713
+ goodExample: z.ZodEffects<z.ZodString, string, string>;
1714
+ }, "strict", z.ZodTypeAny, {
1715
+ kind: "lesson";
1716
+ lessonRef: string;
1717
+ badExample: string;
1718
+ goodExample: string;
1719
+ }, {
1720
+ kind: "lesson";
1721
+ lessonRef: string;
1722
+ badExample: string;
1723
+ goodExample: string;
1724
+ }>, z.ZodObject<{
1725
+ kind: z.ZodLiteral<"commit">;
1726
+ /** The PARENT (pre-fix) commit where the DEFECT is present — the matcher must FIRE on this (ADR-112 §4). */
1727
+ preimageCommitSha: z.ZodString;
1728
+ /** The PR's merge/squash commit — the post-fix (defect-absent) anchor; the matcher must stay SILENT on this. */
1729
+ mergeCommitSha: z.ZodString;
1730
+ }, "strict", z.ZodTypeAny, {
1731
+ kind: "commit";
1732
+ preimageCommitSha: string;
1733
+ mergeCommitSha: string;
1734
+ }, {
1735
+ kind: "commit";
1736
+ preimageCommitSha: string;
1737
+ mergeCommitSha: string;
1738
+ }>]>;
1739
+ /** File the defect locus lives in. */
1740
+ filePath: z.ZodEffects<z.ZodString, string, string>;
1741
+ /** Line-range or AST-node path — the defect locus, not just the file. */
1742
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
1743
+ /** Span content hash, line-drift-stable (cf. `firingLabelId`). */
1744
+ contentHash: z.ZodEffects<z.ZodString, string, string>;
1745
+ }, "strict", z.ZodTypeAny, {
1746
+ pr: number;
1747
+ preimageSource: {
1748
+ kind: "lesson";
1749
+ lessonRef: string;
1750
+ badExample: string;
1751
+ goodExample: string;
1752
+ } | {
1753
+ kind: "commit";
1754
+ preimageCommitSha: string;
1755
+ mergeCommitSha: string;
1756
+ };
1757
+ filePath: string;
1758
+ matchedSpan: string;
1759
+ contentHash: string;
1760
+ }, {
1761
+ pr: number;
1762
+ preimageSource: {
1763
+ kind: "lesson";
1764
+ lessonRef: string;
1765
+ badExample: string;
1766
+ goodExample: string;
1767
+ } | {
1768
+ kind: "commit";
1769
+ preimageCommitSha: string;
1770
+ mergeCommitSha: string;
1771
+ };
1772
+ filePath: string;
1773
+ matchedSpan: string;
1774
+ contentHash: string;
1775
+ }>, {
1776
+ pr: number;
1777
+ preimageSource: {
1778
+ kind: "lesson";
1779
+ lessonRef: string;
1780
+ badExample: string;
1781
+ goodExample: string;
1782
+ } | {
1783
+ kind: "commit";
1784
+ preimageCommitSha: string;
1785
+ mergeCommitSha: string;
1786
+ };
1787
+ filePath: string;
1788
+ matchedSpan: string;
1789
+ contentHash: string;
1790
+ }, {
1791
+ pr: number;
1792
+ preimageSource: {
1793
+ kind: "lesson";
1794
+ lessonRef: string;
1795
+ badExample: string;
1796
+ goodExample: string;
1797
+ } | {
1798
+ kind: "commit";
1799
+ preimageCommitSha: string;
1800
+ mergeCommitSha: string;
1801
+ };
1802
+ filePath: string;
1803
+ matchedSpan: string;
1804
+ contentHash: string;
1805
+ }>, "many">>;
1806
+ }, "strip", z.ZodTypeAny, {
1807
+ kind: "authored";
1808
+ author: string;
1809
+ authoredAt: string;
1810
+ targetDefect: string;
1811
+ positiveFixtures: {
1812
+ pr: number;
1813
+ preimageSource: {
1814
+ kind: "lesson";
1815
+ lessonRef: string;
1816
+ badExample: string;
1817
+ goodExample: string;
1818
+ } | {
1819
+ kind: "commit";
1820
+ preimageCommitSha: string;
1821
+ mergeCommitSha: string;
1822
+ };
1823
+ filePath: string;
1824
+ matchedSpan: string;
1825
+ contentHash: string;
1826
+ }[];
1827
+ negativeFixtures?: {
1828
+ pr: number;
1829
+ preimageSource: {
1830
+ kind: "lesson";
1831
+ lessonRef: string;
1832
+ badExample: string;
1833
+ goodExample: string;
1834
+ } | {
1835
+ kind: "commit";
1836
+ preimageCommitSha: string;
1837
+ mergeCommitSha: string;
1838
+ };
1839
+ filePath: string;
1840
+ matchedSpan: string;
1841
+ contentHash: string;
1842
+ }[] | undefined;
1843
+ }, {
1844
+ kind: "authored";
1845
+ author: string;
1846
+ authoredAt: string;
1847
+ targetDefect: string;
1848
+ positiveFixtures: {
1849
+ pr: number;
1850
+ preimageSource: {
1851
+ kind: "lesson";
1852
+ lessonRef: string;
1853
+ badExample: string;
1854
+ goodExample: string;
1855
+ } | {
1856
+ kind: "commit";
1857
+ preimageCommitSha: string;
1858
+ mergeCommitSha: string;
1859
+ };
1860
+ filePath: string;
1861
+ matchedSpan: string;
1862
+ contentHash: string;
1863
+ }[];
1864
+ negativeFixtures?: {
1865
+ pr: number;
1866
+ preimageSource: {
1867
+ kind: "lesson";
1868
+ lessonRef: string;
1869
+ badExample: string;
1870
+ goodExample: string;
1871
+ } | {
1872
+ kind: "commit";
1873
+ preimageCommitSha: string;
1874
+ mergeCommitSha: string;
1875
+ };
1876
+ filePath: string;
1877
+ matchedSpan: string;
1878
+ contentHash: string;
1879
+ }[] | undefined;
1880
+ }>, z.ZodObject<{
1881
+ /**
1882
+ * ADR-112 discriminator. OPTIONAL on the mined wire so legacy records (which
1883
+ * have no `kind`) round-trip byte-identical; absence is read as `'mined'` by
1884
+ * `provenanceKind()`. A new mined artifact MAY carry `kind: 'mined'` only
1885
+ * where the resulting hash churn is intentional.
1886
+ */
1887
+ kind: z.ZodOptional<z.ZodLiteral<"mined">>;
313
1888
  /** Merged PR the rule was mined from (positive integer PR number). */
314
1889
  mergedPr: z.ZodNumber;
315
1890
  /**
@@ -327,11 +1902,13 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
327
1902
  mergedPr: number;
328
1903
  reviewThread: string;
329
1904
  commitSha: string;
1905
+ kind?: "mined" | undefined;
330
1906
  }, {
331
1907
  mergedPr: number;
332
1908
  reviewThread: string;
333
1909
  commitSha: string;
334
- }>;
1910
+ kind?: "mined" | undefined;
1911
+ }>]>;
335
1912
  positiveControl: z.ZodBoolean;
336
1913
  negativeControl: z.ZodBoolean;
337
1914
  }, "strip", z.ZodTypeAny, {
@@ -339,6 +1916,44 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
339
1916
  mergedPr: number;
340
1917
  reviewThread: string;
341
1918
  commitSha: string;
1919
+ kind?: "mined" | undefined;
1920
+ } | {
1921
+ kind: "authored";
1922
+ author: string;
1923
+ authoredAt: string;
1924
+ targetDefect: string;
1925
+ positiveFixtures: {
1926
+ pr: number;
1927
+ preimageSource: {
1928
+ kind: "lesson";
1929
+ lessonRef: string;
1930
+ badExample: string;
1931
+ goodExample: string;
1932
+ } | {
1933
+ kind: "commit";
1934
+ preimageCommitSha: string;
1935
+ mergeCommitSha: string;
1936
+ };
1937
+ filePath: string;
1938
+ matchedSpan: string;
1939
+ contentHash: string;
1940
+ }[];
1941
+ negativeFixtures?: {
1942
+ pr: number;
1943
+ preimageSource: {
1944
+ kind: "lesson";
1945
+ lessonRef: string;
1946
+ badExample: string;
1947
+ goodExample: string;
1948
+ } | {
1949
+ kind: "commit";
1950
+ preimageCommitSha: string;
1951
+ mergeCommitSha: string;
1952
+ };
1953
+ filePath: string;
1954
+ matchedSpan: string;
1955
+ contentHash: string;
1956
+ }[] | undefined;
342
1957
  };
343
1958
  positiveControl: boolean;
344
1959
  negativeControl: boolean;
@@ -347,6 +1962,44 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
347
1962
  mergedPr: number;
348
1963
  reviewThread: string;
349
1964
  commitSha: string;
1965
+ kind?: "mined" | undefined;
1966
+ } | {
1967
+ kind: "authored";
1968
+ author: string;
1969
+ authoredAt: string;
1970
+ targetDefect: string;
1971
+ positiveFixtures: {
1972
+ pr: number;
1973
+ preimageSource: {
1974
+ kind: "lesson";
1975
+ lessonRef: string;
1976
+ badExample: string;
1977
+ goodExample: string;
1978
+ } | {
1979
+ kind: "commit";
1980
+ preimageCommitSha: string;
1981
+ mergeCommitSha: string;
1982
+ };
1983
+ filePath: string;
1984
+ matchedSpan: string;
1985
+ contentHash: string;
1986
+ }[];
1987
+ negativeFixtures?: {
1988
+ pr: number;
1989
+ preimageSource: {
1990
+ kind: "lesson";
1991
+ lessonRef: string;
1992
+ badExample: string;
1993
+ goodExample: string;
1994
+ } | {
1995
+ kind: "commit";
1996
+ preimageCommitSha: string;
1997
+ mergeCommitSha: string;
1998
+ };
1999
+ filePath: string;
2000
+ matchedSpan: string;
2001
+ contentHash: string;
2002
+ }[] | undefined;
350
2003
  };
351
2004
  positiveControl: boolean;
352
2005
  negativeControl: boolean;
@@ -370,13 +2023,13 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
370
2023
  engine: "regex" | "ast" | "ast-grep";
371
2024
  compiledAt: string;
372
2025
  status?: "active" | "archived" | "untested-against-codebase" | "pending-verification" | undefined;
2026
+ badExample?: string | undefined;
2027
+ goodExample?: string | undefined;
373
2028
  astQuery?: string | undefined;
374
2029
  astGrepPattern?: string | undefined;
375
2030
  astGrepYamlRule?: z.objectOutputType<{
376
2031
  rule: z.ZodRecord<z.ZodString, z.ZodUnknown>;
377
2032
  }, z.ZodTypeAny, "passthrough"> | undefined;
378
- badExample?: string | undefined;
379
- goodExample?: string | undefined;
380
2033
  createdAt?: string | undefined;
381
2034
  fileGlobs?: string[] | undefined;
382
2035
  category?: "security" | "architecture" | "style" | "performance" | undefined;
@@ -392,6 +2045,44 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
392
2045
  mergedPr: number;
393
2046
  reviewThread: string;
394
2047
  commitSha: string;
2048
+ kind?: "mined" | undefined;
2049
+ } | {
2050
+ kind: "authored";
2051
+ author: string;
2052
+ authoredAt: string;
2053
+ targetDefect: string;
2054
+ positiveFixtures: {
2055
+ pr: number;
2056
+ preimageSource: {
2057
+ kind: "lesson";
2058
+ lessonRef: string;
2059
+ badExample: string;
2060
+ goodExample: string;
2061
+ } | {
2062
+ kind: "commit";
2063
+ preimageCommitSha: string;
2064
+ mergeCommitSha: string;
2065
+ };
2066
+ filePath: string;
2067
+ matchedSpan: string;
2068
+ contentHash: string;
2069
+ }[];
2070
+ negativeFixtures?: {
2071
+ pr: number;
2072
+ preimageSource: {
2073
+ kind: "lesson";
2074
+ lessonRef: string;
2075
+ badExample: string;
2076
+ goodExample: string;
2077
+ } | {
2078
+ kind: "commit";
2079
+ preimageCommitSha: string;
2080
+ mergeCommitSha: string;
2081
+ };
2082
+ filePath: string;
2083
+ matchedSpan: string;
2084
+ contentHash: string;
2085
+ }[] | undefined;
395
2086
  };
396
2087
  positiveControl: boolean;
397
2088
  negativeControl: boolean;
@@ -405,13 +2096,13 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
405
2096
  engine: "regex" | "ast" | "ast-grep";
406
2097
  compiledAt: string;
407
2098
  status?: "active" | "archived" | "untested-against-codebase" | "pending-verification" | undefined;
2099
+ badExample?: string | undefined;
2100
+ goodExample?: string | undefined;
408
2101
  astQuery?: string | undefined;
409
2102
  astGrepPattern?: string | undefined;
410
2103
  astGrepYamlRule?: z.objectInputType<{
411
2104
  rule: z.ZodRecord<z.ZodString, z.ZodUnknown>;
412
2105
  }, z.ZodTypeAny, "passthrough"> | undefined;
413
- badExample?: string | undefined;
414
- goodExample?: string | undefined;
415
2106
  createdAt?: string | undefined;
416
2107
  fileGlobs?: string[] | undefined;
417
2108
  category?: "security" | "architecture" | "style" | "performance" | undefined;
@@ -427,6 +2118,44 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
427
2118
  mergedPr: number;
428
2119
  reviewThread: string;
429
2120
  commitSha: string;
2121
+ kind?: "mined" | undefined;
2122
+ } | {
2123
+ kind: "authored";
2124
+ author: string;
2125
+ authoredAt: string;
2126
+ targetDefect: string;
2127
+ positiveFixtures: {
2128
+ pr: number;
2129
+ preimageSource: {
2130
+ kind: "lesson";
2131
+ lessonRef: string;
2132
+ badExample: string;
2133
+ goodExample: string;
2134
+ } | {
2135
+ kind: "commit";
2136
+ preimageCommitSha: string;
2137
+ mergeCommitSha: string;
2138
+ };
2139
+ filePath: string;
2140
+ matchedSpan: string;
2141
+ contentHash: string;
2142
+ }[];
2143
+ negativeFixtures?: {
2144
+ pr: number;
2145
+ preimageSource: {
2146
+ kind: "lesson";
2147
+ lessonRef: string;
2148
+ badExample: string;
2149
+ goodExample: string;
2150
+ } | {
2151
+ kind: "commit";
2152
+ preimageCommitSha: string;
2153
+ mergeCommitSha: string;
2154
+ };
2155
+ filePath: string;
2156
+ matchedSpan: string;
2157
+ contentHash: string;
2158
+ }[] | undefined;
430
2159
  };
431
2160
  positiveControl: boolean;
432
2161
  negativeControl: boolean;
@@ -440,13 +2169,13 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
440
2169
  engine: "regex" | "ast" | "ast-grep";
441
2170
  compiledAt: string;
442
2171
  status?: "active" | "archived" | "untested-against-codebase" | "pending-verification" | undefined;
2172
+ badExample?: string | undefined;
2173
+ goodExample?: string | undefined;
443
2174
  astQuery?: string | undefined;
444
2175
  astGrepPattern?: string | undefined;
445
2176
  astGrepYamlRule?: z.objectOutputType<{
446
2177
  rule: z.ZodRecord<z.ZodString, z.ZodUnknown>;
447
2178
  }, z.ZodTypeAny, "passthrough"> | undefined;
448
- badExample?: string | undefined;
449
- goodExample?: string | undefined;
450
2179
  createdAt?: string | undefined;
451
2180
  fileGlobs?: string[] | undefined;
452
2181
  category?: "security" | "architecture" | "style" | "performance" | undefined;
@@ -462,6 +2191,44 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
462
2191
  mergedPr: number;
463
2192
  reviewThread: string;
464
2193
  commitSha: string;
2194
+ kind?: "mined" | undefined;
2195
+ } | {
2196
+ kind: "authored";
2197
+ author: string;
2198
+ authoredAt: string;
2199
+ targetDefect: string;
2200
+ positiveFixtures: {
2201
+ pr: number;
2202
+ preimageSource: {
2203
+ kind: "lesson";
2204
+ lessonRef: string;
2205
+ badExample: string;
2206
+ goodExample: string;
2207
+ } | {
2208
+ kind: "commit";
2209
+ preimageCommitSha: string;
2210
+ mergeCommitSha: string;
2211
+ };
2212
+ filePath: string;
2213
+ matchedSpan: string;
2214
+ contentHash: string;
2215
+ }[];
2216
+ negativeFixtures?: {
2217
+ pr: number;
2218
+ preimageSource: {
2219
+ kind: "lesson";
2220
+ lessonRef: string;
2221
+ badExample: string;
2222
+ goodExample: string;
2223
+ } | {
2224
+ kind: "commit";
2225
+ preimageCommitSha: string;
2226
+ mergeCommitSha: string;
2227
+ };
2228
+ filePath: string;
2229
+ matchedSpan: string;
2230
+ contentHash: string;
2231
+ }[] | undefined;
465
2232
  };
466
2233
  positiveControl: boolean;
467
2234
  negativeControl: boolean;
@@ -475,13 +2242,13 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
475
2242
  engine: "regex" | "ast" | "ast-grep";
476
2243
  compiledAt: string;
477
2244
  status?: "active" | "archived" | "untested-against-codebase" | "pending-verification" | undefined;
2245
+ badExample?: string | undefined;
2246
+ goodExample?: string | undefined;
478
2247
  astQuery?: string | undefined;
479
2248
  astGrepPattern?: string | undefined;
480
2249
  astGrepYamlRule?: z.objectInputType<{
481
2250
  rule: z.ZodRecord<z.ZodString, z.ZodUnknown>;
482
2251
  }, z.ZodTypeAny, "passthrough"> | undefined;
483
- badExample?: string | undefined;
484
- goodExample?: string | undefined;
485
2252
  createdAt?: string | undefined;
486
2253
  fileGlobs?: string[] | undefined;
487
2254
  category?: "security" | "architecture" | "style" | "performance" | undefined;
@@ -497,6 +2264,44 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
497
2264
  mergedPr: number;
498
2265
  reviewThread: string;
499
2266
  commitSha: string;
2267
+ kind?: "mined" | undefined;
2268
+ } | {
2269
+ kind: "authored";
2270
+ author: string;
2271
+ authoredAt: string;
2272
+ targetDefect: string;
2273
+ positiveFixtures: {
2274
+ pr: number;
2275
+ preimageSource: {
2276
+ kind: "lesson";
2277
+ lessonRef: string;
2278
+ badExample: string;
2279
+ goodExample: string;
2280
+ } | {
2281
+ kind: "commit";
2282
+ preimageCommitSha: string;
2283
+ mergeCommitSha: string;
2284
+ };
2285
+ filePath: string;
2286
+ matchedSpan: string;
2287
+ contentHash: string;
2288
+ }[];
2289
+ negativeFixtures?: {
2290
+ pr: number;
2291
+ preimageSource: {
2292
+ kind: "lesson";
2293
+ lessonRef: string;
2294
+ badExample: string;
2295
+ goodExample: string;
2296
+ } | {
2297
+ kind: "commit";
2298
+ preimageCommitSha: string;
2299
+ mergeCommitSha: string;
2300
+ };
2301
+ filePath: string;
2302
+ matchedSpan: string;
2303
+ contentHash: string;
2304
+ }[] | undefined;
500
2305
  };
501
2306
  positiveControl: boolean;
502
2307
  negativeControl: boolean;
@@ -794,7 +2599,316 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
794
2599
  * signal and preserves pre-#2183 manifest hashes via canonicalStringify.
795
2600
  */
796
2601
  legitimacy: z.ZodOptional<z.ZodObject<{
797
- provenance: z.ZodObject<{
2602
+ provenance: z.ZodUnion<[z.ZodObject<{
2603
+ kind: z.ZodLiteral<"authored">;
2604
+ /** Agent-id or operator handle — attributable, never anonymous. */
2605
+ author: z.ZodEffects<z.ZodString, string, string>;
2606
+ /** ISO-8601 authoring date — a real calendar date (`YYYY-MM-DD`) or a full timestamp. */
2607
+ authoredAt: z.ZodEffects<z.ZodString, string, string>;
2608
+ /** The declared DEFECT the rule targets — the pre-image, not its fix. */
2609
+ targetDefect: z.ZodEffects<z.ZodString, string, string>;
2610
+ /** ≥1 real lc instance the rule claims to catch — ALL train-side (§5). */
2611
+ positiveFixtures: z.ZodArray<z.ZodEffects<z.ZodObject<{
2612
+ /** The PR where the defect was caught/introduced (the in-corpus anchor). */
2613
+ pr: z.ZodNumber;
2614
+ /** The §4 preimage-differential source — lesson-anchored (PRIMARY) or commit-pair (FALLBACK). */
2615
+ preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2616
+ kind: z.ZodLiteral<"lesson">;
2617
+ /** IMMUTABLE lesson id/hash (the 16-hex `hashLesson` codomain) — never a path/mutable alias (§4/§8). */
2618
+ lessonRef: z.ZodString;
2619
+ /**
2620
+ * The defect PREIMAGE exemplar the matcher must FIRE on (§4). This is a lesson
2621
+ * corpus `badExample` — distinct from `CompiledRuleBaseSchema.badExample` (an
2622
+ * optional human-readable code snippet on a compiled rule); here it is the
2623
+ * load-bearing positive-control preimage, so non-empty is required.
2624
+ */
2625
+ badExample: z.ZodEffects<z.ZodString, string, string>;
2626
+ /** The fixed POSTIMAGE exemplar the matcher must stay SILENT on (§4) — a lesson `goodExample`. */
2627
+ goodExample: z.ZodEffects<z.ZodString, string, string>;
2628
+ }, "strict", z.ZodTypeAny, {
2629
+ kind: "lesson";
2630
+ lessonRef: string;
2631
+ badExample: string;
2632
+ goodExample: string;
2633
+ }, {
2634
+ kind: "lesson";
2635
+ lessonRef: string;
2636
+ badExample: string;
2637
+ goodExample: string;
2638
+ }>, z.ZodObject<{
2639
+ kind: z.ZodLiteral<"commit">;
2640
+ /** The PARENT (pre-fix) commit where the DEFECT is present — the matcher must FIRE on this (ADR-112 §4). */
2641
+ preimageCommitSha: z.ZodString;
2642
+ /** The PR's merge/squash commit — the post-fix (defect-absent) anchor; the matcher must stay SILENT on this. */
2643
+ mergeCommitSha: z.ZodString;
2644
+ }, "strict", z.ZodTypeAny, {
2645
+ kind: "commit";
2646
+ preimageCommitSha: string;
2647
+ mergeCommitSha: string;
2648
+ }, {
2649
+ kind: "commit";
2650
+ preimageCommitSha: string;
2651
+ mergeCommitSha: string;
2652
+ }>]>;
2653
+ /** File the defect locus lives in. */
2654
+ filePath: z.ZodEffects<z.ZodString, string, string>;
2655
+ /** Line-range or AST-node path — the defect locus, not just the file. */
2656
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
2657
+ /** Span content hash, line-drift-stable (cf. `firingLabelId`). */
2658
+ contentHash: z.ZodEffects<z.ZodString, string, string>;
2659
+ }, "strict", z.ZodTypeAny, {
2660
+ pr: number;
2661
+ preimageSource: {
2662
+ kind: "lesson";
2663
+ lessonRef: string;
2664
+ badExample: string;
2665
+ goodExample: string;
2666
+ } | {
2667
+ kind: "commit";
2668
+ preimageCommitSha: string;
2669
+ mergeCommitSha: string;
2670
+ };
2671
+ filePath: string;
2672
+ matchedSpan: string;
2673
+ contentHash: string;
2674
+ }, {
2675
+ pr: number;
2676
+ preimageSource: {
2677
+ kind: "lesson";
2678
+ lessonRef: string;
2679
+ badExample: string;
2680
+ goodExample: string;
2681
+ } | {
2682
+ kind: "commit";
2683
+ preimageCommitSha: string;
2684
+ mergeCommitSha: string;
2685
+ };
2686
+ filePath: string;
2687
+ matchedSpan: string;
2688
+ contentHash: string;
2689
+ }>, {
2690
+ pr: number;
2691
+ preimageSource: {
2692
+ kind: "lesson";
2693
+ lessonRef: string;
2694
+ badExample: string;
2695
+ goodExample: string;
2696
+ } | {
2697
+ kind: "commit";
2698
+ preimageCommitSha: string;
2699
+ mergeCommitSha: string;
2700
+ };
2701
+ filePath: string;
2702
+ matchedSpan: string;
2703
+ contentHash: string;
2704
+ }, {
2705
+ pr: number;
2706
+ preimageSource: {
2707
+ kind: "lesson";
2708
+ lessonRef: string;
2709
+ badExample: string;
2710
+ goodExample: string;
2711
+ } | {
2712
+ kind: "commit";
2713
+ preimageCommitSha: string;
2714
+ mergeCommitSha: string;
2715
+ };
2716
+ filePath: string;
2717
+ matchedSpan: string;
2718
+ contentHash: string;
2719
+ }>, "many">;
2720
+ /** Declared near-misses the rule must stay silent on (feeds §6 negative controls). */
2721
+ negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
2722
+ /** The PR where the defect was caught/introduced (the in-corpus anchor). */
2723
+ pr: z.ZodNumber;
2724
+ /** The §4 preimage-differential source — lesson-anchored (PRIMARY) or commit-pair (FALLBACK). */
2725
+ preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2726
+ kind: z.ZodLiteral<"lesson">;
2727
+ /** IMMUTABLE lesson id/hash (the 16-hex `hashLesson` codomain) — never a path/mutable alias (§4/§8). */
2728
+ lessonRef: z.ZodString;
2729
+ /**
2730
+ * The defect PREIMAGE exemplar the matcher must FIRE on (§4). This is a lesson
2731
+ * corpus `badExample` — distinct from `CompiledRuleBaseSchema.badExample` (an
2732
+ * optional human-readable code snippet on a compiled rule); here it is the
2733
+ * load-bearing positive-control preimage, so non-empty is required.
2734
+ */
2735
+ badExample: z.ZodEffects<z.ZodString, string, string>;
2736
+ /** The fixed POSTIMAGE exemplar the matcher must stay SILENT on (§4) — a lesson `goodExample`. */
2737
+ goodExample: z.ZodEffects<z.ZodString, string, string>;
2738
+ }, "strict", z.ZodTypeAny, {
2739
+ kind: "lesson";
2740
+ lessonRef: string;
2741
+ badExample: string;
2742
+ goodExample: string;
2743
+ }, {
2744
+ kind: "lesson";
2745
+ lessonRef: string;
2746
+ badExample: string;
2747
+ goodExample: string;
2748
+ }>, z.ZodObject<{
2749
+ kind: z.ZodLiteral<"commit">;
2750
+ /** The PARENT (pre-fix) commit where the DEFECT is present — the matcher must FIRE on this (ADR-112 §4). */
2751
+ preimageCommitSha: z.ZodString;
2752
+ /** The PR's merge/squash commit — the post-fix (defect-absent) anchor; the matcher must stay SILENT on this. */
2753
+ mergeCommitSha: z.ZodString;
2754
+ }, "strict", z.ZodTypeAny, {
2755
+ kind: "commit";
2756
+ preimageCommitSha: string;
2757
+ mergeCommitSha: string;
2758
+ }, {
2759
+ kind: "commit";
2760
+ preimageCommitSha: string;
2761
+ mergeCommitSha: string;
2762
+ }>]>;
2763
+ /** File the defect locus lives in. */
2764
+ filePath: z.ZodEffects<z.ZodString, string, string>;
2765
+ /** Line-range or AST-node path — the defect locus, not just the file. */
2766
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
2767
+ /** Span content hash, line-drift-stable (cf. `firingLabelId`). */
2768
+ contentHash: z.ZodEffects<z.ZodString, string, string>;
2769
+ }, "strict", z.ZodTypeAny, {
2770
+ pr: number;
2771
+ preimageSource: {
2772
+ kind: "lesson";
2773
+ lessonRef: string;
2774
+ badExample: string;
2775
+ goodExample: string;
2776
+ } | {
2777
+ kind: "commit";
2778
+ preimageCommitSha: string;
2779
+ mergeCommitSha: string;
2780
+ };
2781
+ filePath: string;
2782
+ matchedSpan: string;
2783
+ contentHash: string;
2784
+ }, {
2785
+ pr: number;
2786
+ preimageSource: {
2787
+ kind: "lesson";
2788
+ lessonRef: string;
2789
+ badExample: string;
2790
+ goodExample: string;
2791
+ } | {
2792
+ kind: "commit";
2793
+ preimageCommitSha: string;
2794
+ mergeCommitSha: string;
2795
+ };
2796
+ filePath: string;
2797
+ matchedSpan: string;
2798
+ contentHash: string;
2799
+ }>, {
2800
+ pr: number;
2801
+ preimageSource: {
2802
+ kind: "lesson";
2803
+ lessonRef: string;
2804
+ badExample: string;
2805
+ goodExample: string;
2806
+ } | {
2807
+ kind: "commit";
2808
+ preimageCommitSha: string;
2809
+ mergeCommitSha: string;
2810
+ };
2811
+ filePath: string;
2812
+ matchedSpan: string;
2813
+ contentHash: string;
2814
+ }, {
2815
+ pr: number;
2816
+ preimageSource: {
2817
+ kind: "lesson";
2818
+ lessonRef: string;
2819
+ badExample: string;
2820
+ goodExample: string;
2821
+ } | {
2822
+ kind: "commit";
2823
+ preimageCommitSha: string;
2824
+ mergeCommitSha: string;
2825
+ };
2826
+ filePath: string;
2827
+ matchedSpan: string;
2828
+ contentHash: string;
2829
+ }>, "many">>;
2830
+ }, "strip", z.ZodTypeAny, {
2831
+ kind: "authored";
2832
+ author: string;
2833
+ authoredAt: string;
2834
+ targetDefect: string;
2835
+ positiveFixtures: {
2836
+ pr: number;
2837
+ preimageSource: {
2838
+ kind: "lesson";
2839
+ lessonRef: string;
2840
+ badExample: string;
2841
+ goodExample: string;
2842
+ } | {
2843
+ kind: "commit";
2844
+ preimageCommitSha: string;
2845
+ mergeCommitSha: string;
2846
+ };
2847
+ filePath: string;
2848
+ matchedSpan: string;
2849
+ contentHash: string;
2850
+ }[];
2851
+ negativeFixtures?: {
2852
+ pr: number;
2853
+ preimageSource: {
2854
+ kind: "lesson";
2855
+ lessonRef: string;
2856
+ badExample: string;
2857
+ goodExample: string;
2858
+ } | {
2859
+ kind: "commit";
2860
+ preimageCommitSha: string;
2861
+ mergeCommitSha: string;
2862
+ };
2863
+ filePath: string;
2864
+ matchedSpan: string;
2865
+ contentHash: string;
2866
+ }[] | undefined;
2867
+ }, {
2868
+ kind: "authored";
2869
+ author: string;
2870
+ authoredAt: string;
2871
+ targetDefect: string;
2872
+ positiveFixtures: {
2873
+ pr: number;
2874
+ preimageSource: {
2875
+ kind: "lesson";
2876
+ lessonRef: string;
2877
+ badExample: string;
2878
+ goodExample: string;
2879
+ } | {
2880
+ kind: "commit";
2881
+ preimageCommitSha: string;
2882
+ mergeCommitSha: string;
2883
+ };
2884
+ filePath: string;
2885
+ matchedSpan: string;
2886
+ contentHash: string;
2887
+ }[];
2888
+ negativeFixtures?: {
2889
+ pr: number;
2890
+ preimageSource: {
2891
+ kind: "lesson";
2892
+ lessonRef: string;
2893
+ badExample: string;
2894
+ goodExample: string;
2895
+ } | {
2896
+ kind: "commit";
2897
+ preimageCommitSha: string;
2898
+ mergeCommitSha: string;
2899
+ };
2900
+ filePath: string;
2901
+ matchedSpan: string;
2902
+ contentHash: string;
2903
+ }[] | undefined;
2904
+ }>, z.ZodObject<{
2905
+ /**
2906
+ * ADR-112 discriminator. OPTIONAL on the mined wire so legacy records (which
2907
+ * have no `kind`) round-trip byte-identical; absence is read as `'mined'` by
2908
+ * `provenanceKind()`. A new mined artifact MAY carry `kind: 'mined'` only
2909
+ * where the resulting hash churn is intentional.
2910
+ */
2911
+ kind: z.ZodOptional<z.ZodLiteral<"mined">>;
798
2912
  /** Merged PR the rule was mined from (positive integer PR number). */
799
2913
  mergedPr: z.ZodNumber;
800
2914
  /**
@@ -812,11 +2926,13 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
812
2926
  mergedPr: number;
813
2927
  reviewThread: string;
814
2928
  commitSha: string;
2929
+ kind?: "mined" | undefined;
815
2930
  }, {
816
2931
  mergedPr: number;
817
2932
  reviewThread: string;
818
2933
  commitSha: string;
819
- }>;
2934
+ kind?: "mined" | undefined;
2935
+ }>]>;
820
2936
  positiveControl: z.ZodBoolean;
821
2937
  negativeControl: z.ZodBoolean;
822
2938
  }, "strip", z.ZodTypeAny, {
@@ -824,6 +2940,44 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
824
2940
  mergedPr: number;
825
2941
  reviewThread: string;
826
2942
  commitSha: string;
2943
+ kind?: "mined" | undefined;
2944
+ } | {
2945
+ kind: "authored";
2946
+ author: string;
2947
+ authoredAt: string;
2948
+ targetDefect: string;
2949
+ positiveFixtures: {
2950
+ pr: number;
2951
+ preimageSource: {
2952
+ kind: "lesson";
2953
+ lessonRef: string;
2954
+ badExample: string;
2955
+ goodExample: string;
2956
+ } | {
2957
+ kind: "commit";
2958
+ preimageCommitSha: string;
2959
+ mergeCommitSha: string;
2960
+ };
2961
+ filePath: string;
2962
+ matchedSpan: string;
2963
+ contentHash: string;
2964
+ }[];
2965
+ negativeFixtures?: {
2966
+ pr: number;
2967
+ preimageSource: {
2968
+ kind: "lesson";
2969
+ lessonRef: string;
2970
+ badExample: string;
2971
+ goodExample: string;
2972
+ } | {
2973
+ kind: "commit";
2974
+ preimageCommitSha: string;
2975
+ mergeCommitSha: string;
2976
+ };
2977
+ filePath: string;
2978
+ matchedSpan: string;
2979
+ contentHash: string;
2980
+ }[] | undefined;
827
2981
  };
828
2982
  positiveControl: boolean;
829
2983
  negativeControl: boolean;
@@ -832,6 +2986,44 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
832
2986
  mergedPr: number;
833
2987
  reviewThread: string;
834
2988
  commitSha: string;
2989
+ kind?: "mined" | undefined;
2990
+ } | {
2991
+ kind: "authored";
2992
+ author: string;
2993
+ authoredAt: string;
2994
+ targetDefect: string;
2995
+ positiveFixtures: {
2996
+ pr: number;
2997
+ preimageSource: {
2998
+ kind: "lesson";
2999
+ lessonRef: string;
3000
+ badExample: string;
3001
+ goodExample: string;
3002
+ } | {
3003
+ kind: "commit";
3004
+ preimageCommitSha: string;
3005
+ mergeCommitSha: string;
3006
+ };
3007
+ filePath: string;
3008
+ matchedSpan: string;
3009
+ contentHash: string;
3010
+ }[];
3011
+ negativeFixtures?: {
3012
+ pr: number;
3013
+ preimageSource: {
3014
+ kind: "lesson";
3015
+ lessonRef: string;
3016
+ badExample: string;
3017
+ goodExample: string;
3018
+ } | {
3019
+ kind: "commit";
3020
+ preimageCommitSha: string;
3021
+ mergeCommitSha: string;
3022
+ };
3023
+ filePath: string;
3024
+ matchedSpan: string;
3025
+ contentHash: string;
3026
+ }[] | undefined;
835
3027
  };
836
3028
  positiveControl: boolean;
837
3029
  negativeControl: boolean;
@@ -855,13 +3047,13 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
855
3047
  engine: "regex" | "ast" | "ast-grep";
856
3048
  compiledAt: string;
857
3049
  status?: "active" | "archived" | "untested-against-codebase" | "pending-verification" | undefined;
3050
+ badExample?: string | undefined;
3051
+ goodExample?: string | undefined;
858
3052
  astQuery?: string | undefined;
859
3053
  astGrepPattern?: string | undefined;
860
3054
  astGrepYamlRule?: z.objectOutputType<{
861
3055
  rule: z.ZodRecord<z.ZodString, z.ZodUnknown>;
862
3056
  }, z.ZodTypeAny, "passthrough"> | undefined;
863
- badExample?: string | undefined;
864
- goodExample?: string | undefined;
865
3057
  createdAt?: string | undefined;
866
3058
  fileGlobs?: string[] | undefined;
867
3059
  category?: "security" | "architecture" | "style" | "performance" | undefined;
@@ -877,6 +3069,44 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
877
3069
  mergedPr: number;
878
3070
  reviewThread: string;
879
3071
  commitSha: string;
3072
+ kind?: "mined" | undefined;
3073
+ } | {
3074
+ kind: "authored";
3075
+ author: string;
3076
+ authoredAt: string;
3077
+ targetDefect: string;
3078
+ positiveFixtures: {
3079
+ pr: number;
3080
+ preimageSource: {
3081
+ kind: "lesson";
3082
+ lessonRef: string;
3083
+ badExample: string;
3084
+ goodExample: string;
3085
+ } | {
3086
+ kind: "commit";
3087
+ preimageCommitSha: string;
3088
+ mergeCommitSha: string;
3089
+ };
3090
+ filePath: string;
3091
+ matchedSpan: string;
3092
+ contentHash: string;
3093
+ }[];
3094
+ negativeFixtures?: {
3095
+ pr: number;
3096
+ preimageSource: {
3097
+ kind: "lesson";
3098
+ lessonRef: string;
3099
+ badExample: string;
3100
+ goodExample: string;
3101
+ } | {
3102
+ kind: "commit";
3103
+ preimageCommitSha: string;
3104
+ mergeCommitSha: string;
3105
+ };
3106
+ filePath: string;
3107
+ matchedSpan: string;
3108
+ contentHash: string;
3109
+ }[] | undefined;
880
3110
  };
881
3111
  positiveControl: boolean;
882
3112
  negativeControl: boolean;
@@ -890,13 +3120,13 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
890
3120
  engine: "regex" | "ast" | "ast-grep";
891
3121
  compiledAt: string;
892
3122
  status?: "active" | "archived" | "untested-against-codebase" | "pending-verification" | undefined;
3123
+ badExample?: string | undefined;
3124
+ goodExample?: string | undefined;
893
3125
  astQuery?: string | undefined;
894
3126
  astGrepPattern?: string | undefined;
895
3127
  astGrepYamlRule?: z.objectInputType<{
896
3128
  rule: z.ZodRecord<z.ZodString, z.ZodUnknown>;
897
3129
  }, z.ZodTypeAny, "passthrough"> | undefined;
898
- badExample?: string | undefined;
899
- goodExample?: string | undefined;
900
3130
  createdAt?: string | undefined;
901
3131
  fileGlobs?: string[] | undefined;
902
3132
  category?: "security" | "architecture" | "style" | "performance" | undefined;
@@ -912,6 +3142,44 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
912
3142
  mergedPr: number;
913
3143
  reviewThread: string;
914
3144
  commitSha: string;
3145
+ kind?: "mined" | undefined;
3146
+ } | {
3147
+ kind: "authored";
3148
+ author: string;
3149
+ authoredAt: string;
3150
+ targetDefect: string;
3151
+ positiveFixtures: {
3152
+ pr: number;
3153
+ preimageSource: {
3154
+ kind: "lesson";
3155
+ lessonRef: string;
3156
+ badExample: string;
3157
+ goodExample: string;
3158
+ } | {
3159
+ kind: "commit";
3160
+ preimageCommitSha: string;
3161
+ mergeCommitSha: string;
3162
+ };
3163
+ filePath: string;
3164
+ matchedSpan: string;
3165
+ contentHash: string;
3166
+ }[];
3167
+ negativeFixtures?: {
3168
+ pr: number;
3169
+ preimageSource: {
3170
+ kind: "lesson";
3171
+ lessonRef: string;
3172
+ badExample: string;
3173
+ goodExample: string;
3174
+ } | {
3175
+ kind: "commit";
3176
+ preimageCommitSha: string;
3177
+ mergeCommitSha: string;
3178
+ };
3179
+ filePath: string;
3180
+ matchedSpan: string;
3181
+ contentHash: string;
3182
+ }[] | undefined;
915
3183
  };
916
3184
  positiveControl: boolean;
917
3185
  negativeControl: boolean;
@@ -925,13 +3193,13 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
925
3193
  engine: "regex" | "ast" | "ast-grep";
926
3194
  compiledAt: string;
927
3195
  status?: "active" | "archived" | "untested-against-codebase" | "pending-verification" | undefined;
3196
+ badExample?: string | undefined;
3197
+ goodExample?: string | undefined;
928
3198
  astQuery?: string | undefined;
929
3199
  astGrepPattern?: string | undefined;
930
3200
  astGrepYamlRule?: z.objectOutputType<{
931
3201
  rule: z.ZodRecord<z.ZodString, z.ZodUnknown>;
932
3202
  }, z.ZodTypeAny, "passthrough"> | undefined;
933
- badExample?: string | undefined;
934
- goodExample?: string | undefined;
935
3203
  createdAt?: string | undefined;
936
3204
  fileGlobs?: string[] | undefined;
937
3205
  category?: "security" | "architecture" | "style" | "performance" | undefined;
@@ -947,6 +3215,44 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
947
3215
  mergedPr: number;
948
3216
  reviewThread: string;
949
3217
  commitSha: string;
3218
+ kind?: "mined" | undefined;
3219
+ } | {
3220
+ kind: "authored";
3221
+ author: string;
3222
+ authoredAt: string;
3223
+ targetDefect: string;
3224
+ positiveFixtures: {
3225
+ pr: number;
3226
+ preimageSource: {
3227
+ kind: "lesson";
3228
+ lessonRef: string;
3229
+ badExample: string;
3230
+ goodExample: string;
3231
+ } | {
3232
+ kind: "commit";
3233
+ preimageCommitSha: string;
3234
+ mergeCommitSha: string;
3235
+ };
3236
+ filePath: string;
3237
+ matchedSpan: string;
3238
+ contentHash: string;
3239
+ }[];
3240
+ negativeFixtures?: {
3241
+ pr: number;
3242
+ preimageSource: {
3243
+ kind: "lesson";
3244
+ lessonRef: string;
3245
+ badExample: string;
3246
+ goodExample: string;
3247
+ } | {
3248
+ kind: "commit";
3249
+ preimageCommitSha: string;
3250
+ mergeCommitSha: string;
3251
+ };
3252
+ filePath: string;
3253
+ matchedSpan: string;
3254
+ contentHash: string;
3255
+ }[] | undefined;
950
3256
  };
951
3257
  positiveControl: boolean;
952
3258
  negativeControl: boolean;
@@ -960,13 +3266,13 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
960
3266
  engine: "regex" | "ast" | "ast-grep";
961
3267
  compiledAt: string;
962
3268
  status?: "active" | "archived" | "untested-against-codebase" | "pending-verification" | undefined;
3269
+ badExample?: string | undefined;
3270
+ goodExample?: string | undefined;
963
3271
  astQuery?: string | undefined;
964
3272
  astGrepPattern?: string | undefined;
965
3273
  astGrepYamlRule?: z.objectInputType<{
966
3274
  rule: z.ZodRecord<z.ZodString, z.ZodUnknown>;
967
3275
  }, z.ZodTypeAny, "passthrough"> | undefined;
968
- badExample?: string | undefined;
969
- goodExample?: string | undefined;
970
3276
  createdAt?: string | undefined;
971
3277
  fileGlobs?: string[] | undefined;
972
3278
  category?: "security" | "architecture" | "style" | "performance" | undefined;
@@ -982,6 +3288,44 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
982
3288
  mergedPr: number;
983
3289
  reviewThread: string;
984
3290
  commitSha: string;
3291
+ kind?: "mined" | undefined;
3292
+ } | {
3293
+ kind: "authored";
3294
+ author: string;
3295
+ authoredAt: string;
3296
+ targetDefect: string;
3297
+ positiveFixtures: {
3298
+ pr: number;
3299
+ preimageSource: {
3300
+ kind: "lesson";
3301
+ lessonRef: string;
3302
+ badExample: string;
3303
+ goodExample: string;
3304
+ } | {
3305
+ kind: "commit";
3306
+ preimageCommitSha: string;
3307
+ mergeCommitSha: string;
3308
+ };
3309
+ filePath: string;
3310
+ matchedSpan: string;
3311
+ contentHash: string;
3312
+ }[];
3313
+ negativeFixtures?: {
3314
+ pr: number;
3315
+ preimageSource: {
3316
+ kind: "lesson";
3317
+ lessonRef: string;
3318
+ badExample: string;
3319
+ goodExample: string;
3320
+ } | {
3321
+ kind: "commit";
3322
+ preimageCommitSha: string;
3323
+ mergeCommitSha: string;
3324
+ };
3325
+ filePath: string;
3326
+ matchedSpan: string;
3327
+ contentHash: string;
3328
+ }[] | undefined;
985
3329
  };
986
3330
  positiveControl: boolean;
987
3331
  negativeControl: boolean;
@@ -1045,13 +3389,13 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
1045
3389
  engine: "regex" | "ast" | "ast-grep";
1046
3390
  compiledAt: string;
1047
3391
  status?: "active" | "archived" | "untested-against-codebase" | "pending-verification" | undefined;
3392
+ badExample?: string | undefined;
3393
+ goodExample?: string | undefined;
1048
3394
  astQuery?: string | undefined;
1049
3395
  astGrepPattern?: string | undefined;
1050
3396
  astGrepYamlRule?: z.objectOutputType<{
1051
3397
  rule: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1052
3398
  }, z.ZodTypeAny, "passthrough"> | undefined;
1053
- badExample?: string | undefined;
1054
- goodExample?: string | undefined;
1055
3399
  createdAt?: string | undefined;
1056
3400
  fileGlobs?: string[] | undefined;
1057
3401
  category?: "security" | "architecture" | "style" | "performance" | undefined;
@@ -1067,6 +3411,44 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
1067
3411
  mergedPr: number;
1068
3412
  reviewThread: string;
1069
3413
  commitSha: string;
3414
+ kind?: "mined" | undefined;
3415
+ } | {
3416
+ kind: "authored";
3417
+ author: string;
3418
+ authoredAt: string;
3419
+ targetDefect: string;
3420
+ positiveFixtures: {
3421
+ pr: number;
3422
+ preimageSource: {
3423
+ kind: "lesson";
3424
+ lessonRef: string;
3425
+ badExample: string;
3426
+ goodExample: string;
3427
+ } | {
3428
+ kind: "commit";
3429
+ preimageCommitSha: string;
3430
+ mergeCommitSha: string;
3431
+ };
3432
+ filePath: string;
3433
+ matchedSpan: string;
3434
+ contentHash: string;
3435
+ }[];
3436
+ negativeFixtures?: {
3437
+ pr: number;
3438
+ preimageSource: {
3439
+ kind: "lesson";
3440
+ lessonRef: string;
3441
+ badExample: string;
3442
+ goodExample: string;
3443
+ } | {
3444
+ kind: "commit";
3445
+ preimageCommitSha: string;
3446
+ mergeCommitSha: string;
3447
+ };
3448
+ filePath: string;
3449
+ matchedSpan: string;
3450
+ contentHash: string;
3451
+ }[] | undefined;
1070
3452
  };
1071
3453
  positiveControl: boolean;
1072
3454
  negativeControl: boolean;
@@ -1089,13 +3471,13 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
1089
3471
  engine: "regex" | "ast" | "ast-grep";
1090
3472
  compiledAt: string;
1091
3473
  status?: "active" | "archived" | "untested-against-codebase" | "pending-verification" | undefined;
3474
+ badExample?: string | undefined;
3475
+ goodExample?: string | undefined;
1092
3476
  astQuery?: string | undefined;
1093
3477
  astGrepPattern?: string | undefined;
1094
3478
  astGrepYamlRule?: z.objectInputType<{
1095
3479
  rule: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1096
3480
  }, z.ZodTypeAny, "passthrough"> | undefined;
1097
- badExample?: string | undefined;
1098
- goodExample?: string | undefined;
1099
3481
  createdAt?: string | undefined;
1100
3482
  fileGlobs?: string[] | undefined;
1101
3483
  category?: "security" | "architecture" | "style" | "performance" | undefined;
@@ -1111,6 +3493,44 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
1111
3493
  mergedPr: number;
1112
3494
  reviewThread: string;
1113
3495
  commitSha: string;
3496
+ kind?: "mined" | undefined;
3497
+ } | {
3498
+ kind: "authored";
3499
+ author: string;
3500
+ authoredAt: string;
3501
+ targetDefect: string;
3502
+ positiveFixtures: {
3503
+ pr: number;
3504
+ preimageSource: {
3505
+ kind: "lesson";
3506
+ lessonRef: string;
3507
+ badExample: string;
3508
+ goodExample: string;
3509
+ } | {
3510
+ kind: "commit";
3511
+ preimageCommitSha: string;
3512
+ mergeCommitSha: string;
3513
+ };
3514
+ filePath: string;
3515
+ matchedSpan: string;
3516
+ contentHash: string;
3517
+ }[];
3518
+ negativeFixtures?: {
3519
+ pr: number;
3520
+ preimageSource: {
3521
+ kind: "lesson";
3522
+ lessonRef: string;
3523
+ badExample: string;
3524
+ goodExample: string;
3525
+ } | {
3526
+ kind: "commit";
3527
+ preimageCommitSha: string;
3528
+ mergeCommitSha: string;
3529
+ };
3530
+ filePath: string;
3531
+ matchedSpan: string;
3532
+ contentHash: string;
3533
+ }[] | undefined;
1114
3534
  };
1115
3535
  positiveControl: boolean;
1116
3536
  negativeControl: boolean;
@@ -1186,6 +3606,8 @@ export declare const CompilerOutputSchema: z.ZodEffects<z.ZodObject<{
1186
3606
  }, "strip", z.ZodTypeAny, {
1187
3607
  compilable: boolean;
1188
3608
  message?: string | undefined;
3609
+ badExample?: string | undefined;
3610
+ goodExample?: string | undefined;
1189
3611
  pattern?: string | undefined;
1190
3612
  engine?: "regex" | "ast" | "ast-grep" | undefined;
1191
3613
  astQuery?: string | undefined;
@@ -1193,8 +3615,6 @@ export declare const CompilerOutputSchema: z.ZodEffects<z.ZodObject<{
1193
3615
  astGrepYamlRule?: z.objectOutputType<{
1194
3616
  rule: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1195
3617
  }, z.ZodTypeAny, "passthrough"> | undefined;
1196
- badExample?: string | undefined;
1197
- goodExample?: string | undefined;
1198
3618
  fileGlobs?: string[] | undefined;
1199
3619
  severity?: "error" | "warning" | undefined;
1200
3620
  reasonCode?: "context-required" | "semantic-analysis-required" | undefined;
@@ -1202,6 +3622,8 @@ export declare const CompilerOutputSchema: z.ZodEffects<z.ZodObject<{
1202
3622
  }, {
1203
3623
  compilable: boolean;
1204
3624
  message?: string | undefined;
3625
+ badExample?: string | undefined;
3626
+ goodExample?: string | undefined;
1205
3627
  pattern?: string | undefined;
1206
3628
  engine?: "regex" | "ast" | "ast-grep" | undefined;
1207
3629
  astQuery?: string | undefined;
@@ -1209,8 +3631,6 @@ export declare const CompilerOutputSchema: z.ZodEffects<z.ZodObject<{
1209
3631
  astGrepYamlRule?: z.objectInputType<{
1210
3632
  rule: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1211
3633
  }, z.ZodTypeAny, "passthrough"> | undefined;
1212
- badExample?: string | undefined;
1213
- goodExample?: string | undefined;
1214
3634
  fileGlobs?: string[] | undefined;
1215
3635
  severity?: "error" | "warning" | undefined;
1216
3636
  reasonCode?: "context-required" | "semantic-analysis-required" | undefined;
@@ -1218,6 +3638,8 @@ export declare const CompilerOutputSchema: z.ZodEffects<z.ZodObject<{
1218
3638
  }>, {
1219
3639
  compilable: boolean;
1220
3640
  message?: string | undefined;
3641
+ badExample?: string | undefined;
3642
+ goodExample?: string | undefined;
1221
3643
  pattern?: string | undefined;
1222
3644
  engine?: "regex" | "ast" | "ast-grep" | undefined;
1223
3645
  astQuery?: string | undefined;
@@ -1225,8 +3647,6 @@ export declare const CompilerOutputSchema: z.ZodEffects<z.ZodObject<{
1225
3647
  astGrepYamlRule?: z.objectOutputType<{
1226
3648
  rule: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1227
3649
  }, z.ZodTypeAny, "passthrough"> | undefined;
1228
- badExample?: string | undefined;
1229
- goodExample?: string | undefined;
1230
3650
  fileGlobs?: string[] | undefined;
1231
3651
  severity?: "error" | "warning" | undefined;
1232
3652
  reasonCode?: "context-required" | "semantic-analysis-required" | undefined;
@@ -1234,6 +3654,8 @@ export declare const CompilerOutputSchema: z.ZodEffects<z.ZodObject<{
1234
3654
  }, {
1235
3655
  compilable: boolean;
1236
3656
  message?: string | undefined;
3657
+ badExample?: string | undefined;
3658
+ goodExample?: string | undefined;
1237
3659
  pattern?: string | undefined;
1238
3660
  engine?: "regex" | "ast" | "ast-grep" | undefined;
1239
3661
  astQuery?: string | undefined;
@@ -1241,8 +3663,6 @@ export declare const CompilerOutputSchema: z.ZodEffects<z.ZodObject<{
1241
3663
  astGrepYamlRule?: z.objectInputType<{
1242
3664
  rule: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1243
3665
  }, z.ZodTypeAny, "passthrough"> | undefined;
1244
- badExample?: string | undefined;
1245
- goodExample?: string | undefined;
1246
3666
  fileGlobs?: string[] | undefined;
1247
3667
  severity?: "error" | "warning" | undefined;
1248
3668
  reasonCode?: "context-required" | "semantic-analysis-required" | undefined;