eval-quality 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/README.md +142 -67
  2. package/corpus/dev/README.md +17 -11
  3. package/corpus/dev/compile-seal-example/brief.json +1 -1
  4. package/corpus/dev/compile-seal-example/contract.json +1 -1
  5. package/corpus/dev/contracts/absent-collection-locations.json +1 -1
  6. package/corpus/dev/contracts/absent-sibling-groups.json +1 -1
  7. package/corpus/dev/contracts/absent-success-indicator.json +1 -1
  8. package/corpus/dev/contracts/empty-channel-roles.json +1 -1
  9. package/corpus/dev/contracts/empty-collection-locations.json +1 -1
  10. package/corpus/dev/contracts/empty-request-shapes.json +1 -1
  11. package/corpus/dev/contracts/empty-sibling-groups.json +1 -1
  12. package/corpus/dev/contracts/no-collection-quantifier.json +1 -1
  13. package/corpus/dev/contracts/no-operation-inventory.json +1 -1
  14. package/corpus/dev/contracts/no-read-back-relation.json +1 -1
  15. package/corpus/dev/contracts/no-state-change-marker.json +1 -1
  16. package/corpus/dev/contracts/no-type-violating-step.json +1 -1
  17. package/corpus/dev/contracts/per-key-split-oracles.json +1 -1
  18. package/corpus/dev/contracts/satisfied-declarations.json +1 -1
  19. package/corpus/dev/contracts/single-required-response-key.json +1 -1
  20. package/corpus/dev/contracts/split-indicator-oracle.json +1 -1
  21. package/corpus/dev/contracts/unaddressed-parameter-sibling.json +1 -1
  22. package/corpus/dev/contracts/unnamed-reference-set.json +1 -1
  23. package/corpus/dev/contracts/wrong-cardinality-form.json +1 -1
  24. package/corpus/dev/index.json +1 -1
  25. package/dist/application/index.d.ts +2 -0
  26. package/dist/application/index.js +1 -0
  27. package/dist/application/score.d.ts +48 -0
  28. package/dist/application/score.js +186 -0
  29. package/dist/cli/arguments.d.ts +7 -3
  30. package/dist/cli/arguments.js +73 -5
  31. package/dist/cli/exit-codes.d.ts +6 -2
  32. package/dist/cli/exit-codes.js +8 -9
  33. package/dist/cli/main.js +9 -0
  34. package/dist/cli/render.d.ts +1 -1
  35. package/dist/cli/render.js +6 -4
  36. package/dist/cli/run.d.ts +13 -3
  37. package/dist/cli/run.js +136 -16
  38. package/dist/core/canonical/canonicalize.d.ts +12 -0
  39. package/dist/core/canonical/canonicalize.js +18 -4
  40. package/dist/core/compile/bindings.d.ts +70 -0
  41. package/dist/core/compile/bindings.js +317 -0
  42. package/dist/core/compile/compile.d.ts +5 -0
  43. package/dist/core/compile/compile.js +9 -0
  44. package/dist/core/compile/expression-legality.d.ts +49 -0
  45. package/dist/core/compile/expression-legality.js +105 -31
  46. package/dist/core/compile/forbidden-inputs.d.ts +8 -1
  47. package/dist/core/compile/forbidden-inputs.js +16 -3
  48. package/dist/core/compile/interface-inventory.d.ts +23 -1
  49. package/dist/core/compile/interface-inventory.js +32 -3
  50. package/dist/core/compile/reachability.d.ts +18 -1
  51. package/dist/core/compile/reachability.js +46 -1
  52. package/dist/core/compile/sensitivity-witness.d.ts +1 -1
  53. package/dist/core/compile/sensitivity-witness.js +1 -1
  54. package/dist/core/emit/emit.d.ts +9 -0
  55. package/dist/core/emit/emit.js +214 -0
  56. package/dist/core/emit/private-artifact-digest.d.ts +11 -0
  57. package/dist/core/emit/private-artifact-digest.js +31 -0
  58. package/dist/core/evaluate/evidence-resolution.d.ts +11 -1
  59. package/dist/core/evaluate/evidence-resolution.js +4 -1
  60. package/dist/core/failure-codes.d.ts +2 -2
  61. package/dist/core/failure-codes.js +4 -2
  62. package/dist/core/ingest/conditions.d.ts +201 -0
  63. package/dist/core/ingest/conditions.js +48 -0
  64. package/dist/core/ingest/index.d.ts +13 -0
  65. package/dist/core/ingest/index.js +11 -0
  66. package/dist/core/ingest/ingest.d.ts +68 -0
  67. package/dist/core/ingest/ingest.js +310 -0
  68. package/dist/core/lineage/stage-table.d.ts +21 -4
  69. package/dist/core/lineage/stage-table.js +35 -3
  70. package/dist/core/preflight/witness-evidence.js +10 -0
  71. package/dist/core/schemas/artifact.d.ts +385 -14
  72. package/dist/core/schemas/constraint-ledger.js +40 -0
  73. package/dist/core/schemas/defect-signature.d.ts +273 -0
  74. package/dist/core/schemas/defect-signature.js +127 -0
  75. package/dist/core/schemas/eval-contract.d.ts +33 -0
  76. package/dist/core/schemas/eval-contract.js +14 -0
  77. package/dist/core/schemas/evidence-artifact.d.ts +99 -19
  78. package/dist/core/schemas/evidence-artifact.js +64 -8
  79. package/dist/core/schemas/plan.d.ts +112 -0
  80. package/dist/core/schemas/plan.js +67 -2
  81. package/dist/core/schemas/probe-qualification.d.ts +168 -0
  82. package/dist/core/schemas/probe-qualification.js +106 -0
  83. package/dist/core/schemas/probe.d.ts +312 -0
  84. package/dist/core/schemas/probe.js +6 -2
  85. package/dist/core/schemas/scoring-policy.d.ts +1 -0
  86. package/dist/core/schemas/scoring-policy.js +6 -1
  87. package/dist/core/schemas/sealed-evaluator-brief.d.ts +1 -0
  88. package/dist/core/schemas/sealed-evaluator-brief.js +4 -1
  89. package/dist/core/schemas/sealed-run-record.d.ts +30 -3
  90. package/dist/core/schemas/sealed-run-record.js +37 -5
  91. package/dist/core/score/binding-order.d.ts +31 -0
  92. package/dist/core/score/binding-order.js +88 -0
  93. package/dist/core/score/bindings.d.ts +93 -0
  94. package/dist/core/score/bindings.js +297 -0
  95. package/dist/core/score/ladder-table.d.ts +23 -0
  96. package/dist/core/score/ladder-table.js +109 -0
  97. package/dist/core/score/ladder.d.ts +229 -0
  98. package/dist/core/score/ladder.js +464 -0
  99. package/dist/core/score/mode-agreement.d.ts +30 -0
  100. package/dist/core/score/mode-agreement.js +16 -0
  101. package/dist/core/score/outcome-table.d.ts +17 -0
  102. package/dist/core/score/outcome-table.js +172 -0
  103. package/dist/core/score/outcome.d.ts +466 -0
  104. package/dist/core/score/outcome.js +562 -0
  105. package/dist/core/score/qualification.d.ts +83 -0
  106. package/dist/core/score/qualification.js +615 -0
  107. package/dist/core/score/quotation.d.ts +79 -0
  108. package/dist/core/score/quotation.js +201 -0
  109. package/dist/core/score/reduce-trials.d.ts +80 -0
  110. package/dist/core/score/reduce-trials.js +90 -0
  111. package/dist/core/score/score.d.ts +72 -0
  112. package/dist/core/score/score.js +581 -0
  113. package/dist/core/score/selection.d.ts +80 -0
  114. package/dist/core/score/selection.js +98 -0
  115. package/dist/core/score/strength.d.ts +49 -0
  116. package/dist/core/score/strength.js +193 -0
  117. package/dist/core/score/witness.d.ts +117 -0
  118. package/dist/core/score/witness.js +315 -0
  119. package/dist/core/seal/derived-reference.d.ts +1 -1
  120. package/dist/core/seal/derived-reference.js +236 -28
  121. package/dist/core/seal/seal.js +8 -3
  122. package/dist/core/stage-contracts.d.ts +62 -2
  123. package/dist/index.d.ts +1 -1
  124. package/dist/index.js +1 -1
  125. package/dist/testing/index.d.ts +2 -0
  126. package/dist/testing/index.js +1 -0
  127. package/package.json +12 -3
  128. package/schemas/eval-contract.schema.json +100 -2
  129. package/schemas/evidence-artifact.schema.json +96 -9
  130. package/schemas/probe.schema.json +508 -3
  131. package/schemas/scoring-policy.schema.json +8 -1
  132. package/schemas/sealed-evaluator-brief.schema.json +11 -1
  133. package/schemas/sealed-run-record.schema.json +19 -2
