@mmnto/totem 1.81.1 → 1.82.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.
@@ -278,6 +278,117 @@ export declare const AuthoredFixtureSchema: z.ZodEffects<z.ZodObject<{
278
278
  contentHash: string;
279
279
  }>;
280
280
  export type AuthoredFixture = z.infer<typeof AuthoredFixtureSchema>;
281
+ /**
282
+ * ADR-112 §3/§6 (strategy#770) — the source of a SILENCE-ONLY near-miss: the one
283
+ * exemplar a negative control's matcher must stay SILENT on. Source-pluggable per §4
284
+ * (a synthetic lesson `example` PRIMARY / a `commitSha` state FALLBACK) but ONE side
285
+ * only — a near-miss has NO must-fire leg, so this is NOT the positiveFixtures
286
+ * bad/good `preimageSource` pair (a negative control is a one-leg silence assertion,
287
+ * a positive control a two-leg differential — §6 L142 arity). `z.discriminatedUnion`
288
+ * + `.strict()` branches mirror `PreimageSourceSchema` (cross-branch key fails LOUD,
289
+ * FM(d)); refines are NON-mutating for manifest-hash stability.
290
+ */
291
+ export declare const NearMissSourceSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
292
+ kind: z.ZodLiteral<"lesson">;
293
+ /** The synthetic near-miss exemplar the matcher must stay SILENT on (§6). */
294
+ example: z.ZodEffects<z.ZodString, string, string>;
295
+ /**
296
+ * OPTIONAL immutable lesson id — a synthetic near-miss may have no lesson origin,
297
+ * so unlike the positiveFixtures `lessonRef` it is optional; but WHEN present it
298
+ * carries the same §8 discipline (the 16-hex `hashLesson` codomain, never a
299
+ * path/mutable alias), so it can't be a free-form mutable alias.
300
+ */
301
+ lessonRef: z.ZodOptional<z.ZodString>;
302
+ }, "strict", z.ZodTypeAny, {
303
+ kind: "lesson";
304
+ example: string;
305
+ lessonRef?: string | undefined;
306
+ }, {
307
+ kind: "lesson";
308
+ example: string;
309
+ lessonRef?: string | undefined;
310
+ }>, z.ZodObject<{
311
+ kind: z.ZodLiteral<"commit">;
312
+ /** The commit whose state the matcher must stay SILENT on (§6, land-then-fix fallback). */
313
+ commitSha: z.ZodString;
314
+ }, "strict", z.ZodTypeAny, {
315
+ kind: "commit";
316
+ commitSha: string;
317
+ }, {
318
+ kind: "commit";
319
+ commitSha: string;
320
+ }>]>;
321
+ export type NearMissSource = z.infer<typeof NearMissSourceSchema>;
322
+ /**
323
+ * ADR-112 §3/§6 (strategy#770) — a declared near-miss the rule must stay SILENT on,
324
+ * feeding §6 `controls.negative[]` (a fire on it is a §3.3 cull, never a corpus FP).
325
+ * SILENCE-ONLY: a locus (`filePath` + `matchedSpan`) + the one-side `nearMissSource`.
326
+ * It deliberately carries NO `pr` (a synthetic near-miss has no corpus position — the
327
+ * §5 leakage guard targets corpus-drawn fixtures, so there is nothing to train-side-
328
+ * attest), NO `contentHash`, and NO bad/good pair / anti-vacuity `superRefine` (there
329
+ * is no pair to be vacuously identical). `.strict()` so a leftover positiveFixtures
330
+ * key (e.g. `preimageSource`/`pr`) from a mis-migrated fixture fails LOUD (FM(d)).
331
+ */
332
+ export declare const AuthoredNegativeFixtureSchema: z.ZodObject<{
333
+ /** File the near-miss locus lives in. */
334
+ filePath: z.ZodEffects<z.ZodString, string, string>;
335
+ /** Line-range or AST-node path — the near-miss locus, not just the file. */
336
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
337
+ /** The §4-pluggable silence target — ONE side (the matcher must not fire on it). */
338
+ nearMissSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
339
+ kind: z.ZodLiteral<"lesson">;
340
+ /** The synthetic near-miss exemplar the matcher must stay SILENT on (§6). */
341
+ example: z.ZodEffects<z.ZodString, string, string>;
342
+ /**
343
+ * OPTIONAL immutable lesson id — a synthetic near-miss may have no lesson origin,
344
+ * so unlike the positiveFixtures `lessonRef` it is optional; but WHEN present it
345
+ * carries the same §8 discipline (the 16-hex `hashLesson` codomain, never a
346
+ * path/mutable alias), so it can't be a free-form mutable alias.
347
+ */
348
+ lessonRef: z.ZodOptional<z.ZodString>;
349
+ }, "strict", z.ZodTypeAny, {
350
+ kind: "lesson";
351
+ example: string;
352
+ lessonRef?: string | undefined;
353
+ }, {
354
+ kind: "lesson";
355
+ example: string;
356
+ lessonRef?: string | undefined;
357
+ }>, z.ZodObject<{
358
+ kind: z.ZodLiteral<"commit">;
359
+ /** The commit whose state the matcher must stay SILENT on (§6, land-then-fix fallback). */
360
+ commitSha: z.ZodString;
361
+ }, "strict", z.ZodTypeAny, {
362
+ kind: "commit";
363
+ commitSha: string;
364
+ }, {
365
+ kind: "commit";
366
+ commitSha: string;
367
+ }>]>;
368
+ }, "strict", z.ZodTypeAny, {
369
+ filePath: string;
370
+ matchedSpan: string;
371
+ nearMissSource: {
372
+ kind: "lesson";
373
+ example: string;
374
+ lessonRef?: string | undefined;
375
+ } | {
376
+ kind: "commit";
377
+ commitSha: string;
378
+ };
379
+ }, {
380
+ filePath: string;
381
+ matchedSpan: string;
382
+ nearMissSource: {
383
+ kind: "lesson";
384
+ example: string;
385
+ lessonRef?: string | undefined;
386
+ } | {
387
+ kind: "commit";
388
+ commitSha: string;
389
+ };
390
+ }>;
391
+ export type AuthoredNegativeFixture = z.infer<typeof AuthoredNegativeFixtureSchema>;
281
392
  /**
282
393
  * ADR-112 §3 — the AUTHORED variant of the `ProvenanceRecord` union. A
283
394
  * hand-authored rule is anchored to a real historical DEFECT (the pre-image,
@@ -405,115 +516,69 @@ export declare const AuthoredProvenanceRecordSchema: z.ZodObject<{
405
516
  matchedSpan: string;
406
517
  contentHash: string;
407
518
  }>, "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<{
519
+ /**
520
+ * Declared SILENCE-ONLY near-misses the rule must stay silent on (feeds §6
521
+ * `controls.negative[]`). The silence-only `nearMissSource` shape, NOT the
522
+ * positiveFixtures bad/good pair (strategy#770 — different arity, §6 L142).
523
+ */
524
+ negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodObject<{
525
+ /** File the near-miss locus lives in. */
526
+ filePath: z.ZodEffects<z.ZodString, string, string>;
527
+ /** Line-range or AST-node path — the near-miss locus, not just the file. */
528
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
529
+ /** The §4-pluggable silence target — ONE side (the matcher must not fire on it). */
530
+ nearMissSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
414
531
  kind: z.ZodLiteral<"lesson">;
415
- /** IMMUTABLE lesson id/hash (the 16-hex `hashLesson` codomain) never a path/mutable alias4/§8). */
416
- lessonRef: z.ZodString;
532
+ /** The synthetic near-miss exemplar the matcher must stay SILENT on6). */
533
+ example: z.ZodEffects<z.ZodString, string, string>;
417
534
  /**
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.
535
+ * OPTIONAL immutable lesson id a synthetic near-miss may have no lesson origin,
536
+ * so unlike the positiveFixtures `lessonRef` it is optional; but WHEN present it
537
+ * carries the same §8 discipline (the 16-hex `hashLesson` codomain, never a
538
+ * path/mutable alias), so it can't be a free-form mutable alias.
422
539
  */
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>;
540
+ lessonRef: z.ZodOptional<z.ZodString>;
426
541
  }, "strict", z.ZodTypeAny, {
427
542
  kind: "lesson";
428
- lessonRef: string;
429
- badExample: string;
430
- goodExample: string;
543
+ example: string;
544
+ lessonRef?: string | undefined;
431
545
  }, {
432
546
  kind: "lesson";
433
- lessonRef: string;
434
- badExample: string;
435
- goodExample: string;
547
+ example: string;
548
+ lessonRef?: string | undefined;
436
549
  }>, z.ZodObject<{
437
550
  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;
551
+ /** The commit whose state the matcher must stay SILENT on (§6, land-then-fix fallback). */
552
+ commitSha: z.ZodString;
442
553
  }, "strict", z.ZodTypeAny, {
443
554
  kind: "commit";
444
- preimageCommitSha: string;
445
- mergeCommitSha: string;
555
+ commitSha: string;
446
556
  }, {
447
557
  kind: "commit";
448
- preimageCommitSha: string;
449
- mergeCommitSha: string;
558
+ commitSha: string;
450
559
  }>]>;
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
560
  }, "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