@@ -0,0 +1,168 @@
1
+ /** AD-9's five qualification routes, one per way ground truth is earned. */
2
+ import { z } from 'zod';
3
+ /**
4
+ * AD-9 spells a route for each of the five ways a probe earns ground truth. The
5
+ * order is AD-9's own: historical fix boundary, controlled mutation,
6
+ * gameability demonstration, canary, clean control.
7
+ */
8
+ export declare const QUALIFICATION_ROUTES: readonly ['historical', 'controlled-mutation', 'gameability', 'canary', 'clean-control'];
9
+ export type QualificationRouteValue = (typeof QUALIFICATION_ROUTES)[number];
10
+ export declare const QualificationRoute: z.ZodEnum<{
11
+ canary: "canary";
12
+ "clean-control": "clean-control";
13
+ "controlled-mutation": "controlled-mutation";
14
+ gameability: "gameability";
15
+ historical: "historical";
16
+ }>;
17
+ /**
18
+ * AD-9's qualification record, as a tagged union on `route`.
19
+ *
20
+ * A union rather than one wide object with nullable fields: the five routes
21
+ * demand disjoint evidence, and a flat shape would make every route's evidence
22
+ * optional on every other route, which is the shape AD-9 was written against:
23
+ * "a mined fix commit being trusted when its own test already passed at the
24
+ * parent commit". Each branch names what its route must record and nothing
25
+ * else.
26
+ *
27
+ * Required on every probe, canaries included. AD-9 spells a route for all five
28
+ * kinds and closes with "an unqualified probe cannot enter a sealed set" with
29
+ * no exception, so exempting the canary would leave the route AD-9 writes for
30
+ * it with nothing to write it in. The exemption AD-9 does grant attaches to the
31
+ * defect signature, which is AD-40's field.
32
+ *
33
+ * Which route a probe may take is fixed by its class and its `expectedClean`
34
+ * flag, and that pairing is enforced by the corpus qualification gate rather
35
+ * than by a schema refinement: all combinations parse here, so an incompatible
36
+ * pairing stays a reason code carrying an artifact path rather than an
37
+ * anonymous parse failure.
38
+ *
39
+ * Inlined rather than given a `.meta({ id })`. Two `$defs` sharing an internal
40
+ * path are indistinguishable from a schema path alone, and every branch here
41
+ * carries an `ArtifactReference`, so a `$defs` entry would share def-relative
42
+ * suffixes with `Expression` and `ArtifactReference` and make the published
43
+ * keyword walk's stated no-collision premise false.
44
+ */
45
+ export declare const ProbeQualification: z.ZodDiscriminatedUnion<[z.ZodObject<{
46
+ route: z.ZodLiteral<"historical">;
47
+ failBeforeEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
48
+ storage: z.ZodLiteral<"public">;
49
+ path: z.ZodString;
50
+ privateRef: z.ZodNull;
51
+ digest: z.ZodString;
52
+ }, z.core.$strict>, z.ZodObject<{
53
+ storage: z.ZodLiteral<"private">;
54
+ path: z.ZodNull;
55
+ privateRef: z.ZodString;
56
+ digest: z.ZodString;
57
+ }, z.core.$strict>], "storage">;
58
+ passAfterEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
59
+ storage: z.ZodLiteral<"public">;
60
+ path: z.ZodString;
61
+ privateRef: z.ZodNull;
62
+ digest: z.ZodString;
63
+ }, z.core.$strict>, z.ZodObject<{
64
+ storage: z.ZodLiteral<"private">;
65
+ path: z.ZodNull;
66
+ privateRef: z.ZodString;
67
+ digest: z.ZodString;
68
+ }, z.core.$strict>], "storage">;
69
+ fixCommitDigest: z.ZodString;
70
+ oracleStableAcrossRevisions: z.ZodBoolean;
71
+ }, z.core.$strict>, z.ZodObject<{
72
+ route: z.ZodLiteral<"controlled-mutation">;
73
+ mutationSource: z.ZodString;
74
+ mutationOperator: z.ZodString;
75
+ targetArtifact: z.ZodDiscriminatedUnion<[z.ZodObject<{
76
+ storage: z.ZodLiteral<"public">;
77
+ path: z.ZodString;
78
+ privateRef: z.ZodNull;
79
+ digest: z.ZodString;
80
+ }, z.core.$strict>, z.ZodObject<{
81
+ storage: z.ZodLiteral<"private">;
82
+ path: z.ZodNull;
83
+ privateRef: z.ZodString;
84
+ digest: z.ZodString;
85
+ }, z.core.$strict>], "storage">;
86
+ expectedObservableFailure: z.ZodString;
87
+ baselinePassEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
88
+ storage: z.ZodLiteral<"public">;
89
+ path: z.ZodString;
90
+ privateRef: z.ZodNull;
91
+ digest: z.ZodString;
92
+ }, z.core.$strict>, z.ZodObject<{
93
+ storage: z.ZodLiteral<"private">;
94
+ path: z.ZodNull;
95
+ privateRef: z.ZodString;
96
+ digest: z.ZodString;
97
+ }, z.core.$strict>], "storage">;
98
+ mutatedFailEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
99
+ storage: z.ZodLiteral<"public">;
100
+ path: z.ZodString;
101
+ privateRef: z.ZodNull;
102
+ digest: z.ZodString;
103
+ }, z.core.$strict>, z.ZodObject<{
104
+ storage: z.ZodLiteral<"private">;
105
+ path: z.ZodNull;
106
+ privateRef: z.ZodString;
107
+ digest: z.ZodString;
108
+ }, z.core.$strict>], "storage">;
109
+ rollbackVerified: z.ZodBoolean;
110
+ }, z.core.$strict>, z.ZodObject<{
111
+ route: z.ZodLiteral<"gameability">;
112
+ degenerateResponse: z.ZodString;
113
+ naiveOracleSatisfiedEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
114
+ storage: z.ZodLiteral<"public">;
115
+ path: z.ZodString;
116
+ privateRef: z.ZodNull;
117
+ digest: z.ZodString;
118
+ }, z.core.$strict>, z.ZodObject<{
119
+ storage: z.ZodLiteral<"private">;
120
+ path: z.ZodNull;
121
+ privateRef: z.ZodString;
122
+ digest: z.ZodString;
123
+ }, z.core.$strict>], "storage">;
124
+ disciplinedOracleRejectedEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
125
+ storage: z.ZodLiteral<"public">;
126
+ path: z.ZodString;
127
+ privateRef: z.ZodNull;
128
+ digest: z.ZodString;
129
+ }, z.core.$strict>, z.ZodObject<{
130
+ storage: z.ZodLiteral<"private">;
131
+ path: z.ZodNull;
132
+ privateRef: z.ZodString;
133
+ digest: z.ZodString;
134
+ }, z.core.$strict>], "storage">;
135
+ }, z.core.$strict>, z.ZodObject<{
136
+ route: z.ZodLiteral<"canary">;
137
+ indicts: z.ZodEnum<{
138
+ corpus: "corpus";
139
+ fixture: "fixture";
140
+ }>;
141
+ nonDetectionEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
142
+ storage: z.ZodLiteral<"public">;
143
+ path: z.ZodString;
144
+ privateRef: z.ZodNull;
145
+ digest: z.ZodString;
146
+ }, z.core.$strict>, z.ZodObject<{
147
+ storage: z.ZodLiteral<"private">;
148
+ path: z.ZodNull;
149
+ privateRef: z.ZodString;
150
+ digest: z.ZodString;
151
+ }, z.core.$strict>], "storage">;
152
+ }, z.core.$strict>, z.ZodObject<{
153
+ route: z.ZodLiteral<"clean-control">;
154
+ baselinePassEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
155
+ storage: z.ZodLiteral<"public">;
156
+ path: z.ZodString;
157
+ privateRef: z.ZodNull;
158
+ digest: z.ZodString;
159
+ }, z.core.$strict>, z.ZodObject<{
160
+ storage: z.ZodLiteral<"private">;
161
+ path: z.ZodNull;
162
+ privateRef: z.ZodString;
163
+ digest: z.ZodString;
164
+ }, z.core.$strict>], "storage">;
165
+ revisionCommitDigest: z.ZodString;
166
+ noKnownDefectStatement: z.ZodString;
167
+ }, z.core.$strict>], "route">;
168
+ export type ProbeQualification = z.infer<typeof ProbeQualification>;
@@ -0,0 +1,106 @@
1
+ /** AD-9's five qualification routes, one per way ground truth is earned. */
2
+ import { z } from 'zod';
3
+ import { ArtifactReference } from './artifact-reference.js';
4
+ import { Digest } from './primitives.js';
5
+ /**
6
+ * AD-9 spells a route for each of the five ways a probe earns ground truth. The
7
+ * order is AD-9's own: historical fix boundary, controlled mutation,
8
+ * gameability demonstration, canary, clean control.
9
+ */
10
+ export const QUALIFICATION_ROUTES = [
11
+ 'historical',
12
+ 'controlled-mutation',
13
+ 'gameability',
14
+ 'canary',
15
+ 'clean-control',
16
+ ];
17
+ export const QualificationRoute = z.enum(QUALIFICATION_ROUTES);
18
+ /**
19
+ * AD-9's qualification record, as a tagged union on `route`.
20
+ *
21
+ * A union rather than one wide object with nullable fields: the five routes
22
+ * demand disjoint evidence, and a flat shape would make every route's evidence
23
+ * optional on every other route, which is the shape AD-9 was written against:
24
+ * "a mined fix commit being trusted when its own test already passed at the
25
+ * parent commit". Each branch names what its route must record and nothing
26
+ * else.
27
+ *
28
+ * Required on every probe, canaries included. AD-9 spells a route for all five
29
+ * kinds and closes with "an unqualified probe cannot enter a sealed set" with
30
+ * no exception, so exempting the canary would leave the route AD-9 writes for
31
+ * it with nothing to write it in. The exemption AD-9 does grant attaches to the
32
+ * defect signature, which is AD-40's field.
33
+ *
34
+ * Which route a probe may take is fixed by its class and its `expectedClean`
35
+ * flag, and that pairing is enforced by the corpus qualification gate rather
36
+ * than by a schema refinement: all combinations parse here, so an incompatible
37
+ * pairing stays a reason code carrying an artifact path rather than an
38
+ * anonymous parse failure.
39
+ *
40
+ * Inlined rather than given a `.meta({ id })`. Two `$defs` sharing an internal
41
+ * path are indistinguishable from a schema path alone, and every branch here
42
+ * carries an `ArtifactReference`, so a `$defs` entry would share def-relative
43
+ * suffixes with `Expression` and `ArtifactReference` and make the published
44
+ * keyword walk's stated no-collision premise false.
45
+ */
46
+ export const ProbeQualification = z.discriminatedUnion('route', [
47
+ z
48
+ .strictObject({
49
+ route: z.literal('historical'),
50
+ failBeforeEvidence: ArtifactReference.describe('The recorded failure at the parent revision. AD-9 exists because 2 of 18 mined fix commits had a test that already passed at the parent, so this is the half that cannot be assumed.'),
51
+ passAfterEvidence: ArtifactReference,
52
+ fixCommitDigest: Digest.describe('The causally isolated fix boundary AD-9 requires the two evidence records to straddle.'),
53
+ oracleStableAcrossRevisions: z
54
+ .boolean()
55
+ .describe("AD-9 requires the oracle to be stable across both revisions. `false` parses and fails the gate: a route that cannot record its own unmet precondition cannot be audited, and the schema is not where AD-9's admission decision is made."),
56
+ })
57
+ .describe('A historical probe: a defect mined from a real fix boundary, seeded by reverting it.'),
58
+ z
59
+ .strictObject({
60
+ route: z.literal('controlled-mutation'),
61
+ mutationSource: z
62
+ .string()
63
+ .min(1)
64
+ .describe("Where the mutation came from, in the corpus author's own terms. An opaque caller string, unrelated to `Defect.source`'s two-member enum, which records whether the defect is natural or introduced."),
65
+ mutationOperator: z.string().min(1),
66
+ targetArtifact: ArtifactReference,
67
+ expectedObservableFailure: z.string().min(1),
68
+ baselinePassEvidence: ArtifactReference,
69
+ mutatedFailEvidence: ArtifactReference,
70
+ rollbackVerified: z
71
+ .boolean()
72
+ .describe("AD-9's verified rollback or cleanup. `false` parses and fails the gate, for the same reason `oracleStableAcrossRevisions` does."),
73
+ })
74
+ .describe('A controlled mutation: a defect introduced by a named operator against a named artifact.'),
75
+ z
76
+ .strictObject({
77
+ route: z.literal('gameability'),
78
+ degenerateResponse: z
79
+ .string()
80
+ .min(1)
81
+ .describe('The compliant-looking degenerate response, described rather than embedded: AD-8 forbids sealed-case content from entering any artifact.'),
82
+ naiveOracleSatisfiedEvidence: ArtifactReference,
83
+ disciplinedOracleRejectedEvidence: ArtifactReference,
84
+ })
85
+ .describe('A gameability probe: the demonstration that a degenerate response satisfies a naive oracle and is rejected by a disciplined one.'),
86
+ z
87
+ .strictObject({
88
+ route: z.literal('canary'),
89
+ indicts: z
90
+ .enum(['corpus', 'fixture'])
91
+ .describe("AD-9's canary qualifies by demonstrating that non-detection indicts one of these two rather than the contract. Which one it indicts is the demonstration's own result and is recorded rather than left to the reader."),
92
+ nonDetectionEvidence: ArtifactReference,
93
+ })
94
+ .describe('A canary: a probe whose non-detection is evidence about the instrument, never about the contract.'),
95
+ z
96
+ .strictObject({
97
+ route: z.literal('clean-control'),
98
+ baselinePassEvidence: ArtifactReference,
99
+ revisionCommitDigest: Digest,
100
+ noKnownDefectStatement: z
101
+ .string()
102
+ .min(1)
103
+ .describe('AD-9 qualifies a clean control at "a revision with no known defect in the probed interface". No field can prove an absence, so the statement is recorded as an attestation under AD-32 and read as trust rather than as a computed fact.'),
104
+ })
105
+ .describe('A known-clean control: recorded baseline-pass evidence at a revision with no known defect in the probed interface.'),
106
+ ]);
@@ -82,6 +82,129 @@ export declare const Probe: z.ZodDiscriminatedUnion<[z.ZodObject<{
82
82
  artifactDigest: z.ZodString;
83
83
  commitDigest: z.ZodString;
84
84
  rationale: z.ZodString;
85
+ qualification: z.ZodDiscriminatedUnion<[z.ZodObject<{
86
+ route: z.ZodLiteral<"historical">;
87
+ failBeforeEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
88
+ storage: z.ZodLiteral<"public">;
89
+ path: z.ZodString;
90
+ privateRef: z.ZodNull;
91
+ digest: z.ZodString;
92
+ }, z.core.$strict>, z.ZodObject<{
93
+ storage: z.ZodLiteral<"private">;
94
+ path: z.ZodNull;
95
+ privateRef: z.ZodString;
96
+ digest: z.ZodString;
97
+ }, z.core.$strict>], "storage">;
98
+ passAfterEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
99
+ storage: z.ZodLiteral<"public">;
100
+ path: z.ZodString;
101
+ privateRef: z.ZodNull;
102
+ digest: z.ZodString;
103
+ }, z.core.$strict>, z.ZodObject<{
104
+ storage: z.ZodLiteral<"private">;
105
+ path: z.ZodNull;
106
+ privateRef: z.ZodString;
107
+ digest: z.ZodString;
108
+ }, z.core.$strict>], "storage">;
109
+ fixCommitDigest: z.ZodString;
110
+ oracleStableAcrossRevisions: z.ZodBoolean;
111
+ }, z.core.$strict>, z.ZodObject<{
112
+ route: z.ZodLiteral<"controlled-mutation">;
113
+ mutationSource: z.ZodString;
114
+ mutationOperator: z.ZodString;
115
+ targetArtifact: z.ZodDiscriminatedUnion<[z.ZodObject<{
116
+ storage: z.ZodLiteral<"public">;
117
+ path: z.ZodString;
118
+ privateRef: z.ZodNull;
119
+ digest: z.ZodString;
120
+ }, z.core.$strict>, z.ZodObject<{
121
+ storage: z.ZodLiteral<"private">;
122
+ path: z.ZodNull;
123
+ privateRef: z.ZodString;
124
+ digest: z.ZodString;
125
+ }, z.core.$strict>], "storage">;
126
+ expectedObservableFailure: z.ZodString;
127
+ baselinePassEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
128
+ storage: z.ZodLiteral<"public">;
129
+ path: z.ZodString;
130
+ privateRef: z.ZodNull;
131
+ digest: z.ZodString;
132
+ }, z.core.$strict>, z.ZodObject<{
133
+ storage: z.ZodLiteral<"private">;
134
+ path: z.ZodNull;
135
+ privateRef: z.ZodString;
136
+ digest: z.ZodString;
137
+ }, z.core.$strict>], "storage">;
138
+ mutatedFailEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
139
+ storage: z.ZodLiteral<"public">;
140
+ path: z.ZodString;
141
+ privateRef: z.ZodNull;
142
+ digest: z.ZodString;
143
+ }, z.core.$strict>, z.ZodObject<{
144
+ storage: z.ZodLiteral<"private">;
145
+ path: z.ZodNull;
146
+ privateRef: z.ZodString;
147
+ digest: z.ZodString;
148
+ }, z.core.$strict>], "storage">;
149
+ rollbackVerified: z.ZodBoolean;
150
+ }, z.core.$strict>, z.ZodObject<{
151
+ route: z.ZodLiteral<"gameability">;
152
+ degenerateResponse: z.ZodString;
153
+ naiveOracleSatisfiedEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
154
+ storage: z.ZodLiteral<"public">;
155
+ path: z.ZodString;
156
+ privateRef: z.ZodNull;
157
+ digest: z.ZodString;
158
+ }, z.core.$strict>, z.ZodObject<{
159
+ storage: z.ZodLiteral<"private">;
160
+ path: z.ZodNull;
161
+ privateRef: z.ZodString;
162
+ digest: z.ZodString;
163
+ }, z.core.$strict>], "storage">;
164
+ disciplinedOracleRejectedEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
165
+ storage: z.ZodLiteral<"public">;
166
+ path: z.ZodString;
167
+ privateRef: z.ZodNull;
168
+ digest: z.ZodString;
169
+ }, z.core.$strict>, z.ZodObject<{
170
+ storage: z.ZodLiteral<"private">;
171
+ path: z.ZodNull;
172
+ privateRef: z.ZodString;
173
+ digest: z.ZodString;
174
+ }, z.core.$strict>], "storage">;
175
+ }, z.core.$strict>, z.ZodObject<{
176
+ route: z.ZodLiteral<"canary">;
177
+ indicts: z.ZodEnum<{
178
+ corpus: "corpus";
179
+ fixture: "fixture";
180
+ }>;
181
+ nonDetectionEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
182
+ storage: z.ZodLiteral<"public">;
183
+ path: z.ZodString;
184
+ privateRef: z.ZodNull;
185
+ digest: z.ZodString;
186
+ }, z.core.$strict>, z.ZodObject<{
187
+ storage: z.ZodLiteral<"private">;
188
+ path: z.ZodNull;
189
+ privateRef: z.ZodString;
190
+ digest: z.ZodString;
191
+ }, z.core.$strict>], "storage">;
192
+ }, z.core.$strict>, z.ZodObject<{
193
+ route: z.ZodLiteral<"clean-control">;
194
+ baselinePassEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
195
+ storage: z.ZodLiteral<"public">;
196
+ path: z.ZodString;
197
+ privateRef: z.ZodNull;
198
+ digest: z.ZodString;
199
+ }, z.core.$strict>, z.ZodObject<{
200
+ storage: z.ZodLiteral<"private">;
201
+ path: z.ZodNull;
202
+ privateRef: z.ZodString;
203
+ digest: z.ZodString;
204
+ }, z.core.$strict>], "storage">;
205
+ revisionCommitDigest: z.ZodString;
206
+ noKnownDefectStatement: z.ZodString;
207
+ }, z.core.$strict>], "route">;
85
208
  expectedClean: z.ZodLiteral<true>;