561
  filePath: string;
470
562
  matchedSpan: string;
471
- contentHash: string;
472
- }, {
473
- pr: number;
474
- preimageSource: {
563
+ nearMissSource: {
475
564
  kind: "lesson";
476
- lessonRef: string;
477
- badExample: string;
478
- goodExample: string;
565
+ example: string;
566
+ lessonRef?: string | undefined;
479
567
  } | {
480
568
  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;
569
+ commitSha: string;
498
570
  };
571
+ }, {
499
572
  filePath: string;
500
573
  matchedSpan: string;
501
- contentHash: string;
502
- }, {
503
- pr: number;
504
- preimageSource: {
574
+ nearMissSource: {
505
575
  kind: "lesson";
506
- lessonRef: string;
507
- badExample: string;
508
- goodExample: string;
576
+ example: string;
577
+ lessonRef?: string | undefined;
509
578
  } | {
510
579
  kind: "commit";
511
- preimageCommitSha: string;
512
- mergeCommitSha: string;
580
+ commitSha: string;
513
581
  };
514
- filePath: string;
515
- matchedSpan: string;
516
- contentHash: string;
517
582
  }>, "many">>;
518
583
  }, "strip", z.ZodTypeAny, {
519
584
  kind: "authored";
@@ -537,20 +602,16 @@ export declare const AuthoredProvenanceRecordSchema: z.ZodObject<{
537
602
  contentHash: string;
538
603
  }[];
539
604
  negativeFixtures?: {
540
- pr: number;
541
- preimageSource: {
605
+ filePath: string;
606
+ matchedSpan: string;
607
+ nearMissSource: {
542
608
  kind: "lesson";
543
- lessonRef: string;
544
- badExample: string;
545
- goodExample: string;
609
+ example: string;
610
+ lessonRef?: string | undefined;
546
611
  } | {
547
612
  kind: "commit";
548
- preimageCommitSha: string;
549
- mergeCommitSha: string;
613
+ commitSha: string;
550
614
  };
551
- filePath: string;
552
- matchedSpan: string;
553
- contentHash: string;
554
615
  }[] | undefined;
555
616
  }, {
556
617
  kind: "authored";
@@ -574,20 +635,16 @@ export declare const AuthoredProvenanceRecordSchema: z.ZodObject<{
574
635
  contentHash: string;
575
636
  }[];
576
637
  negativeFixtures?: {
577
- pr: number;
578
- preimageSource: {
638
+ filePath: string;
639
+ matchedSpan: string;
640
+ nearMissSource: {
579
641
  kind: "lesson";
580
- lessonRef: string;
581
- badExample: string;
582
- goodExample: string;
642
+ example: string;
643
+ lessonRef?: string | undefined;
583
644
  } | {
584
645
  kind: "commit";
585
- preimageCommitSha: string;
586
- mergeCommitSha: string;
646
+ commitSha: string;
587
647
  };
588
- filePath: string;
589
- matchedSpan: string;
590
- contentHash: string;
591
648
  }[] | undefined;
592
649
  }>;
593
650
  export type AuthoredProvenanceRecord = z.infer<typeof AuthoredProvenanceRecordSchema>;
@@ -721,115 +778,69 @@ export declare const ProvenanceRecordSchema: z.ZodUnion<[z.ZodObject<{
721
778
  matchedSpan: string;
722
779
  contentHash: string;
723
780
  }>, "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<{
781
+ /**
782
+ * Declared SILENCE-ONLY near-misses the rule must stay silent on (feeds §6
783
+ * `controls.negative[]`). The silence-only `nearMissSource` shape, NOT the
784
+ * positiveFixtures bad/good pair (strategy#770 — different arity, §6 L142).
785
+ */
786
+ negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodObject<{
787
+ /** File the near-miss locus lives in. */
788
+ filePath: z.ZodEffects<z.ZodString, string, string>;
789
+ /** Line-range or AST-node path — the near-miss locus, not just the file. */
790
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
791
+ /** The §4-pluggable silence target — ONE side (the matcher must not fire on it). */
792
+ nearMissSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
730
793
  kind: z.ZodLiteral<"lesson">;
731
- /** IMMUTABLE lesson id/hash (the 16-hex `hashLesson` codomain) never a path/mutable alias4/§8). */
732
- lessonRef: z.ZodString;
794
+ /** The synthetic near-miss exemplar the matcher must stay SILENT on6). */
795
+ example: z.ZodEffects<z.ZodString, string, string>;
733
796
  /**
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.
797
+ * OPTIONAL immutable lesson id a synthetic near-miss may have no lesson origin,
798
+ * so unlike the positiveFixtures `lessonRef` it is optional; but WHEN present it
799
+ * carries the same §8 discipline (the 16-hex `hashLesson` codomain, never a
800
+ * path/mutable alias), so it can't be a free-form mutable alias.
738
801
  */
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>;
802
+ lessonRef: z.ZodOptional<z.ZodString>;
742
803
  }, "strict", z.ZodTypeAny, {
743
804
  kind: "lesson";
744
- lessonRef: string;
745
- badExample: string;
746
- goodExample: string;
805
+ example: string;
806
+ lessonRef?: string | undefined;
747
807
  }, {
748
808
  kind: "lesson";
749
- lessonRef: string;
750
- badExample: string;
751
- goodExample: string;
809
+ example: string;
810
+ lessonRef?: string | undefined;
752
811
  }>, z.ZodObject<{
753
812
  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;
813
+ /** The commit whose state the matcher must stay SILENT on (§6, land-then-fix fallback). */
814
+ commitSha: z.ZodString;
758
815
  }, "strict", z.ZodTypeAny, {
759
816
  kind: "commit";
760
- preimageCommitSha: string;
761
- mergeCommitSha: string;
817
+ commitSha: string;
762
818
  }, {
763
819
  kind: "commit";
764
- preimageCommitSha: string;
765
- mergeCommitSha: string;
820
+ commitSha: string;
766
821
  }>]>;
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
822
  }, "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
823
  filePath: string;
786
824
  matchedSpan: string;
787
- contentHash: string;
788
- }, {
789
- pr: number;
790
- preimageSource: {
825
+ nearMissSource: {
791
826
  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;
827
+ example: string;
828
+ lessonRef?: string | undefined;
810
829
  } | {
811
830
  kind: "commit";
812
- preimageCommitSha: string;
813
- mergeCommitSha: string;
831
+ commitSha: string;
814
832
  };
833
+ }, {
815
834
  filePath: string;
816
835
  matchedSpan: string;
817
- contentHash: string;
818
- }, {
819
- pr: number;
820
- preimageSource: {
836
+ nearMissSource: {
821
837
  kind: "lesson";
822
- lessonRef: string;
823
- badExample: string;
824
- goodExample: string;
838
+ example: string;
839
+ lessonRef?: string | undefined;
825
840
  } | {
826
841
  kind: "commit";
827
- preimageCommitSha: string;
828
- mergeCommitSha: string;
842
+ commitSha: string;
829
843
  };
830
- filePath: string;
831
- matchedSpan: string;
832
- contentHash: string;
833
844
  }>, "many">>;
834
845
  }, "strip", z.ZodTypeAny, {
835
846
  kind: "authored";
@@ -853,20 +864,16 @@ export declare const ProvenanceRecordSchema: z.ZodUnion<[z.ZodObject<{
853
864
  contentHash: string;
854
865
  }[];
855
866
  negativeFixtures?: {
856
- pr: number;
857
- preimageSource: {
867
+ filePath: string;
868
+ matchedSpan: string;
869
+ nearMissSource: {
858
870
  kind: "lesson";
859
- lessonRef: string;
860
- badExample: string;
861
- goodExample: string;
871
+ example: string;
872
+ lessonRef?: string | undefined;
862
873
  } | {
863
874
  kind: "commit";
864
- preimageCommitSha: string;
865
- mergeCommitSha: string;
875
+ commitSha: string;
866
876
  };
867
- filePath: string;
868
- matchedSpan: string;
869
- contentHash: string;
870
877
  }[] | undefined;
871
878
  }, {
872
879
  kind: "authored";
@@ -890,20 +897,16 @@ export declare const ProvenanceRecordSchema: z.ZodUnion<[z.ZodObject<{
890
897
  contentHash: string;
891
898
  }[];
892
899
  negativeFixtures?: {
893
- pr: number;
894
- preimageSource: {
900
+ filePath: string;
901
+ matchedSpan: string;
902
+ nearMissSource: {
895
903
  kind: "lesson";
896
- lessonRef: string;
897
- badExample: string;
898
- goodExample: string;
904
+ example: string;
905
+ lessonRef?: string | undefined;
899
906
  } | {
900
907
  kind: "commit";
901
- preimageCommitSha: string;
902
- mergeCommitSha: string;
908
+ commitSha: string;
903
909
  };
904
- filePath: string;
905
- matchedSpan: string;
906
- contentHash: string;
907
910
  }[] | undefined;
908
911
  }>, z.ZodObject<{
909
912
  /**
@@ -933,152 +936,42 @@ export declare const ProvenanceRecordSchema: z.ZodUnion<[z.ZodObject<{
933
936
  kind?: "mined" | undefined;
934
937
  }, {
935
938
  mergedPr: number;
936
- reviewThread: string;
937
- commitSha: string;
938
- kind?: "mined" | undefined;
939
- }>]>;
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;
952
- /**
953
- * mmnto-ai/totem#2183 — the three **peer** legs of the ADR-110 §3 legitimacy
954
- * bar, mapping 1:1 onto the strategy#666 Tenet-9 three-check so the Gate-1
955
- * wind-tunnel reads per-rule eligibility off the marker with no translation
956
- * layer: `provenance` (§3.1) / `positiveControl` (§3.2) / `negativeControl`
957
- * (§3.3). Controls are pass/fail booleans, **required** when `legitimacy` is
958
- * present (never defaulted, so an absent control can't silently read as a
959
- * failed one); the evidence behind each pass lives in the wind-tunnel manifest.
960
- */
961
- export declare const LegitimacySchema: 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<{
939
+ reviewThread: string;
940
+ commitSha: string;
941
+ kind?: "mined" | undefined;
942
+ }>]>;
943
+ export type ProvenanceRecord = z.infer<typeof ProvenanceRecordSchema>;
944
+ /**
945
+ * ADR-112 — the canonical reader of a provenance record's producer kind. An
946
+ * absent discriminator (every legacy mined record) reads as `'mined'`. Use this
947
+ * + the guards below instead of touching `.kind` directly, so the
948
+ * absent-⇒-mined default lives in exactly one place (Tenet 20).
949
+ */
950
+ export declare function provenanceKind(p: ProvenanceRecord): 'mined' | 'authored';
951
+ /** ADR-112 — type-narrowing guard for the mined branch (mined-only field reads). */
952
+ export declare function isMinedProvenance(p: ProvenanceRecord): p is MinedProvenanceRecord;
953
+ /** ADR-112 — type-narrowing guard for the authored branch. */
954
+ export declare function isAuthoredProvenance(p: ProvenanceRecord): p is AuthoredProvenanceRecord;
955
+ /**
956
+ * mmnto-ai/totem#2183 — the three **peer** legs of the ADR-110 §3 legitimacy
957
+ * bar, mapping 1:1 onto the strategy#666 Tenet-9 three-check so the Gate-1
958
+ * wind-tunnel reads per-rule eligibility off the marker with no translation
959
+ * layer: `provenance` (§3.1) / `positiveControl` (§3.2) / `negativeControl`
960
+ * (§3.3). Controls are pass/fail booleans, **required** when `legitimacy` is
961
+ * present (never defaulted, so an absent control can't silently read as a
962
+ * failed one); the evidence behind each pass lives in the wind-tunnel manifest.
963
+ */
964
+ export declare const LegitimacySchema: z.ZodObject<{
965
+ provenance: z.ZodUnion<[z.ZodObject<{
966
+ kind: z.ZodLiteral<"authored">;
967
+ /** Agent-id or operator handle — attributable, never anonymous. */
968
+ author: z.ZodEffects<z.ZodString, string, string>;
969
+ /** ISO-8601 authoring date — a real calendar date (`YYYY-MM-DD`) or a full timestamp. */
970
+ authoredAt: z.ZodEffects<z.ZodString, string, string>;
971
+ /** The declared DEFECT the rule targets — the pre-image, not its fix. */
972
+ targetDefect: z.ZodEffects<z.ZodString, string, string>;
973
+ /** ≥1 real lc instance the rule claims to catch — ALL train-side (§5). */
974
+ positiveFixtures: z.ZodArray<z.ZodEffects<z.ZodObject<{
1082
975
  /** The PR where the defect was caught/introduced (the in-corpus anchor). */
1083
976
  pr: z.ZodNumber;
1084
977
  /** The §4 preimage-differential source — lesson-anchored (PRIMARY) or commit-pair (FALLBACK). */
@@ -1186,6 +1079,70 @@ export declare const LegitimacySchema: z.ZodObject<{
1186
1079
  filePath: string;
1187
1080
  matchedSpan: string;
1188
1081
  contentHash: string;
1082
+ }>, "many">;
1083
+ /**
1084
+ * Declared SILENCE-ONLY near-misses the rule must stay silent on (feeds §6
1085
+ * `controls.negative[]`). The silence-only `nearMissSource` shape, NOT the
1086
+ * positiveFixtures bad/good pair (strategy#770 — different arity, §6 L142).
1087
+ */
1088
+ negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodObject<{
1089
+ /** File the near-miss locus lives in. */
1090
+ filePath: z.ZodEffects<z.ZodString, string, string>;
1091
+ /** Line-range or AST-node path — the near-miss locus, not just the file. */
1092
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
1093
+ /** The §4-pluggable silence target — ONE side (the matcher must not fire on it). */
1094
+ nearMissSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1095
+ kind: z.ZodLiteral<"lesson">;
1096
+ /** The synthetic near-miss exemplar the matcher must stay SILENT on (§6). */
1097
+ example: z.ZodEffects<z.ZodString, string, string>;
1098
+ /**
1099
+ * OPTIONAL immutable lesson id — a synthetic near-miss may have no lesson origin,
1100
+ * so unlike the positiveFixtures `lessonRef` it is optional; but WHEN present it
1101
+ * carries the same §8 discipline (the 16-hex `hashLesson` codomain, never a
1102
+ * path/mutable alias), so it can't be a free-form mutable alias.
1103
+ */
1104
+ lessonRef: z.ZodOptional<z.ZodString>;
1105
+ }, "strict", z.ZodTypeAny, {
1106
+ kind: "lesson";
1107
+ example: string;
1108
+ lessonRef?: string | undefined;
1109
+ }, {
1110
+ kind: "lesson";
1111
+ example: string;
1112
+ lessonRef?: string | undefined;
1113
+ }>, z.ZodObject<{
1114
+ kind: z.ZodLiteral<"commit">;
1115
+ /** The commit whose state the matcher must stay SILENT on (§6, land-then-fix fallback). */
1116
+ commitSha: z.ZodString;
1117
+ }, "strict", z.ZodTypeAny, {
1118
+ kind: "commit";
1119
+ commitSha: string;
1120
+ }, {
1121
+ kind: "commit";
1122
+ commitSha: string;
1123
+ }>]>;
1124
+ }, "strict", z.ZodTypeAny, {
1125
+ filePath: string;
1126
+ matchedSpan: string;
1127
+ nearMissSource: {
1128
+ kind: "lesson";
1129
+ example: string;
1130
+ lessonRef?: string | undefined;
1131
+ } | {
1132
+ kind: "commit";
1133
+ commitSha: string;
1134
+ };
1135
+ }, {
1136
+ filePath: string;
1137
+ matchedSpan: string;
1138
+ nearMissSource: {
1139
+ kind: "lesson";
1140
+ example: string;
1141
+ lessonRef?: string | undefined;
1142
+ } | {
1143
+ kind: "commit";
1144
+ commitSha: string;
1145
+ };
1189
1146
  }>, "many">>;
1190
1147
  }, "strip", z.ZodTypeAny, {
1191
1148
  kind: "authored";
@@ -1209,20 +1166,16 @@ export declare const LegitimacySchema: z.ZodObject<{
1209
1166
  contentHash: string;
1210
1167
  }[];
1211
1168
  negativeFixtures?: {
1212
- pr: number;
1213
- preimageSource: {
1169
+ filePath: string;
1170
+ matchedSpan: string;
1171
+ nearMissSource: {
1214
1172
  kind: "lesson";
1215
- lessonRef: string;
1216
- badExample: string;
1217
- goodExample: string;
1173
+ example: string;
1174
+ lessonRef?: string | undefined;
1218
1175
  } | {
1219
1176
  kind: "commit";
1220
- preimageCommitSha: string;
1221
- mergeCommitSha: string;
1177
+ commitSha: string;
1222
1178
  };
1223
- filePath: string;
1224
- matchedSpan: string;
1225
- contentHash: string;
1226
1179
  }[] | undefined;
1227
1180
  }, {
1228
1181
  kind: "authored";
@@ -1246,20 +1199,16 @@ export declare const LegitimacySchema: z.ZodObject<{
1246
1199
  contentHash: string;
1247
1200
  }[];
1248
1201
  negativeFixtures?: {
1249
- pr: number;
1250
- preimageSource: {
1202
+ filePath: string;
1203
+ matchedSpan: string;
1204
+ nearMissSource: {
1251
1205
  kind: "lesson";
1252
- lessonRef: string;
1253
- badExample: string;
1254
- goodExample: string;
1206
+ example: string;
1207
+ lessonRef?: string | undefined;
1255
1208
  } | {
1256
1209
  kind: "commit";
1257
- preimageCommitSha: string;
1258
- mergeCommitSha: string;
1210
+ commitSha: string;
1259
1211
  };
1260
- filePath: string;
1261
- matchedSpan: string;
1262
- contentHash: string;
1263
1212
  }[] | undefined;
1264
1213
  }>, z.ZodObject<{
1265
1214
  /**
@@ -1323,20 +1272,16 @@ export declare const LegitimacySchema: z.ZodObject<{
1323
1272
  contentHash: string;
1324
1273
  }[];
1325
1274
  negativeFixtures?: {
1326
- pr: number;
1327
- preimageSource: {
1275
+ filePath: string;
1276
+ matchedSpan: string;
1277
+ nearMissSource: {
1328
1278
  kind: "lesson";
1329
- lessonRef: string;
1330
- badExample: string;
1331
- goodExample: string;
1279
+ example: string;
1280
+ lessonRef?: string | undefined;
1332
1281
  } | {
1333
1282
  kind: "commit";
1334
- preimageCommitSha: string;
1335
- mergeCommitSha: string;
1283
+ commitSha: string;
1336
1284
  };
1337
- filePath: string;
1338
- matchedSpan: string;
1339
- contentHash: string;
1340
1285
  }[] | undefined;
1341
1286
  };
1342
1287
  positiveControl: boolean;
@@ -1369,20 +1314,16 @@ export declare const LegitimacySchema: z.ZodObject<{
1369
1314
  contentHash: string;
1370
1315
  }[];
1371
1316
  negativeFixtures?: {
1372
- pr: number;
1373
- preimageSource: {
1317
+ filePath: string;
1318
+ matchedSpan: string;
1319
+ nearMissSource: {
1374
1320
  kind: "lesson";
1375
- lessonRef: string;
1376
- badExample: string;
1377
- goodExample: string;
1321
+ example: string;
1322
+ lessonRef?: string | undefined;
1378
1323
  } | {
1379
1324
  kind: "commit";
1380
- preimageCommitSha: string;
1381
- mergeCommitSha: string;
1325
+ commitSha: string;
1382
1326
  };
1383
- filePath: string;
1384
- matchedSpan: string;
1385
- contentHash: string;
1386
1327
  }[] | undefined;
1387
1328
  };
1388
1329
  positiveControl: boolean;
@@ -1704,115 +1645,69 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
1704
1645
  matchedSpan: string;
1705
1646
  contentHash: string;
1706
1647
  }>, "many">;
1707
- /** Declared near-misses the rule must stay silent on (feeds §6 negative controls). */
1708
- negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1709
- /** The PR where the defect was caught/introduced (the in-corpus anchor). */
1710
- pr: z.ZodNumber;
1711
- /** The §4 preimage-differential source — lesson-anchored (PRIMARY) or commit-pair (FALLBACK). */
1712
- preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1648
+ /**
1649
+ * Declared SILENCE-ONLY near-misses the rule must stay silent on (feeds §6
1650
+ * `controls.negative[]`). The silence-only `nearMissSource` shape, NOT the
1651
+ * positiveFixtures bad/good pair (strategy#770 — different arity, §6 L142).
1652
+ */
1653
+ negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodObject<{
1654
+ /** File the near-miss locus lives in. */
1655
+ filePath: z.ZodEffects<z.ZodString, string, string>;
1656
+ /** Line-range or AST-node path — the near-miss locus, not just the file. */
1657
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
1658
+ /** The §4-pluggable silence target — ONE side (the matcher must not fire on it). */
1659
+ nearMissSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1713
1660
  kind: z.ZodLiteral<"lesson">;
1714
- /** IMMUTABLE lesson id/hash (the 16-hex `hashLesson` codomain) never a path/mutable alias4/§8). */
1715
- lessonRef: z.ZodString;
1661
+ /** The synthetic near-miss exemplar the matcher must stay SILENT on6). */
1662
+ example: z.ZodEffects<z.ZodString, string, string>;
1716
1663
  /**
1717
- * The defect PREIMAGE exemplar the matcher must FIRE on (§4). This is a lesson
1718
- * corpus `badExample` distinct from `CompiledRuleBaseSchema.badExample` (an
1719
- * optional human-readable code snippet on a compiled rule); here it is the
1720
- * load-bearing positive-control preimage, so non-empty is required.
1664
+ * OPTIONAL immutable lesson id a synthetic near-miss may have no lesson origin,
1665
+ * so unlike the positiveFixtures `lessonRef` it is optional; but WHEN present it
1666
+ * carries the same §8 discipline (the 16-hex `hashLesson` codomain, never a
1667
+ * path/mutable alias), so it can't be a free-form mutable alias.
1721
1668
  */
1722
- badExample: z.ZodEffects<z.ZodString, string, string>;
1723
- /** The fixed POSTIMAGE exemplar the matcher must stay SILENT on (§4) — a lesson `goodExample`. */
1724
- goodExample: z.ZodEffects<z.ZodString, string, string>;
1669
+ lessonRef: z.ZodOptional<z.ZodString>;
1725
1670
  }, "strict", z.ZodTypeAny, {
1726
1671
  kind: "lesson";
1727
- lessonRef: string;
1728
- badExample: string;
1729
- goodExample: string;
1672
+ example: string;
1673
+ lessonRef?: string | undefined;
1730
1674
  }, {
1731
1675
  kind: "lesson";
1732
- lessonRef: string;
1733
- badExample: string;
1734
- goodExample: string;
1676
+ example: string;
1677
+ lessonRef?: string | undefined;
1735
1678
  }>, z.ZodObject<{
1736
1679
  kind: z.ZodLiteral<"commit">;
1737
- /** The PARENT (pre-fix) commit where the DEFECT is present — the matcher must FIRE on this (ADR-112 §4). */
1738
- preimageCommitSha: z.ZodString;
1739
- /** The PR's merge/squash commit — the post-fix (defect-absent) anchor; the matcher must stay SILENT on this. */
1740
- mergeCommitSha: z.ZodString;
1680
+ /** The commit whose state the matcher must stay SILENT on (§6, land-then-fix fallback). */
1681
+ commitSha: z.ZodString;
1741
1682
  }, "strict", z.ZodTypeAny, {
1742
1683
  kind: "commit";
1743
- preimageCommitSha: string;
1744
- mergeCommitSha: string;
1684
+ commitSha: string;
1745
1685
  }, {
1746
1686
  kind: "commit";
1747
- preimageCommitSha: string;
1748
- mergeCommitSha: string;
1687
+ commitSha: string;
1749
1688
  }>]>;
1750
- /** File the defect locus lives in. */
1751
- filePath: z.ZodEffects<z.ZodString, string, string>;
1752
- /** Line-range or AST-node path — the defect locus, not just the file. */
1753
- matchedSpan: z.ZodEffects<z.ZodString, string, string>;
1754
- /** Span content hash, line-drift-stable (cf. `firingLabelId`). */
1755
- contentHash: z.ZodEffects<z.ZodString, string, string>;
1756
1689
  }, "strict", z.ZodTypeAny, {
1757
- pr: number;
1758
- preimageSource: {
1759
- kind: "lesson";
1760
- lessonRef: string;
1761
- badExample: string;
1762
- goodExample: string;
1763
- } | {
1764
- kind: "commit";
1765
- preimageCommitSha: string;
1766
- mergeCommitSha: string;
1767
- };
1768
- filePath: string;
1769
- matchedSpan: string;
1770
- contentHash: string;
1771
- }, {
1772
- pr: number;
1773
- preimageSource: {
1774
- kind: "lesson";
1775
- lessonRef: string;
1776
- badExample: string;
1777
- goodExample: string;
1778
- } | {
1779
- kind: "commit";
1780
- preimageCommitSha: string;
1781
- mergeCommitSha: string;
1782
- };
1783
1690
  filePath: string;
1784
1691
  matchedSpan: string;
1785
- contentHash: string;
1786
- }>, {
1787
- pr: number;
1788
- preimageSource: {
1692
+ nearMissSource: {
1789
1693
  kind: "lesson";
1790
- lessonRef: string;
1791
- badExample: string;
1792
- goodExample: string;
1694
+ example: string;
1695
+ lessonRef?: string | undefined;
1793
1696
  } | {
1794
1697
  kind: "commit";
1795
- preimageCommitSha: string;
1796
- mergeCommitSha: string;
1698
+ commitSha: string;
1797
1699
  };
1700
+ }, {
1798
1701
  filePath: string;
1799
1702
  matchedSpan: string;
1800
- contentHash: string;
1801
- }, {
1802
- pr: number;
1803
- preimageSource: {
1703
+ nearMissSource: {
1804
1704
  kind: "lesson";
1805
- lessonRef: string;
1806
- badExample: string;
1807
- goodExample: string;
1705
+ example: string;
1706
+ lessonRef?: string | undefined;
1808
1707
  } | {
1809
1708
  kind: "commit";
1810
- preimageCommitSha: string;
1811
- mergeCommitSha: string;
1709
+ commitSha: string;
1812
1710
  };
1813
- filePath: string;
1814
- matchedSpan: string;
1815
- contentHash: string;
1816
1711
  }>, "many">>;
1817
1712
  }, "strip", z.ZodTypeAny, {
1818
1713
  kind: "authored";
@@ -1836,20 +1731,16 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
1836
1731
  contentHash: string;
1837
1732
  }[];
1838
1733
  negativeFixtures?: {
1839
- pr: number;
1840
- preimageSource: {
1734
+ filePath: string;
1735
+ matchedSpan: string;
1736
+ nearMissSource: {
1841
1737
  kind: "lesson";
1842
- lessonRef: string;
1843
- badExample: string;
1844
- goodExample: string;
1738
+ example: string;
1739
+ lessonRef?: string | undefined;
1845
1740
  } | {
1846
1741
  kind: "commit";
1847
- preimageCommitSha: string;
1848
- mergeCommitSha: string;
1742
+ commitSha: string;
1849
1743
  };
1850
- filePath: string;
1851
- matchedSpan: string;
1852
- contentHash: string;
1853
1744
  }[] | undefined;
1854
1745
  }, {
1855
1746
  kind: "authored";
@@ -1873,20 +1764,16 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
1873
1764
  contentHash: string;
1874
1765
  }[];
1875
1766
  negativeFixtures?: {
1876
- pr: number;
1877
- preimageSource: {
1767
+ filePath: string;
1768
+ matchedSpan: string;
1769
+ nearMissSource: {
1878
1770
  kind: "lesson";
1879
- lessonRef: string;
1880
- badExample: string;
1881
- goodExample: string;
1771
+ example: string;
1772
+ lessonRef?: string | undefined;
1882
1773
  } | {
1883
1774
  kind: "commit";
1884
- preimageCommitSha: string;
1885
- mergeCommitSha: string;
1775
+ commitSha: string;
1886
1776
  };
1887
- filePath: string;
1888
- matchedSpan: string;
1889
- contentHash: string;
1890
1777
  }[] | undefined;
1891
1778
  }>, z.ZodObject<{
1892
1779
  /**
@@ -1950,20 +1837,16 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
1950
1837
  contentHash: string;
1951
1838
  }[];
1952
1839
  negativeFixtures?: {
1953
- pr: number;
1954
- preimageSource: {
1840
+ filePath: string;
1841
+ matchedSpan: string;
1842
+ nearMissSource: {
1955
1843
  kind: "lesson";
1956
- lessonRef: string;
1957
- badExample: string;
1958
- goodExample: string;
1844
+ example: string;
1845
+ lessonRef?: string | undefined;
1959
1846
  } | {
1960
1847
  kind: "commit";
1961
- preimageCommitSha: string;
1962
- mergeCommitSha: string;
1848
+ commitSha: string;
1963
1849
  };
1964
- filePath: string;
1965
- matchedSpan: string;
1966
- contentHash: string;
1967
1850
  }[] | undefined;
1968
1851
  };
1969
1852
  positiveControl: boolean;
@@ -1996,20 +1879,16 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
1996
1879
  contentHash: string;
1997
1880
  }[];
1998
1881
  negativeFixtures?: {
1999
- pr: number;
2000
- preimageSource: {
1882
+ filePath: string;
1883
+ matchedSpan: string;
1884
+ nearMissSource: {
2001
1885
  kind: "lesson";
2002
- lessonRef: string;
2003
- badExample: string;
2004
- goodExample: string;
1886
+ example: string;
1887
+ lessonRef?: string | undefined;
2005
1888
  } | {
2006
1889
  kind: "commit";
2007
- preimageCommitSha: string;
2008
- mergeCommitSha: string;
1890
+ commitSha: string;
2009
1891
  };
2010
- filePath: string;
2011
- matchedSpan: string;
2012
- contentHash: string;
2013
1892
  }[] | undefined;
2014
1893
  };
2015
1894
  positiveControl: boolean;
@@ -2079,20 +1958,16 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
2079
1958
  contentHash: string;
2080
1959
  }[];
2081
1960
  negativeFixtures?: {
2082
- pr: number;
2083
- preimageSource: {
1961
+ filePath: string;
1962
+ matchedSpan: string;
1963
+ nearMissSource: {
2084
1964
  kind: "lesson";
2085
- lessonRef: string;
2086
- badExample: string;
2087
- goodExample: string;
1965
+ example: string;
1966
+ lessonRef?: string | undefined;
2088
1967
  } | {
2089
1968
  kind: "commit";
2090
- preimageCommitSha: string;
2091
- mergeCommitSha: string;
1969
+ commitSha: string;
2092
1970
  };
2093
- filePath: string;
2094
- matchedSpan: string;
2095
- contentHash: string;
2096
1971
  }[] | undefined;
2097
1972
  };
2098
1973
  positiveControl: boolean;
@@ -2152,20 +2027,16 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
2152
2027
  contentHash: string;
2153
2028
  }[];
2154
2029
  negativeFixtures?: {
2155
- pr: number;
2156
- preimageSource: {
2030
+ filePath: string;
2031
+ matchedSpan: string;
2032
+ nearMissSource: {
2157
2033
  kind: "lesson";
2158
- lessonRef: string;
2159
- badExample: string;
2160
- goodExample: string;
2034
+ example: string;
2035
+ lessonRef?: string | undefined;
2161
2036
  } | {
2162
2037
  kind: "commit";
2163
- preimageCommitSha: string;
2164
- mergeCommitSha: string;
2038
+ commitSha: string;
2165
2039
  };
2166
- filePath: string;
2167
- matchedSpan: string;
2168
- contentHash: string;
2169
2040
  }[] | undefined;
2170
2041
  };
2171
2042
  positiveControl: boolean;
@@ -2225,20 +2096,16 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
2225
2096
  contentHash: string;
2226
2097
  }[];
2227
2098
  negativeFixtures?: {
2228
- pr: number;
2229
- preimageSource: {
2099
+ filePath: string;
2100
+ matchedSpan: string;
2101
+ nearMissSource: {
2230
2102
  kind: "lesson";
2231
- lessonRef: string;
2232
- badExample: string;
2233
- goodExample: string;
2103
+ example: string;
2104
+ lessonRef?: string | undefined;
2234
2105
  } | {
2235
2106
  kind: "commit";
2236
- preimageCommitSha: string;
2237
- mergeCommitSha: string;
2107
+ commitSha: string;
2238
2108
  };
2239
- filePath: string;
2240
- matchedSpan: string;
2241
- contentHash: string;
2242
2109
  }[] | undefined;
2243
2110
  };
2244
2111
  positiveControl: boolean;
@@ -2298,20 +2165,16 @@ export declare const CompiledRuleSchema: z.ZodEffects<z.ZodObject<{
2298
2165
  contentHash: string;
2299
2166
  }[];
2300
2167
  negativeFixtures?: {
2301
- pr: number;
2302
- preimageSource: {
2168
+ filePath: string;
2169
+ matchedSpan: string;
2170
+ nearMissSource: {
2303
2171
  kind: "lesson";
2304
- lessonRef: string;
2305
- badExample: string;
2306
- goodExample: string;
2172
+ example: string;
2173
+ lessonRef?: string | undefined;
2307
2174
  } | {
2308
2175
  kind: "commit";
2309
- preimageCommitSha: string;
2310
- mergeCommitSha: string;
2176
+ commitSha: string;
2311
2177
  };
2312
- filePath: string;
2313
- matchedSpan: string;
2314
- contentHash: string;
2315
2178
  }[] | undefined;
2316
2179
  };
2317
2180
  positiveControl: boolean;
@@ -2739,115 +2602,69 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
2739
2602
  matchedSpan: string;
2740
2603
  contentHash: string;
2741
2604
  }>, "many">;
2742
- /** Declared near-misses the rule must stay silent on (feeds §6 negative controls). */
2743
- negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
2744
- /** The PR where the defect was caught/introduced (the in-corpus anchor). */
2745
- pr: z.ZodNumber;
2746
- /** The §4 preimage-differential source — lesson-anchored (PRIMARY) or commit-pair (FALLBACK). */
2747
- preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2605
+ /**
2606
+ * Declared SILENCE-ONLY near-misses the rule must stay silent on (feeds §6
2607
+ * `controls.negative[]`). The silence-only `nearMissSource` shape, NOT the
2608
+ * positiveFixtures bad/good pair (strategy#770 — different arity, §6 L142).
2609
+ */
2610
+ negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodObject<{
2611
+ /** File the near-miss locus lives in. */
2612
+ filePath: z.ZodEffects<z.ZodString, string, string>;
2613
+ /** Line-range or AST-node path — the near-miss locus, not just the file. */
2614
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
2615
+ /** The §4-pluggable silence target — ONE side (the matcher must not fire on it). */
2616
+ nearMissSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2748
2617
  kind: z.ZodLiteral<"lesson">;
2749
- /** IMMUTABLE lesson id/hash (the 16-hex `hashLesson` codomain) never a path/mutable alias4/§8). */
2750
- lessonRef: z.ZodString;
2618
+ /** The synthetic near-miss exemplar the matcher must stay SILENT on6). */
2619
+ example: z.ZodEffects<z.ZodString, string, string>;
2751
2620
  /**
2752
- * The defect PREIMAGE exemplar the matcher must FIRE on (§4). This is a lesson
2753
- * corpus `badExample` distinct from `CompiledRuleBaseSchema.badExample` (an
2754
- * optional human-readable code snippet on a compiled rule); here it is the
2755
- * load-bearing positive-control preimage, so non-empty is required.
2621
+ * OPTIONAL immutable lesson id a synthetic near-miss may have no lesson origin,
2622
+ * so unlike the positiveFixtures `lessonRef` it is optional; but WHEN present it
2623
+ * carries the same §8 discipline (the 16-hex `hashLesson` codomain, never a
2624
+ * path/mutable alias), so it can't be a free-form mutable alias.
2756
2625
  */
2757
- badExample: z.ZodEffects<z.ZodString, string, string>;
2758
- /** The fixed POSTIMAGE exemplar the matcher must stay SILENT on (§4) — a lesson `goodExample`. */
2759
- goodExample: z.ZodEffects<z.ZodString, string, string>;
2626
+ lessonRef: z.ZodOptional<z.ZodString>;
2760
2627
  }, "strict", z.ZodTypeAny, {
2761
2628
  kind: "lesson";
2762
- lessonRef: string;
2763
- badExample: string;
2764
- goodExample: string;
2629
+ example: string;
2630
+ lessonRef?: string | undefined;
2765
2631
  }, {
2766
2632
  kind: "lesson";
2767
- lessonRef: string;
2768
- badExample: string;
2769
- goodExample: string;
2633
+ example: string;
2634
+ lessonRef?: string | undefined;
2770
2635
  }>, z.ZodObject<{
2771
2636
  kind: z.ZodLiteral<"commit">;
2772
- /** The PARENT (pre-fix) commit where the DEFECT is present — the matcher must FIRE on this (ADR-112 §4). */
2773
- preimageCommitSha: z.ZodString;
2774
- /** The PR's merge/squash commit — the post-fix (defect-absent) anchor; the matcher must stay SILENT on this. */
2775
- mergeCommitSha: z.ZodString;
2637
+ /** The commit whose state the matcher must stay SILENT on (§6, land-then-fix fallback). */
2638
+ commitSha: z.ZodString;
2776
2639
  }, "strict", z.ZodTypeAny, {
2777
2640
  kind: "commit";
2778
- preimageCommitSha: string;
2779
- mergeCommitSha: string;
2641
+ commitSha: string;
2780
2642
  }, {
2781
2643
  kind: "commit";
2782
- preimageCommitSha: string;
2783
- mergeCommitSha: string;
2644
+ commitSha: string;
2784
2645
  }>]>;
2785
- /** File the defect locus lives in. */
2786
- filePath: z.ZodEffects<z.ZodString, string, string>;
2787
- /** Line-range or AST-node path — the defect locus, not just the file. */
2788
- matchedSpan: z.ZodEffects<z.ZodString, string, string>;
2789
- /** Span content hash, line-drift-stable (cf. `firingLabelId`). */
2790
- contentHash: z.ZodEffects<z.ZodString, string, string>;
2791
2646
  }, "strict", z.ZodTypeAny, {
2792
- pr: number;
2793
- preimageSource: {
2794
- kind: "lesson";
2795
- lessonRef: string;
2796
- badExample: string;
2797
- goodExample: string;
2798
- } | {
2799
- kind: "commit";
2800
- preimageCommitSha: string;
2801
- mergeCommitSha: string;
2802
- };
2803
- filePath: string;
2804
- matchedSpan: string;
2805
- contentHash: string;
2806
- }, {
2807
- pr: number;
2808
- preimageSource: {
2809
- kind: "lesson";
2810
- lessonRef: string;
2811
- badExample: string;
2812
- goodExample: string;
2813
- } | {
2814
- kind: "commit";
2815
- preimageCommitSha: string;
2816
- mergeCommitSha: string;
2817
- };
2818
2647
  filePath: string;
2819
2648
  matchedSpan: string;
2820
- contentHash: string;
2821
- }>, {
2822
- pr: number;
2823
- preimageSource: {
2649
+ nearMissSource: {
2824
2650
  kind: "lesson";
2825
- lessonRef: string;
2826
- badExample: string;
2827
- goodExample: string;
2651
+ example: string;
2652
+ lessonRef?: string | undefined;
2828
2653
  } | {
2829
2654
  kind: "commit";
2830
- preimageCommitSha: string;
2831
- mergeCommitSha: string;
2655
+ commitSha: string;
2832
2656
  };
2657
+ }, {
2833
2658
  filePath: string;
2834
2659
  matchedSpan: string;
2835
- contentHash: string;
2836
- }, {
2837
- pr: number;
2838
- preimageSource: {
2660
+ nearMissSource: {
2839
2661
  kind: "lesson";
2840
- lessonRef: string;
2841
- badExample: string;
2842
- goodExample: string;
2662
+ example: string;
2663
+ lessonRef?: string | undefined;
2843
2664
  } | {
2844
2665
  kind: "commit";
2845
- preimageCommitSha: string;
2846
- mergeCommitSha: string;
2666
+ commitSha: string;
2847
2667
  };
2848
- filePath: string;
2849
- matchedSpan: string;
2850
- contentHash: string;
2851
2668
  }>, "many">>;
2852
2669
  }, "strip", z.ZodTypeAny, {
2853
2670
  kind: "authored";
@@ -2871,20 +2688,16 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
2871
2688
  contentHash: string;
2872
2689
  }[];
2873
2690
  negativeFixtures?: {
2874
- pr: number;
2875
- preimageSource: {
2691
+ filePath: string;
2692
+ matchedSpan: string;
2693
+ nearMissSource: {
2876
2694
  kind: "lesson";
2877
- lessonRef: string;
2878
- badExample: string;
2879
- goodExample: string;
2695
+ example: string;
2696
+ lessonRef?: string | undefined;
2880
2697
  } | {
2881
2698
  kind: "commit";
2882
- preimageCommitSha: string;
2883
- mergeCommitSha: string;
2699
+ commitSha: string;
2884
2700
  };
2885
- filePath: string;
2886
- matchedSpan: string;
2887
- contentHash: string;
2888
2701
  }[] | undefined;
2889
2702
  }, {
2890
2703
  kind: "authored";
@@ -2908,20 +2721,16 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
2908
2721
  contentHash: string;
2909
2722
  }[];
2910
2723
  negativeFixtures?: {
2911
- pr: number;
2912
- preimageSource: {
2724
+ filePath: string;
2725
+ matchedSpan: string;
2726
+ nearMissSource: {
2913
2727
  kind: "lesson";
2914
- lessonRef: string;
2915
- badExample: string;
2916
- goodExample: string;
2728
+ example: string;
2729
+ lessonRef?: string | undefined;
2917
2730
  } | {
2918
2731
  kind: "commit";
2919
- preimageCommitSha: string;
2920
- mergeCommitSha: string;
2732
+ commitSha: string;
2921
2733
  };
2922
- filePath: string;
2923
- matchedSpan: string;
2924
- contentHash: string;
2925
2734
  }[] | undefined;
2926
2735
  }>, z.ZodObject<{
2927
2736
  /**
@@ -2985,20 +2794,16 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
2985
2794
  contentHash: string;
2986
2795
  }[];
2987
2796
  negativeFixtures?: {
2988
- pr: number;
2989
- preimageSource: {
2797
+ filePath: string;
2798
+ matchedSpan: string;
2799
+ nearMissSource: {
2990
2800
  kind: "lesson";
2991
- lessonRef: string;
2992
- badExample: string;
2993
- goodExample: string;
2801
+ example: string;
2802
+ lessonRef?: string | undefined;
2994
2803
  } | {
2995
2804
  kind: "commit";
2996
- preimageCommitSha: string;
2997
- mergeCommitSha: string;
2805
+ commitSha: string;
2998
2806
  };
2999
- filePath: string;
3000
- matchedSpan: string;
3001
- contentHash: string;
3002
2807
  }[] | undefined;
3003
2808
  };
3004
2809
  positiveControl: boolean;
@@ -3031,20 +2836,16 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
3031
2836
  contentHash: string;
3032
2837
  }[];
3033
2838
  negativeFixtures?: {
3034
- pr: number;
3035
- preimageSource: {
2839
+ filePath: string;
2840
+ matchedSpan: string;
2841
+ nearMissSource: {
3036
2842
  kind: "lesson";
3037
- lessonRef: string;
3038
- badExample: string;
3039
- goodExample: string;
2843
+ example: string;
2844
+ lessonRef?: string | undefined;
3040
2845
  } | {
3041
2846
  kind: "commit";
3042
- preimageCommitSha: string;
3043
- mergeCommitSha: string;
2847
+ commitSha: string;
3044
2848
  };
3045
- filePath: string;
3046
- matchedSpan: string;
3047
- contentHash: string;
3048
2849
  }[] | undefined;
3049
2850
  };
3050
2851
  positiveControl: boolean;
@@ -3114,20 +2915,16 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
3114
2915
  contentHash: string;
3115
2916
  }[];
3116
2917
  negativeFixtures?: {
3117
- pr: number;
3118
- preimageSource: {
2918
+ filePath: string;
2919
+ matchedSpan: string;
2920
+ nearMissSource: {
3119
2921
  kind: "lesson";
3120
- lessonRef: string;
3121
- badExample: string;
3122
- goodExample: string;
2922
+ example: string;
2923
+ lessonRef?: string | undefined;
3123
2924
  } | {
3124
2925
  kind: "commit";
3125
- preimageCommitSha: string;
3126
- mergeCommitSha: string;
2926
+ commitSha: string;
3127
2927
  };
3128
- filePath: string;
3129
- matchedSpan: string;
3130
- contentHash: string;
3131
2928
  }[] | undefined;
3132
2929
  };
3133
2930
  positiveControl: boolean;
@@ -3187,20 +2984,16 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
3187
2984
  contentHash: string;
3188
2985
  }[];
3189
2986
  negativeFixtures?: {
3190
- pr: number;
3191
- preimageSource: {
2987
+ filePath: string;
2988
+ matchedSpan: string;
2989
+ nearMissSource: {
3192
2990
  kind: "lesson";
3193
- lessonRef: string;
3194
- badExample: string;
3195
- goodExample: string;
2991
+ example: string;
2992
+ lessonRef?: string | undefined;
3196
2993
  } | {
3197
2994
  kind: "commit";
3198
- preimageCommitSha: string;
3199
- mergeCommitSha: string;
2995
+ commitSha: string;
3200
2996
  };
3201
- filePath: string;
3202
- matchedSpan: string;
3203
- contentHash: string;
3204
2997
  }[] | undefined;
3205
2998
  };
3206
2999
  positiveControl: boolean;
@@ -3260,20 +3053,16 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
3260
3053
  contentHash: string;
3261
3054
  }[];
3262
3055
  negativeFixtures?: {
3263
- pr: number;
3264
- preimageSource: {
3056
+ filePath: string;
3057
+ matchedSpan: string;
3058
+ nearMissSource: {
3265
3059
  kind: "lesson";
3266
- lessonRef: string;
3267
- badExample: string;
3268
- goodExample: string;
3060
+ example: string;
3061
+ lessonRef?: string | undefined;
3269
3062
  } | {
3270
3063
  kind: "commit";
3271
- preimageCommitSha: string;
3272
- mergeCommitSha: string;
3064
+ commitSha: string;
3273
3065
  };
3274
- filePath: string;
3275
- matchedSpan: string;
3276
- contentHash: string;
3277
3066
  }[] | undefined;
3278
3067
  };
3279
3068
  positiveControl: boolean;
@@ -3333,20 +3122,16 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
3333
3122
  contentHash: string;
3334
3123
  }[];
3335
3124
  negativeFixtures?: {
3336
- pr: number;
3337
- preimageSource: {
3125
+ filePath: string;
3126
+ matchedSpan: string;
3127
+ nearMissSource: {
3338
3128
  kind: "lesson";
3339
- lessonRef: string;
3340
- badExample: string;
3341
- goodExample: string;
3129
+ example: string;
3130
+ lessonRef?: string | undefined;
3342
3131
  } | {
3343
3132
  kind: "commit";
3344
- preimageCommitSha: string;
3345
- mergeCommitSha: string;
3133
+ commitSha: string;
3346
3134
  };
3347
- filePath: string;
3348
- matchedSpan: string;
3349
- contentHash: string;
3350
3135
  }[] | undefined;
3351
3136
  };
3352
3137
  positiveControl: boolean;
@@ -3456,20 +3241,16 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
3456
3241
  contentHash: string;
3457
3242
  }[];
3458
3243
  negativeFixtures?: {
3459
- pr: number;
3460
- preimageSource: {
3244
+ filePath: string;
3245
+ matchedSpan: string;
3246
+ nearMissSource: {
3461
3247
  kind: "lesson";
3462
- lessonRef: string;
3463
- badExample: string;
3464
- goodExample: string;
3248
+ example: string;
3249
+ lessonRef?: string | undefined;
3465
3250
  } | {
3466
3251
  kind: "commit";
3467
- preimageCommitSha: string;
3468
- mergeCommitSha: string;
3252
+ commitSha: string;
3469
3253
  };
3470
- filePath: string;
3471
- matchedSpan: string;
3472
- contentHash: string;
3473
3254
  }[] | undefined;
3474
3255
  };
3475
3256
  positiveControl: boolean;
@@ -3538,20 +3319,16 @@ export declare const CompiledRulesFileSchema: z.ZodObject<{
3538
3319
  contentHash: string;
3539
3320
  }[];
3540
3321
  negativeFixtures?: {
3541
- pr: number;
3542
- preimageSource: {
3322
+ filePath: string;
3323
+ matchedSpan: string;
3324
+ nearMissSource: {
3543
3325
  kind: "lesson";
3544
- lessonRef: string;
3545
- badExample: string;
3546
- goodExample: string;
3326
+ example: string;
3327
+ lessonRef?: string | undefined;
3547
3328
  } | {
3548
3329
  kind: "commit";
3549
- preimageCommitSha: string;
3550
- mergeCommitSha: string;
3330
+ commitSha: string;
3551
3331
  };
3552
- filePath: string;
3553
- matchedSpan: string;
3554
- contentHash: string;
3555
3332
  }[] | undefined;
3556
3333
  };
3557
3334
  positiveControl: boolean;