86
209
  defects: z.ZodArray<z.ZodObject<{
87
210
  defectId: z.ZodString;
@@ -142,6 +265,129 @@ export declare const Probe: z.ZodDiscriminatedUnion<[z.ZodObject<{
142
265
  artifactDigest: z.ZodString;
143
266
  commitDigest: z.ZodString;
144
267
  rationale: z.ZodString;
268
+ qualification: z.ZodDiscriminatedUnion<[z.ZodObject<{
269
+ route: z.ZodLiteral<"historical">;
270
+ failBeforeEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
271
+ storage: z.ZodLiteral<"public">;
272
+ path: z.ZodString;
273
+ privateRef: z.ZodNull;
274
+ digest: z.ZodString;
275
+ }, z.core.$strict>, z.ZodObject<{
276
+ storage: z.ZodLiteral<"private">;
277
+ path: z.ZodNull;
278
+ privateRef: z.ZodString;
279
+ digest: z.ZodString;
280
+ }, z.core.$strict>], "storage">;
281
+ passAfterEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
282
+ storage: z.ZodLiteral<"public">;
283
+ path: z.ZodString;
284
+ privateRef: z.ZodNull;
285
+ digest: z.ZodString;
286
+ }, z.core.$strict>, z.ZodObject<{
287
+ storage: z.ZodLiteral<"private">;
288
+ path: z.ZodNull;
289
+ privateRef: z.ZodString;
290
+ digest: z.ZodString;
291
+ }, z.core.$strict>], "storage">;
292
+ fixCommitDigest: z.ZodString;
293
+ oracleStableAcrossRevisions: z.ZodBoolean;
294
+ }, z.core.$strict>, z.ZodObject<{
295
+ route: z.ZodLiteral<"controlled-mutation">;
296
+ mutationSource: z.ZodString;
297
+ mutationOperator: z.ZodString;
298
+ targetArtifact: z.ZodDiscriminatedUnion<[z.ZodObject<{
299
+ storage: z.ZodLiteral<"public">;
300
+ path: z.ZodString;
301
+ privateRef: z.ZodNull;
302
+ digest: z.ZodString;
303
+ }, z.core.$strict>, z.ZodObject<{
304
+ storage: z.ZodLiteral<"private">;
305
+ path: z.ZodNull;
306
+ privateRef: z.ZodString;
307
+ digest: z.ZodString;
308
+ }, z.core.$strict>], "storage">;
309
+ expectedObservableFailure: z.ZodString;
310
+ baselinePassEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
311
+ storage: z.ZodLiteral<"public">;
312
+ path: z.ZodString;
313
+ privateRef: z.ZodNull;
314
+ digest: z.ZodString;
315
+ }, z.core.$strict>, z.ZodObject<{
316
+ storage: z.ZodLiteral<"private">;
317
+ path: z.ZodNull;
318
+ privateRef: z.ZodString;
319
+ digest: z.ZodString;
320
+ }, z.core.$strict>], "storage">;
321
+ mutatedFailEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
322
+ storage: z.ZodLiteral<"public">;
323
+ path: z.ZodString;
324
+ privateRef: z.ZodNull;
325
+ digest: z.ZodString;
326
+ }, z.core.$strict>, z.ZodObject<{
327
+ storage: z.ZodLiteral<"private">;
328
+ path: z.ZodNull;
329
+ privateRef: z.ZodString;
330
+ digest: z.ZodString;
331
+ }, z.core.$strict>], "storage">;
332
+ rollbackVerified: z.ZodBoolean;
333
+ }, z.core.$strict>, z.ZodObject<{
334
+ route: z.ZodLiteral<"gameability">;
335
+ degenerateResponse: z.ZodString;
336
+ naiveOracleSatisfiedEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
337
+ storage: z.ZodLiteral<"public">;
338
+ path: z.ZodString;
339
+ privateRef: z.ZodNull;
340
+ digest: z.ZodString;
341
+ }, z.core.$strict>, z.ZodObject<{
342
+ storage: z.ZodLiteral<"private">;
343
+ path: z.ZodNull;
344
+ privateRef: z.ZodString;
345
+ digest: z.ZodString;
346
+ }, z.core.$strict>], "storage">;
347
+ disciplinedOracleRejectedEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
348
+ storage: z.ZodLiteral<"public">;
349
+ path: z.ZodString;
350
+ privateRef: z.ZodNull;
351
+ digest: z.ZodString;
352
+ }, z.core.$strict>, z.ZodObject<{
353
+ storage: z.ZodLiteral<"private">;
354
+ path: z.ZodNull;
355
+ privateRef: z.ZodString;
356
+ digest: z.ZodString;
357
+ }, z.core.$strict>], "storage">;
358
+ }, z.core.$strict>, z.ZodObject<{
359
+ route: z.ZodLiteral<"canary">;
360
+ indicts: z.ZodEnum<{
361
+ corpus: "corpus";
362
+ fixture: "fixture";
363
+ }>;
364
+ nonDetectionEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
365
+ storage: z.ZodLiteral<"public">;
366
+ path: z.ZodString;
367
+ privateRef: z.ZodNull;
368
+ digest: z.ZodString;
369
+ }, z.core.$strict>, z.ZodObject<{
370
+ storage: z.ZodLiteral<"private">;
371
+ path: z.ZodNull;
372
+ privateRef: z.ZodString;
373
+ digest: z.ZodString;
374
+ }, z.core.$strict>], "storage">;
375
+ }, z.core.$strict>, z.ZodObject<{
376
+ route: z.ZodLiteral<"clean-control">;
377
+ baselinePassEvidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
378
+ storage: z.ZodLiteral<"public">;
379
+ path: z.ZodString;
380
+ privateRef: z.ZodNull;
381
+ digest: z.ZodString;
382
+ }, z.core.$strict>, z.ZodObject<{
383
+ storage: z.ZodLiteral<"private">;
384
+ path: z.ZodNull;
385
+ privateRef: z.ZodString;
386
+ digest: z.ZodString;
387
+ }, z.core.$strict>], "storage">;
388
+ revisionCommitDigest: z.ZodString;
389
+ noKnownDefectStatement: z.ZodString;
390
+ }, z.core.$strict>], "route">;
145
391
  expectedClean: z.ZodLiteral<false>;
146
392
  defects: z.ZodArray<z.ZodObject<{
147
393
  defectId: z.ZodString;
@@ -185,5 +431,71 @@ export declare const Probe: z.ZodDiscriminatedUnion<[z.ZodObject<{
185
431
  relation: z.ZodType<import("./expression.ts").Expression, unknown, z.core.$ZodTypeInternals<import("./expression.ts").Expression, unknown>>;
186
432
  }, z.core.$strict>>;
187
433
  }, z.core.$strict>>;
434
+ defectSignature: z.ZodNullable<z.ZodObject<{
435
+ interfaceKind: z.ZodEnum<{
436
+ api: "api";
437
+ cli: "cli";
438
+ mcp: "mcp";
439
+ web: "web";
440
+ }>;
441
+ method: z.ZodEnum<{
442
+ DELETE: "DELETE";
443
+ GET: "GET";
444
+ HEAD: "HEAD";
445
+ OPTIONS: "OPTIONS";
446
+ PATCH: "PATCH";
447
+ POST: "POST";
448
+ PUT: "PUT";
449
+ }>;
450
+ pathTemplate: z.ZodString;
451
+ observableChannel: z.ZodEnum<{
452
+ "call-inputs": "call-inputs";
453
+ "exit-code": "exit-code";
454
+ "response-body": "response-body";
455
+ "response-headers": "response-headers";
456
+ "response-status": "response-status";
457
+ stderr: "stderr";
458
+ stdout: "stdout";
459
+ }>;
460
+ condition: z.ZodObject<{
461
+ selector: z.ZodObject<{
462
+ inputBinding: z.ZodObject<{
463
+ path: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
464
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
465
+ }, z.core.$strict>, z.ZodObject<{
466
+ matcher: z.ZodEnum<{
467
+ any: "any";
468
+ "type-violating": "type-violating";
469
+ }>;
470
+ }, z.core.$strict>]>>>;
471
+ query: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
472
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
473
+ }, z.core.$strict>, z.ZodObject<{
474
+ matcher: z.ZodEnum<{
475
+ any: "any";
476
+ "type-violating": "type-violating";
477
+ }>;
478
+ }, z.core.$strict>]>>>;
479
+ header: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
480
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
481
+ }, z.core.$strict>, z.ZodObject<{
482
+ matcher: z.ZodEnum<{
483
+ any: "any";
484
+ "type-violating": "type-violating";
485
+ }>;
486
+ }, z.core.$strict>]>>>;
487
+ body: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
488
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
489
+ }, z.core.$strict>, z.ZodObject<{
490
+ matcher: z.ZodEnum<{
491
+ any: "any";
492
+ "type-violating": "type-violating";
493
+ }>;
494
+ }, z.core.$strict>]>>>;
495
+ }, z.core.$strict>;
496
+ }, z.core.$strict>;
497
+ predicate: z.ZodType<import("./expression.ts").Expression, unknown, z.core.$ZodTypeInternals<import("./expression.ts").Expression, unknown>>;
498
+ }, z.core.$strict>;
499
+ }, z.core.$strict>>;
188
500
  }, z.core.$strict>], "expectedClean">;
189
501
  export type Probe = z.infer<typeof Probe>;
@@ -1,9 +1,11 @@
1
1
  /** a corpus probe: its class, its control status, and the defects it seeds. */
2
2
  import { z } from 'zod';
3
3
  import { ArtifactReference } from './artifact-reference.js';
4
+ import { DefectSignature } from './defect-signature.js';
4
5
  import { Severity } from './eval-contract.js';
5
6
  import { lineageFields } from './lineage.js';
6
7
  import { BehaviorId, DefectId, Digest, ProbeId } from './primitives.js';
8
+ import { ProbeQualification } from './probe-qualification.js';
7
9
  import { ManifestationWitness } from './sensitivity-witness.js';
8
10
  /**
9
11
  * AD-9's closed four, one per probe, in scope because AD-7's strength vector
@@ -44,6 +46,7 @@ const probeCommonFields = {
44
46
  artifactDigest: Digest,
45
47
  commitDigest: Digest,
46
48
  rationale: z.string().min(1),
49
+ qualification: ProbeQualification.describe('AD-9\'s qualification record: which of the five routes earned this probe its ground truth, and the evidence that route demands. Required on every branch and on every class, canaries included, because AD-9 closes with "an unqualified probe cannot enter a sealed set" and spells a route for all five kinds. That the route is compatible with this probe\'s class and `expectedClean` flag is a cross-field rule the export cannot carry; the corpus qualification gate enforces it and returns a reason code. Required, not optional, which with `defectSignature` below makes the probe\'s `schemaVersion` 1 -> 2 BREAKING bump under AD-11, whose rule is that "adding an optional field is a `schemaVersion` bump recorded in the field\'s own description; removing or retyping is breaking". This field is on both branches, so it alone is what stops every version-1 probe from parsing.'),
47
50
  };
48
51
  /**
49
52
  * The prior art's `expectedClean` conditional, re-expressed as a discriminated
@@ -73,10 +76,11 @@ export const Probe = z
73
76
  defects: z
74
77
  .array(Defect)
75
78
  .describe('No minimum. AD-9 states none, and a minimum would make a canary unrepresentable, since a canary indicts the fixture rather than seeding a defect.'),
79
+ defectSignature: DefectSignature.nullable().describe("AD-40's machine-readable defect signature, declared on this branch alone: a clean control seeds nothing, so its branch has no signature to carry. Nullable rather than plain, because the one class that legitimately carries none is `canary`, and a union-level refinement expressing that is dropped from the published export, which would leave Zod rejecting a probe ajv accepts. The corpus qualification gate is the enforcement point and the constraint ledger records the gap; the shipped precedent is `compile/interface-inventory.ts`, which put the principal check in the compiler for the same reason. The other half of the probe's `schemaVersion` 1 -> 2 BREAKING bump under AD-11, recorded here as that rule requires: the key is required on this branch, and `null` is the legal value a canary carries."),
76
80
  })
77
- .describe('A probe that is not a known-clean control.'),
81
+ .describe('A probe that is not a known-clean control. The one branch AD-40 gives a defect signature.'),
78
82
  ])
79
83
  .meta({
80
84
  id: 'Probe',
81
- description: "One corpus probe. Succeeds the prior-art `h0-ground-truth` schema per AD-24, carrying its system identifier, implementation digest, `expectedClean` flag, seeded defects, and rationale, and adding AD-9's probe class and AD-9's per-probe artifact and commit digests. Divergences: `implementationSha` becomes `implementationDigest`, `taskId` does not survive because the probe pins what it describes by digest, and `expectedGate` does not survive because AD-40 makes detection a signature match rather than a verdict comparison and AD-7 keeps comparisons inside the dominance vector, so carrying an expected gate would invite a comparison the architecture forbids. Two constructions are deliberately absent: AD-9's per-class QUALIFICATION record, whose five prose routes name no fields and whose acceptance criteria of record do not command it, and AD-40's machine-readable DEFECT SIGNATURE, which Owed item 7 records as having no fixture to land in because this repository contains no probe at all. Both arrive as additive `schemaVersion` bumps under AD-11 once a corpus exists to carry them. The cost is named rather than hidden: AD-9's \"an unqualified probe cannot enter a sealed set\" is enforced by nothing in v0: not this schema, not an AD-5 code, and not an AD-21 rung.",
85
+ description: "One corpus probe. Succeeds the prior-art `h0-ground-truth` schema per AD-24, carrying its system identifier, implementation digest, `expectedClean` flag, seeded defects, and rationale, and adding AD-9's probe class and AD-9's per-probe artifact and commit digests. Divergences: `implementationSha` becomes `implementationDigest`, `taskId` does not survive because the probe pins what it describes by digest, and `expectedGate` does not survive because AD-40 makes detection a signature match rather than a verdict comparison and AD-7 keeps comparisons inside the dominance vector, so carrying an expected gate would invite a comparison the architecture forbids. Two constructions landed here together under one BREAKING `schemaVersion` bump: AD-9's per-class QUALIFICATION record, as a five-route tagged union required on every branch, and AD-40's machine-readable DEFECT SIGNATURE on the `expectedClean: false` branch, carrying the interface kind, the home operation as a method and a path template, the observable channel, and the discriminating condition. Both are required rather than optional, which is what makes the bump breaking under AD-11: every corpus written against version 1 fails to parse. What the schema still does not decide is stated rather than hidden. AD-9's \"an unqualified probe cannot enter a sealed set\" is a corpus-construction invariant enforced by the qualification gate in `core/score/qualification.ts`, not by this schema: all eight class-and-`expectedClean` pairings parse, a route incompatible with the pair parses, and a signature-less non-canary parses, each so the gate can return a reason code carrying an artifact path instead of an anonymous parse failure. The constraint ledger carries both gaps.",
82
86
  });
@@ -20,6 +20,7 @@ export declare const ScoringPolicy: z.ZodObject<{
20
20
  material: "material";
21
21
  }>;
22
22
  confidenceThreshold: z.ZodNumber;
23
+ catchThreshold: z.ZodNumber;
23
24
  minimumTrialCount: z.ZodInt;
24
25
  reExecutionCap: z.ZodInt;
25
26
  remediationCap: z.ZodInt;