@mmnto/totem 1.78.0 → 1.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/artifacts/panel.d.ts +48 -48
- package/dist/artifacts/schema.d.ts +40 -40
- package/dist/compiler-schema.d.ts +2455 -35
- package/dist/compiler-schema.d.ts.map +1 -1
- package/dist/compiler-schema.js +229 -1
- package/dist/compiler-schema.js.map +1 -1
- package/dist/compiler-schema.test.js +249 -2
- package/dist/compiler-schema.test.js.map +1 -1
- package/dist/compiler.d.ts +2 -2
- package/dist/compiler.d.ts.map +1 -1
- package/dist/compiler.js +1 -1
- package/dist/compiler.js.map +1 -1
- package/dist/config-schema.d.ts +6 -6
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/spine/authored-rule.d.ts +1358 -0
- package/dist/spine/authored-rule.d.ts.map +1 -0
- package/dist/spine/authored-rule.js +313 -0
- package/dist/spine/authored-rule.js.map +1 -0
- package/dist/spine/authored-rule.test.d.ts +2 -0
- package/dist/spine/authored-rule.test.d.ts.map +1 -0
- package/dist/spine/authored-rule.test.js +226 -0
- package/dist/spine/authored-rule.test.js.map +1 -0
- package/dist/spine/authoring-ledger.d.ts +204 -0
- package/dist/spine/authoring-ledger.d.ts.map +1 -0
- package/dist/spine/authoring-ledger.js +220 -0
- package/dist/spine/authoring-ledger.js.map +1 -0
- package/dist/spine/authoring-ledger.test.d.ts +2 -0
- package/dist/spine/authoring-ledger.test.d.ts.map +1 -0
- package/dist/spine/authoring-ledger.test.js +144 -0
- package/dist/spine/authoring-ledger.test.js.map +1 -0
- package/dist/spine/candidate-rule.d.ts +32 -0
- package/dist/spine/candidate-rule.d.ts.map +1 -1
- package/dist/spine/candidate-rule.js +2 -2
- package/dist/spine/candidate-rule.js.map +1 -1
- package/dist/spine/classify.d.ts +5 -5
- package/dist/spine/compile.d.ts +16 -4
- package/dist/spine/compile.d.ts.map +1 -1
- package/dist/spine/compile.js +23 -0
- package/dist/spine/compile.js.map +1 -1
- package/dist/spine/compile.test.js +72 -0
- package/dist/spine/compile.test.js.map +1 -1
- package/dist/spine/corpus-dispositions.d.ts +22 -22
- package/dist/spine/extract.d.ts +2 -2
- package/dist/spine/extract.d.ts.map +1 -1
- package/dist/spine/extract.js +5 -4
- package/dist/spine/extract.js.map +1 -1
- package/dist/spine/ledgers.d.ts +46 -21
- package/dist/spine/ledgers.d.ts.map +1 -1
- package/dist/spine/ledgers.js +16 -8
- package/dist/spine/ledgers.js.map +1 -1
- package/dist/spine/rule-policy.d.ts +27 -0
- package/dist/spine/rule-policy.d.ts.map +1 -0
- package/dist/spine/rule-policy.js +43 -0
- package/dist/spine/rule-policy.js.map +1 -0
- package/dist/spine/rule-policy.test.d.ts +2 -0
- package/dist/spine/rule-policy.test.d.ts.map +1 -0
- package/dist/spine/rule-policy.test.js +31 -0
- package/dist/spine/rule-policy.test.js.map +1 -0
- package/dist/spine/windtunnel-lock.d.ts +14 -14
- package/dist/store/lance-schema.d.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,1358 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { CompileInputCandidate } from './candidate-rule.js';
|
|
3
|
+
import type { ClassifierLedger } from './ledgers.js';
|
|
4
|
+
/** The matcher engines an authored rule may declare (mirrors `CompiledRule.engine`). */
|
|
5
|
+
export declare const DeclaredEngineSchema: z.ZodEnum<["regex", "ast", "ast-grep"]>;
|
|
6
|
+
export type DeclaredEngine = z.infer<typeof DeclaredEngineSchema>;
|
|
7
|
+
/**
|
|
8
|
+
* ADR-112 §3 — the result of the INDEPENDENT structural-eligibility check.
|
|
9
|
+
* Produced by `evaluateStructuralEligibility` (NOT by the author): only
|
|
10
|
+
* `decidable: true` reaches the compiler, mapping to the compiler's
|
|
11
|
+
* `classifierDisposition: 'structural'`. `judgedBy` records who/what judged it
|
|
12
|
+
* (ledger-recorded, never the author), so a human cannot smuggle a behavioral
|
|
13
|
+
* policy past ADR-091's gate by hand-asserting "structural" (FM(d)).
|
|
14
|
+
*/
|
|
15
|
+
export declare const StructEligResultSchema: z.ZodObject<{
|
|
16
|
+
decidable: z.ZodBoolean;
|
|
17
|
+
/**
|
|
18
|
+
* `whitelist:<class>` for the cert-#1 static-whitelist basis; the
|
|
19
|
+
* `capability-check` / `draft-classifier+stage4` bases are contract-legal but
|
|
20
|
+
* deferred (slice-A uses the deterministic whitelist only). On a `decidable:
|
|
21
|
+
* false` verdict the basis still names the attempted whitelist class — the
|
|
22
|
+
* diagnostic is "no/ambiguous whitelist match", carried in `judgedBy`'s log.
|
|
23
|
+
* Constrained to the §3 forms (strategy item 2, #2259) so a typo'd/free-form
|
|
24
|
+
* basis can't validate — non-mutating (no `.trim()`), matching the hash-stability
|
|
25
|
+
* discipline on the other reference fields.
|
|
26
|
+
*/
|
|
27
|
+
basis: z.ZodEffects<z.ZodString, string, string>;
|
|
28
|
+
judgedBy: z.ZodEffects<z.ZodString, string, string>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
decidable: boolean;
|
|
31
|
+
basis: string;
|
|
32
|
+
judgedBy: string;
|
|
33
|
+
}, {
|
|
34
|
+
decidable: boolean;
|
|
35
|
+
basis: string;
|
|
36
|
+
judgedBy: string;
|
|
37
|
+
}>;
|
|
38
|
+
export type StructEligResult = z.infer<typeof StructEligResultSchema>;
|
|
39
|
+
/** ADR-112 §3/§7 — accelerant-lineage marker. A mined hint that informed a human is recorded, never erased. */
|
|
40
|
+
export declare const AuthoredOriginSchema: z.ZodUnion<[z.ZodObject<{
|
|
41
|
+
kind: z.ZodLiteral<"from-scratch">;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
kind: "from-scratch";
|
|
44
|
+
}, {
|
|
45
|
+
kind: "from-scratch";
|
|
46
|
+
}>, z.ZodObject<{
|
|
47
|
+
kind: z.ZodLiteral<"mined-accelerant">;
|
|
48
|
+
sourceRunId: z.ZodEffects<z.ZodString, string, string>;
|
|
49
|
+
suggestionHash: z.ZodEffects<z.ZodString, string, string>;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
kind: "mined-accelerant";
|
|
52
|
+
sourceRunId: string;
|
|
53
|
+
suggestionHash: string;
|
|
54
|
+
}, {
|
|
55
|
+
kind: "mined-accelerant";
|
|
56
|
+
sourceRunId: string;
|
|
57
|
+
suggestionHash: string;
|
|
58
|
+
}>]>;
|
|
59
|
+
export type AuthoredOrigin = z.infer<typeof AuthoredOriginSchema>;
|
|
60
|
+
/**
|
|
61
|
+
* ADR-112 §3 — the authored producer's sole output envelope. Parallel to
|
|
62
|
+
* ADR-111's `CandidateRuleRecord` but carrying the AUTHORED provenance variant,
|
|
63
|
+
* the INDEPENDENTLY-judged eligibility result, and the accelerant lineage.
|
|
64
|
+
* Minted `unverified: true` (ADR-089) — zero enforcement blast radius.
|
|
65
|
+
*/
|
|
66
|
+
export declare const AuthoredRuleRecordSchema: z.ZodObject<{
|
|
67
|
+
/**
|
|
68
|
+
* ADR-112 §3/§8 — the stable, minted rule identity (`mintAuthoredRuleId`),
|
|
69
|
+
* assigned ONCE at authoring time and PERSISTED on the record; NEVER re-derived
|
|
70
|
+
* from content at read time. `firingLabelId` + the §5.3
|
|
71
|
+
* `controls.positive[].targetRuleId` ground-truth labels embed it, so a
|
|
72
|
+
* content-re-derived id would orphan them (§8). Slice A reserves the field (this
|
|
73
|
+
* IS the schema spine); the authoring flow (slice B) mints it, and threading it
|
|
74
|
+
* into the compiled artifact's identity (`firingLabelId ← ruleId`, replacing the
|
|
75
|
+
* `dslSource`-derived `lessonHash`) is slice C/D. The RESOLVED id (with any `-N`
|
|
76
|
+
* collision suffix) is what is stored.
|
|
77
|
+
*/
|
|
78
|
+
ruleId: z.ZodString;
|
|
79
|
+
provenance: z.ZodObject<{
|
|
80
|
+
kind: z.ZodLiteral<"authored">;
|
|
81
|
+
author: z.ZodEffects<z.ZodString, string, string>;
|
|
82
|
+
authoredAt: z.ZodEffects<z.ZodString, string, string>;
|
|
83
|
+
targetDefect: z.ZodEffects<z.ZodString, string, string>;
|
|
84
|
+
positiveFixtures: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
85
|
+
pr: z.ZodNumber;
|
|
86
|
+
preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
87
|
+
kind: z.ZodLiteral<"lesson">;
|
|
88
|
+
lessonRef: z.ZodString;
|
|
89
|
+
badExample: z.ZodEffects<z.ZodString, string, string>;
|
|
90
|
+
goodExample: z.ZodEffects<z.ZodString, string, string>;
|
|
91
|
+
}, "strict", z.ZodTypeAny, {
|
|
92
|
+
kind: "lesson";
|
|
93
|
+
lessonRef: string;
|
|
94
|
+
badExample: string;
|
|
95
|
+
goodExample: string;
|
|
96
|
+
}, {
|
|
97
|
+
kind: "lesson";
|
|
98
|
+
lessonRef: string;
|
|
99
|
+
badExample: string;
|
|
100
|
+
goodExample: string;
|
|
101
|
+
}>, z.ZodObject<{
|
|
102
|
+
kind: z.ZodLiteral<"commit">;
|
|
103
|
+
preimageCommitSha: z.ZodString;
|
|
104
|
+
mergeCommitSha: z.ZodString;
|
|
105
|
+
}, "strict", z.ZodTypeAny, {
|
|
106
|
+
kind: "commit";
|
|
107
|
+
preimageCommitSha: string;
|
|
108
|
+
mergeCommitSha: string;
|
|
109
|
+
}, {
|
|
110
|
+
kind: "commit";
|
|
111
|
+
preimageCommitSha: string;
|
|
112
|
+
mergeCommitSha: string;
|
|
113
|
+
}>]>;
|
|
114
|
+
filePath: z.ZodEffects<z.ZodString, string, string>;
|
|
115
|
+
matchedSpan: z.ZodEffects<z.ZodString, string, string>;
|
|
116
|
+
contentHash: z.ZodEffects<z.ZodString, string, string>;
|
|
117
|
+
}, "strict", z.ZodTypeAny, {
|
|
118
|
+
pr: number;
|
|
119
|
+
preimageSource: {
|
|
120
|
+
kind: "lesson";
|
|
121
|
+
lessonRef: string;
|
|
122
|
+
badExample: string;
|
|
123
|
+
goodExample: string;
|
|
124
|
+
} | {
|
|
125
|
+
kind: "commit";
|
|
126
|
+
preimageCommitSha: string;
|
|
127
|
+
mergeCommitSha: string;
|
|
128
|
+
};
|
|
129
|
+
filePath: string;
|
|
130
|
+
matchedSpan: string;
|
|
131
|
+
contentHash: string;
|
|
132
|
+
}, {
|
|
133
|
+
pr: number;
|
|
134
|
+
preimageSource: {
|
|
135
|
+
kind: "lesson";
|
|
136
|
+
lessonRef: string;
|
|
137
|
+
badExample: string;
|
|
138
|
+
goodExample: string;
|
|
139
|
+
} | {
|
|
140
|
+
kind: "commit";
|
|
141
|
+
preimageCommitSha: string;
|
|
142
|
+
mergeCommitSha: string;
|
|
143
|
+
};
|
|
144
|
+
filePath: string;
|
|
145
|
+
matchedSpan: string;
|
|
146
|
+
contentHash: string;
|
|
147
|
+
}>, {
|
|
148
|
+
pr: number;
|
|
149
|
+
preimageSource: {
|
|
150
|
+
kind: "lesson";
|
|
151
|
+
lessonRef: string;
|
|
152
|
+
badExample: string;
|
|
153
|
+
goodExample: string;
|
|
154
|
+
} | {
|
|
155
|
+
kind: "commit";
|
|
156
|
+
preimageCommitSha: string;
|
|
157
|
+
mergeCommitSha: string;
|
|
158
|
+
};
|
|
159
|
+
filePath: string;
|
|
160
|
+
matchedSpan: string;
|
|
161
|
+
contentHash: string;
|
|
162
|
+
}, {
|
|
163
|
+
pr: number;
|
|
164
|
+
preimageSource: {
|
|
165
|
+
kind: "lesson";
|
|
166
|
+
lessonRef: string;
|
|
167
|
+
badExample: string;
|
|
168
|
+
goodExample: string;
|
|
169
|
+
} | {
|
|
170
|
+
kind: "commit";
|
|
171
|
+
preimageCommitSha: string;
|
|
172
|
+
mergeCommitSha: string;
|
|
173
|
+
};
|
|
174
|
+
filePath: string;
|
|
175
|
+
matchedSpan: string;
|
|
176
|
+
contentHash: string;
|
|
177
|
+
}>, "many">;
|
|
178
|
+
negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
179
|
+
pr: z.ZodNumber;
|
|
180
|
+
preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
181
|
+
kind: z.ZodLiteral<"lesson">;
|
|
182
|
+
lessonRef: z.ZodString;
|
|
183
|
+
badExample: z.ZodEffects<z.ZodString, string, string>;
|
|
184
|
+
goodExample: z.ZodEffects<z.ZodString, string, string>;
|
|
185
|
+
}, "strict", z.ZodTypeAny, {
|
|
186
|
+
kind: "lesson";
|
|
187
|
+
lessonRef: string;
|
|
188
|
+
badExample: string;
|
|
189
|
+
goodExample: string;
|
|
190
|
+
}, {
|
|
191
|
+
kind: "lesson";
|
|
192
|
+
lessonRef: string;
|
|
193
|
+
badExample: string;
|
|
194
|
+
goodExample: string;
|
|
195
|
+
}>, z.ZodObject<{
|
|
196
|
+
kind: z.ZodLiteral<"commit">;
|
|
197
|
+
preimageCommitSha: z.ZodString;
|
|
198
|
+
mergeCommitSha: z.ZodString;
|
|
199
|
+
}, "strict", z.ZodTypeAny, {
|
|
200
|
+
kind: "commit";
|
|
201
|
+
preimageCommitSha: string;
|
|
202
|
+
mergeCommitSha: string;
|
|
203
|
+
}, {
|
|
204
|
+
kind: "commit";
|
|
205
|
+
preimageCommitSha: string;
|
|
206
|
+
mergeCommitSha: string;
|
|
207
|
+
}>]>;
|
|
208
|
+
filePath: z.ZodEffects<z.ZodString, string, string>;
|
|
209
|
+
matchedSpan: z.ZodEffects<z.ZodString, string, string>;
|
|
210
|
+
contentHash: z.ZodEffects<z.ZodString, string, string>;
|
|
211
|
+
}, "strict", z.ZodTypeAny, {
|
|
212
|
+
pr: number;
|
|
213
|
+
preimageSource: {
|
|
214
|
+
kind: "lesson";
|
|
215
|
+
lessonRef: string;
|
|
216
|
+
badExample: string;
|
|
217
|
+
goodExample: string;
|
|
218
|
+
} | {
|
|
219
|
+
kind: "commit";
|
|
220
|
+
preimageCommitSha: string;
|
|
221
|
+
mergeCommitSha: string;
|
|
222
|
+
};
|
|
223
|
+
filePath: string;
|
|
224
|
+
matchedSpan: string;
|
|
225
|
+
contentHash: string;
|
|
226
|
+
}, {
|
|
227
|
+
pr: number;
|
|
228
|
+
preimageSource: {
|
|
229
|
+
kind: "lesson";
|
|
230
|
+
lessonRef: string;
|
|
231
|
+
badExample: string;
|
|
232
|
+
goodExample: string;
|
|
233
|
+
} | {
|
|
234
|
+
kind: "commit";
|
|
235
|
+
preimageCommitSha: string;
|
|
236
|
+
mergeCommitSha: string;
|
|
237
|
+
};
|
|
238
|
+
filePath: string;
|
|
239
|
+
matchedSpan: string;
|
|
240
|
+
contentHash: string;
|
|
241
|
+
}>, {
|
|
242
|
+
pr: number;
|
|
243
|
+
preimageSource: {
|
|
244
|
+
kind: "lesson";
|
|
245
|
+
lessonRef: string;
|
|
246
|
+
badExample: string;
|
|
247
|
+
goodExample: string;
|
|
248
|
+
} | {
|
|
249
|
+
kind: "commit";
|
|
250
|
+
preimageCommitSha: string;
|
|
251
|
+
mergeCommitSha: string;
|
|
252
|
+
};
|
|
253
|
+
filePath: string;
|
|
254
|
+
matchedSpan: string;
|
|
255
|
+
contentHash: string;
|
|
256
|
+
}, {
|
|
257
|
+
pr: number;
|
|
258
|
+
preimageSource: {
|
|
259
|
+
kind: "lesson";
|
|
260
|
+
lessonRef: string;
|
|
261
|
+
badExample: string;
|
|
262
|
+
goodExample: string;
|
|
263
|
+
} | {
|
|
264
|
+
kind: "commit";
|
|
265
|
+
preimageCommitSha: string;
|
|
266
|
+
mergeCommitSha: string;
|
|
267
|
+
};
|
|
268
|
+
filePath: string;
|
|
269
|
+
matchedSpan: string;
|
|
270
|
+
contentHash: string;
|
|
271
|
+
}>, "many">>;
|
|
272
|
+
}, "strip", z.ZodTypeAny, {
|
|
273
|
+
kind: "authored";
|
|
274
|
+
author: string;
|
|
275
|
+
authoredAt: string;
|
|
276
|
+
targetDefect: string;
|
|
277
|
+
positiveFixtures: {
|
|
278
|
+
pr: number;
|
|
279
|
+
preimageSource: {
|
|
280
|
+
kind: "lesson";
|
|
281
|
+
lessonRef: string;
|
|
282
|
+
badExample: string;
|
|
283
|
+
goodExample: string;
|
|
284
|
+
} | {
|
|
285
|
+
kind: "commit";
|
|
286
|
+
preimageCommitSha: string;
|
|
287
|
+
mergeCommitSha: string;
|
|
288
|
+
};
|
|
289
|
+
filePath: string;
|
|
290
|
+
matchedSpan: string;
|
|
291
|
+
contentHash: string;
|
|
292
|
+
}[];
|
|
293
|
+
negativeFixtures?: {
|
|
294
|
+
pr: number;
|
|
295
|
+
preimageSource: {
|
|
296
|
+
kind: "lesson";
|
|
297
|
+
lessonRef: string;
|
|
298
|
+
badExample: string;
|
|
299
|
+
goodExample: string;
|
|
300
|
+
} | {
|
|
301
|
+
kind: "commit";
|
|
302
|
+
preimageCommitSha: string;
|
|
303
|
+
mergeCommitSha: string;
|
|
304
|
+
};
|
|
305
|
+
filePath: string;
|
|
306
|
+
matchedSpan: string;
|
|
307
|
+
contentHash: string;
|
|
308
|
+
}[] | undefined;
|
|
309
|
+
}, {
|
|
310
|
+
kind: "authored";
|
|
311
|
+
author: string;
|
|
312
|
+
authoredAt: string;
|
|
313
|
+
targetDefect: string;
|
|
314
|
+
positiveFixtures: {
|
|
315
|
+
pr: number;
|
|
316
|
+
preimageSource: {
|
|
317
|
+
kind: "lesson";
|
|
318
|
+
lessonRef: string;
|
|
319
|
+
badExample: string;
|
|
320
|
+
goodExample: string;
|
|
321
|
+
} | {
|
|
322
|
+
kind: "commit";
|
|
323
|
+
preimageCommitSha: string;
|
|
324
|
+
mergeCommitSha: string;
|
|
325
|
+
};
|
|
326
|
+
filePath: string;
|
|
327
|
+
matchedSpan: string;
|
|
328
|
+
contentHash: string;
|
|
329
|
+
}[];
|
|
330
|
+
negativeFixtures?: {
|
|
331
|
+
pr: number;
|
|
332
|
+
preimageSource: {
|
|
333
|
+
kind: "lesson";
|
|
334
|
+
lessonRef: string;
|
|
335
|
+
badExample: string;
|
|
336
|
+
goodExample: string;
|
|
337
|
+
} | {
|
|
338
|
+
kind: "commit";
|
|
339
|
+
preimageCommitSha: string;
|
|
340
|
+
mergeCommitSha: string;
|
|
341
|
+
};
|
|
342
|
+
filePath: string;
|
|
343
|
+
matchedSpan: string;
|
|
344
|
+
contentHash: string;
|
|
345
|
+
}[] | undefined;
|
|
346
|
+
}>;
|
|
347
|
+
/** INDEPENDENTLY established (§3) — the author never sets this; the check does. */
|
|
348
|
+
structuralEligibility: z.ZodObject<{
|
|
349
|
+
decidable: z.ZodBoolean;
|
|
350
|
+
/**
|
|
351
|
+
* `whitelist:<class>` for the cert-#1 static-whitelist basis; the
|
|
352
|
+
* `capability-check` / `draft-classifier+stage4` bases are contract-legal but
|
|
353
|
+
* deferred (slice-A uses the deterministic whitelist only). On a `decidable:
|
|
354
|
+
* false` verdict the basis still names the attempted whitelist class — the
|
|
355
|
+
* diagnostic is "no/ambiguous whitelist match", carried in `judgedBy`'s log.
|
|
356
|
+
* Constrained to the §3 forms (strategy item 2, #2259) so a typo'd/free-form
|
|
357
|
+
* basis can't validate — non-mutating (no `.trim()`), matching the hash-stability
|
|
358
|
+
* discipline on the other reference fields.
|
|
359
|
+
*/
|
|
360
|
+
basis: z.ZodEffects<z.ZodString, string, string>;
|
|
361
|
+
judgedBy: z.ZodEffects<z.ZodString, string, string>;
|
|
362
|
+
}, "strip", z.ZodTypeAny, {
|
|
363
|
+
decidable: boolean;
|
|
364
|
+
basis: string;
|
|
365
|
+
judgedBy: string;
|
|
366
|
+
}, {
|
|
367
|
+
decidable: boolean;
|
|
368
|
+
basis: string;
|
|
369
|
+
judgedBy: string;
|
|
370
|
+
}>;
|
|
371
|
+
origin: z.ZodUnion<[z.ZodObject<{
|
|
372
|
+
kind: z.ZodLiteral<"from-scratch">;
|
|
373
|
+
}, "strip", z.ZodTypeAny, {
|
|
374
|
+
kind: "from-scratch";
|
|
375
|
+
}, {
|
|
376
|
+
kind: "from-scratch";
|
|
377
|
+
}>, z.ZodObject<{
|
|
378
|
+
kind: z.ZodLiteral<"mined-accelerant">;
|
|
379
|
+
sourceRunId: z.ZodEffects<z.ZodString, string, string>;
|
|
380
|
+
suggestionHash: z.ZodEffects<z.ZodString, string, string>;
|
|
381
|
+
}, "strip", z.ZodTypeAny, {
|
|
382
|
+
kind: "mined-accelerant";
|
|
383
|
+
sourceRunId: string;
|
|
384
|
+
suggestionHash: string;
|
|
385
|
+
}, {
|
|
386
|
+
kind: "mined-accelerant";
|
|
387
|
+
sourceRunId: string;
|
|
388
|
+
suggestionHash: string;
|
|
389
|
+
}>]>;
|
|
390
|
+
declaredEngine: z.ZodEnum<["regex", "ast", "ast-grep"]>;
|
|
391
|
+
/** Reference to the §8 authoring-ledger entry (author/date/engine/splitRef/attestations). */
|
|
392
|
+
authoringLedgerRef: z.ZodEffects<z.ZodString, string, string>;
|
|
393
|
+
/** The human-written matcher (same DSL the compiler accepts from the miner). */
|
|
394
|
+
dslSource: z.ZodEffects<z.ZodString, string, string>;
|
|
395
|
+
/** Zero-trust mint (ADR-089 / ADR-112 §1) — always literally `true`. */
|
|
396
|
+
unverified: z.ZodLiteral<true>;
|
|
397
|
+
}, "strip", z.ZodTypeAny, {
|
|
398
|
+
provenance: {
|
|
399
|
+
kind: "authored";
|
|
400
|
+
author: string;
|
|
401
|
+
authoredAt: string;
|
|
402
|
+
targetDefect: string;
|
|
403
|
+
positiveFixtures: {
|
|
404
|
+
pr: number;
|
|
405
|
+
preimageSource: {
|
|
406
|
+
kind: "lesson";
|
|
407
|
+
lessonRef: string;
|
|
408
|
+
badExample: string;
|
|
409
|
+
goodExample: string;
|
|
410
|
+
} | {
|
|
411
|
+
kind: "commit";
|
|
412
|
+
preimageCommitSha: string;
|
|
413
|
+
mergeCommitSha: string;
|
|
414
|
+
};
|
|
415
|
+
filePath: string;
|
|
416
|
+
matchedSpan: string;
|
|
417
|
+
contentHash: string;
|
|
418
|
+
}[];
|
|
419
|
+
negativeFixtures?: {
|
|
420
|
+
pr: number;
|
|
421
|
+
preimageSource: {
|
|
422
|
+
kind: "lesson";
|
|
423
|
+
lessonRef: string;
|
|
424
|
+
badExample: string;
|
|
425
|
+
goodExample: string;
|
|
426
|
+
} | {
|
|
427
|
+
kind: "commit";
|
|
428
|
+
preimageCommitSha: string;
|
|
429
|
+
mergeCommitSha: string;
|
|
430
|
+
};
|
|
431
|
+
filePath: string;
|
|
432
|
+
matchedSpan: string;
|
|
433
|
+
contentHash: string;
|
|
434
|
+
}[] | undefined;
|
|
435
|
+
};
|
|
436
|
+
unverified: true;
|
|
437
|
+
ruleId: string;
|
|
438
|
+
origin: {
|
|
439
|
+
kind: "from-scratch";
|
|
440
|
+
} | {
|
|
441
|
+
kind: "mined-accelerant";
|
|
442
|
+
sourceRunId: string;
|
|
443
|
+
suggestionHash: string;
|
|
444
|
+
};
|
|
445
|
+
dslSource: string;
|
|
446
|
+
structuralEligibility: {
|
|
447
|
+
decidable: boolean;
|
|
448
|
+
basis: string;
|
|
449
|
+
judgedBy: string;
|
|
450
|
+
};
|
|
451
|
+
declaredEngine: "regex" | "ast" | "ast-grep";
|
|
452
|
+
authoringLedgerRef: string;
|
|
453
|
+
}, {
|
|
454
|
+
provenance: {
|
|
455
|
+
kind: "authored";
|
|
456
|
+
author: string;
|
|
457
|
+
authoredAt: string;
|
|
458
|
+
targetDefect: string;
|
|
459
|
+
positiveFixtures: {
|
|
460
|
+
pr: number;
|
|
461
|
+
preimageSource: {
|
|
462
|
+
kind: "lesson";
|
|
463
|
+
lessonRef: string;
|
|
464
|
+
badExample: string;
|
|
465
|
+
goodExample: string;
|
|
466
|
+
} | {
|
|
467
|
+
kind: "commit";
|
|
468
|
+
preimageCommitSha: string;
|
|
469
|
+
mergeCommitSha: string;
|
|
470
|
+
};
|
|
471
|
+
filePath: string;
|
|
472
|
+
matchedSpan: string;
|
|
473
|
+
contentHash: string;
|
|
474
|
+
}[];
|
|
475
|
+
negativeFixtures?: {
|
|
476
|
+
pr: number;
|
|
477
|
+
preimageSource: {
|
|
478
|
+
kind: "lesson";
|
|
479
|
+
lessonRef: string;
|
|
480
|
+
badExample: string;
|
|
481
|
+
goodExample: string;
|
|
482
|
+
} | {
|
|
483
|
+
kind: "commit";
|
|
484
|
+
preimageCommitSha: string;
|
|
485
|
+
mergeCommitSha: string;
|
|
486
|
+
};
|
|
487
|
+
filePath: string;
|
|
488
|
+
matchedSpan: string;
|
|
489
|
+
contentHash: string;
|
|
490
|
+
}[] | undefined;
|
|
491
|
+
};
|
|
492
|
+
unverified: true;
|
|
493
|
+
ruleId: string;
|
|
494
|
+
origin: {
|
|
495
|
+
kind: "from-scratch";
|
|
496
|
+
} | {
|
|
497
|
+
kind: "mined-accelerant";
|
|
498
|
+
sourceRunId: string;
|
|
499
|
+
suggestionHash: string;
|
|
500
|
+
};
|
|
501
|
+
dslSource: string;
|
|
502
|
+
structuralEligibility: {
|
|
503
|
+
decidable: boolean;
|
|
504
|
+
basis: string;
|
|
505
|
+
judgedBy: string;
|
|
506
|
+
};
|
|
507
|
+
declaredEngine: "regex" | "ast" | "ast-grep";
|
|
508
|
+
authoringLedgerRef: string;
|
|
509
|
+
}>;
|
|
510
|
+
export type AuthoredRuleRecord = z.infer<typeof AuthoredRuleRecordSchema>;
|
|
511
|
+
export declare const AuthoredRuleInputSchema: z.ZodObject<{
|
|
512
|
+
/** Agent-id or operator handle — attributable (mirrors the provenance field). Trimmed. */
|
|
513
|
+
author: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
514
|
+
/**
|
|
515
|
+
* ISO-8601 authoring date — trimmed + calendar-validated at the INTAKE boundary
|
|
516
|
+
* (CR diff-review): the same `isIso8601CalendarDate` the record provenance uses,
|
|
517
|
+
* so a malformed `not-a-date` fails here with a clean `CONFIG_INVALID` instead of
|
|
518
|
+
* escaping to a raw ZodError at record construction (pass 1).
|
|
519
|
+
*/
|
|
520
|
+
authoredAt: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
521
|
+
/** The declared DEFECT the rule targets — the pre-image, not its fix (ADR-110 §4 TP-def). Trimmed. */
|
|
522
|
+
targetDefect: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
523
|
+
/** The matcher engine the author declares; the eligibility check confirms it can represent the class. */
|
|
524
|
+
declaredEngine: z.ZodEnum<["regex", "ast", "ast-grep"]>;
|
|
525
|
+
/**
|
|
526
|
+
* The structural rule-CLASS the author CLAIMS. Fed to the INDEPENDENT
|
|
527
|
+
* `evaluateStructuralEligibility` against the DI whitelist; it is NOT stored
|
|
528
|
+
* verbatim on the record — the *verdict* (`structuralEligibility`, basis
|
|
529
|
+
* `whitelist:<class>`) is. Naming a class is a claim the check adjudicates,
|
|
530
|
+
* never a self-certification of `decidable`. Trimmed so a stray space can't
|
|
531
|
+
* cause an exact-match miss against the registry.
|
|
532
|
+
*/
|
|
533
|
+
structuralClass: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
534
|
+
/** The human-written matcher (same DSL the compiler accepts from the miner). */
|
|
535
|
+
dslSource: z.ZodEffects<z.ZodString, string, string>;
|
|
536
|
+
/** ≥1 real lc instance the rule claims to catch — ALL train-side (§5). */
|
|
537
|
+
positiveFixtures: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
538
|
+
pr: z.ZodNumber;
|
|
539
|
+
preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
540
|
+
kind: z.ZodLiteral<"lesson">;
|
|
541
|
+
lessonRef: z.ZodString;
|
|
542
|
+
badExample: z.ZodEffects<z.ZodString, string, string>;
|
|
543
|
+
goodExample: z.ZodEffects<z.ZodString, string, string>;
|
|
544
|
+
}, "strict", z.ZodTypeAny, {
|
|
545
|
+
kind: "lesson";
|
|
546
|
+
lessonRef: string;
|
|
547
|
+
badExample: string;
|
|
548
|
+
goodExample: string;
|
|
549
|
+
}, {
|
|
550
|
+
kind: "lesson";
|
|
551
|
+
lessonRef: string;
|
|
552
|
+
badExample: string;
|
|
553
|
+
goodExample: string;
|
|
554
|
+
}>, z.ZodObject<{
|
|
555
|
+
kind: z.ZodLiteral<"commit">;
|
|
556
|
+
preimageCommitSha: z.ZodString;
|
|
557
|
+
mergeCommitSha: z.ZodString;
|
|
558
|
+
}, "strict", z.ZodTypeAny, {
|
|
559
|
+
kind: "commit";
|
|
560
|
+
preimageCommitSha: string;
|
|
561
|
+
mergeCommitSha: string;
|
|
562
|
+
}, {
|
|
563
|
+
kind: "commit";
|
|
564
|
+
preimageCommitSha: string;
|
|
565
|
+
mergeCommitSha: string;
|
|
566
|
+
}>]>;
|
|
567
|
+
filePath: z.ZodEffects<z.ZodString, string, string>;
|
|
568
|
+
matchedSpan: z.ZodEffects<z.ZodString, string, string>;
|
|
569
|
+
contentHash: z.ZodEffects<z.ZodString, string, string>;
|
|
570
|
+
}, "strict", z.ZodTypeAny, {
|
|
571
|
+
pr: number;
|
|
572
|
+
preimageSource: {
|
|
573
|
+
kind: "lesson";
|
|
574
|
+
lessonRef: string;
|
|
575
|
+
badExample: string;
|
|
576
|
+
goodExample: string;
|
|
577
|
+
} | {
|
|
578
|
+
kind: "commit";
|
|
579
|
+
preimageCommitSha: string;
|
|
580
|
+
mergeCommitSha: string;
|
|
581
|
+
};
|
|
582
|
+
filePath: string;
|
|
583
|
+
matchedSpan: string;
|
|
584
|
+
contentHash: string;
|
|
585
|
+
}, {
|
|
586
|
+
pr: number;
|
|
587
|
+
preimageSource: {
|
|
588
|
+
kind: "lesson";
|
|
589
|
+
lessonRef: string;
|
|
590
|
+
badExample: string;
|
|
591
|
+
goodExample: string;
|
|
592
|
+
} | {
|
|
593
|
+
kind: "commit";
|
|
594
|
+
preimageCommitSha: string;
|
|
595
|
+
mergeCommitSha: string;
|
|
596
|
+
};
|
|
597
|
+
filePath: string;
|
|
598
|
+
matchedSpan: string;
|
|
599
|
+
contentHash: string;
|
|
600
|
+
}>, {
|
|
601
|
+
pr: number;
|
|
602
|
+
preimageSource: {
|
|
603
|
+
kind: "lesson";
|
|
604
|
+
lessonRef: string;
|
|
605
|
+
badExample: string;
|
|
606
|
+
goodExample: string;
|
|
607
|
+
} | {
|
|
608
|
+
kind: "commit";
|
|
609
|
+
preimageCommitSha: string;
|
|
610
|
+
mergeCommitSha: string;
|
|
611
|
+
};
|
|
612
|
+
filePath: string;
|
|
613
|
+
matchedSpan: string;
|
|
614
|
+
contentHash: string;
|
|
615
|
+
}, {
|
|
616
|
+
pr: number;
|
|
617
|
+
preimageSource: {
|
|
618
|
+
kind: "lesson";
|
|
619
|
+
lessonRef: string;
|
|
620
|
+
badExample: string;
|
|
621
|
+
goodExample: string;
|
|
622
|
+
} | {
|
|
623
|
+
kind: "commit";
|
|
624
|
+
preimageCommitSha: string;
|
|
625
|
+
mergeCommitSha: string;
|
|
626
|
+
};
|
|
627
|
+
filePath: string;
|
|
628
|
+
matchedSpan: string;
|
|
629
|
+
contentHash: string;
|
|
630
|
+
}>, "many">;
|
|
631
|
+
/** Declared near-misses the rule must stay silent on (feeds §6 negative controls). */
|
|
632
|
+
negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
633
|
+
pr: z.ZodNumber;
|
|
634
|
+
preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
635
|
+
kind: z.ZodLiteral<"lesson">;
|
|
636
|
+
lessonRef: z.ZodString;
|
|
637
|
+
badExample: z.ZodEffects<z.ZodString, string, string>;
|
|
638
|
+
goodExample: z.ZodEffects<z.ZodString, string, string>;
|
|
639
|
+
}, "strict", z.ZodTypeAny, {
|
|
640
|
+
kind: "lesson";
|
|
641
|
+
lessonRef: string;
|
|
642
|
+
badExample: string;
|
|
643
|
+
goodExample: string;
|
|
644
|
+
}, {
|
|
645
|
+
kind: "lesson";
|
|
646
|
+
lessonRef: string;
|
|
647
|
+
badExample: string;
|
|
648
|
+
goodExample: string;
|
|
649
|
+
}>, z.ZodObject<{
|
|
650
|
+
kind: z.ZodLiteral<"commit">;
|
|
651
|
+
preimageCommitSha: z.ZodString;
|
|
652
|
+
mergeCommitSha: z.ZodString;
|
|
653
|
+
}, "strict", z.ZodTypeAny, {
|
|
654
|
+
kind: "commit";
|
|
655
|
+
preimageCommitSha: string;
|
|
656
|
+
mergeCommitSha: string;
|
|
657
|
+
}, {
|
|
658
|
+
kind: "commit";
|
|
659
|
+
preimageCommitSha: string;
|
|
660
|
+
mergeCommitSha: string;
|
|
661
|
+
}>]>;
|
|
662
|
+
filePath: z.ZodEffects<z.ZodString, string, string>;
|
|
663
|
+
matchedSpan: z.ZodEffects<z.ZodString, string, string>;
|
|
664
|
+
contentHash: z.ZodEffects<z.ZodString, string, string>;
|
|
665
|
+
}, "strict", z.ZodTypeAny, {
|
|
666
|
+
pr: number;
|
|
667
|
+
preimageSource: {
|
|
668
|
+
kind: "lesson";
|
|
669
|
+
lessonRef: string;
|
|
670
|
+
badExample: string;
|
|
671
|
+
goodExample: string;
|
|
672
|
+
} | {
|
|
673
|
+
kind: "commit";
|
|
674
|
+
preimageCommitSha: string;
|
|
675
|
+
mergeCommitSha: string;
|
|
676
|
+
};
|
|
677
|
+
filePath: string;
|
|
678
|
+
matchedSpan: string;
|
|
679
|
+
contentHash: string;
|
|
680
|
+
}, {
|
|
681
|
+
pr: number;
|
|
682
|
+
preimageSource: {
|
|
683
|
+
kind: "lesson";
|
|
684
|
+
lessonRef: string;
|
|
685
|
+
badExample: string;
|
|
686
|
+
goodExample: string;
|
|
687
|
+
} | {
|
|
688
|
+
kind: "commit";
|
|
689
|
+
preimageCommitSha: string;
|
|
690
|
+
mergeCommitSha: string;
|
|
691
|
+
};
|
|
692
|
+
filePath: string;
|
|
693
|
+
matchedSpan: string;
|
|
694
|
+
contentHash: string;
|
|
695
|
+
}>, {
|
|
696
|
+
pr: number;
|
|
697
|
+
preimageSource: {
|
|
698
|
+
kind: "lesson";
|
|
699
|
+
lessonRef: string;
|
|
700
|
+
badExample: string;
|
|
701
|
+
goodExample: string;
|
|
702
|
+
} | {
|
|
703
|
+
kind: "commit";
|
|
704
|
+
preimageCommitSha: string;
|
|
705
|
+
mergeCommitSha: string;
|
|
706
|
+
};
|
|
707
|
+
filePath: string;
|
|
708
|
+
matchedSpan: string;
|
|
709
|
+
contentHash: string;
|
|
710
|
+
}, {
|
|
711
|
+
pr: number;
|
|
712
|
+
preimageSource: {
|
|
713
|
+
kind: "lesson";
|
|
714
|
+
lessonRef: string;
|
|
715
|
+
badExample: string;
|
|
716
|
+
goodExample: string;
|
|
717
|
+
} | {
|
|
718
|
+
kind: "commit";
|
|
719
|
+
preimageCommitSha: string;
|
|
720
|
+
mergeCommitSha: string;
|
|
721
|
+
};
|
|
722
|
+
filePath: string;
|
|
723
|
+
matchedSpan: string;
|
|
724
|
+
contentHash: string;
|
|
725
|
+
}>, "many">>;
|
|
726
|
+
/**
|
|
727
|
+
* Accelerant lineage (§7). Optional in the YAML; the reader defaults an
|
|
728
|
+
* absent value to `{ kind: 'from-scratch' }` when constructing the record, so
|
|
729
|
+
* the persisted `origin` is always explicit (§7 lineage is never erased).
|
|
730
|
+
*/
|
|
731
|
+
origin: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
732
|
+
kind: z.ZodLiteral<"from-scratch">;
|
|
733
|
+
}, "strip", z.ZodTypeAny, {
|
|
734
|
+
kind: "from-scratch";
|
|
735
|
+
}, {
|
|
736
|
+
kind: "from-scratch";
|
|
737
|
+
}>, z.ZodObject<{
|
|
738
|
+
kind: z.ZodLiteral<"mined-accelerant">;
|
|
739
|
+
sourceRunId: z.ZodEffects<z.ZodString, string, string>;
|
|
740
|
+
suggestionHash: z.ZodEffects<z.ZodString, string, string>;
|
|
741
|
+
}, "strip", z.ZodTypeAny, {
|
|
742
|
+
kind: "mined-accelerant";
|
|
743
|
+
sourceRunId: string;
|
|
744
|
+
suggestionHash: string;
|
|
745
|
+
}, {
|
|
746
|
+
kind: "mined-accelerant";
|
|
747
|
+
sourceRunId: string;
|
|
748
|
+
suggestionHash: string;
|
|
749
|
+
}>]>>;
|
|
750
|
+
}, "strict", z.ZodTypeAny, {
|
|
751
|
+
author: string;
|
|
752
|
+
authoredAt: string;
|
|
753
|
+
targetDefect: string;
|
|
754
|
+
positiveFixtures: {
|
|
755
|
+
pr: number;
|
|
756
|
+
preimageSource: {
|
|
757
|
+
kind: "lesson";
|
|
758
|
+
lessonRef: string;
|
|
759
|
+
badExample: string;
|
|
760
|
+
goodExample: string;
|
|
761
|
+
} | {
|
|
762
|
+
kind: "commit";
|
|
763
|
+
preimageCommitSha: string;
|
|
764
|
+
mergeCommitSha: string;
|
|
765
|
+
};
|
|
766
|
+
filePath: string;
|
|
767
|
+
matchedSpan: string;
|
|
768
|
+
contentHash: string;
|
|
769
|
+
}[];
|
|
770
|
+
dslSource: string;
|
|
771
|
+
declaredEngine: "regex" | "ast" | "ast-grep";
|
|
772
|
+
structuralClass: string;
|
|
773
|
+
negativeFixtures?: {
|
|
774
|
+
pr: number;
|
|
775
|
+
preimageSource: {
|
|
776
|
+
kind: "lesson";
|
|
777
|
+
lessonRef: string;
|
|
778
|
+
badExample: string;
|
|
779
|
+
goodExample: string;
|
|
780
|
+
} | {
|
|
781
|
+
kind: "commit";
|
|
782
|
+
preimageCommitSha: string;
|
|
783
|
+
mergeCommitSha: string;
|
|
784
|
+
};
|
|
785
|
+
filePath: string;
|
|
786
|
+
matchedSpan: string;
|
|
787
|
+
contentHash: string;
|
|
788
|
+
}[] | undefined;
|
|
789
|
+
origin?: {
|
|
790
|
+
kind: "from-scratch";
|
|
791
|
+
} | {
|
|
792
|
+
kind: "mined-accelerant";
|
|
793
|
+
sourceRunId: string;
|
|
794
|
+
suggestionHash: string;
|
|
795
|
+
} | undefined;
|
|
796
|
+
}, {
|
|
797
|
+
author: string;
|
|
798
|
+
authoredAt: string;
|
|
799
|
+
targetDefect: string;
|
|
800
|
+
positiveFixtures: {
|
|
801
|
+
pr: number;
|
|
802
|
+
preimageSource: {
|
|
803
|
+
kind: "lesson";
|
|
804
|
+
lessonRef: string;
|
|
805
|
+
badExample: string;
|
|
806
|
+
goodExample: string;
|
|
807
|
+
} | {
|
|
808
|
+
kind: "commit";
|
|
809
|
+
preimageCommitSha: string;
|
|
810
|
+
mergeCommitSha: string;
|
|
811
|
+
};
|
|
812
|
+
filePath: string;
|
|
813
|
+
matchedSpan: string;
|
|
814
|
+
contentHash: string;
|
|
815
|
+
}[];
|
|
816
|
+
dslSource: string;
|
|
817
|
+
declaredEngine: "regex" | "ast" | "ast-grep";
|
|
818
|
+
structuralClass: string;
|
|
819
|
+
negativeFixtures?: {
|
|
820
|
+
pr: number;
|
|
821
|
+
preimageSource: {
|
|
822
|
+
kind: "lesson";
|
|
823
|
+
lessonRef: string;
|
|
824
|
+
badExample: string;
|
|
825
|
+
goodExample: string;
|
|
826
|
+
} | {
|
|
827
|
+
kind: "commit";
|
|
828
|
+
preimageCommitSha: string;
|
|
829
|
+
mergeCommitSha: string;
|
|
830
|
+
};
|
|
831
|
+
filePath: string;
|
|
832
|
+
matchedSpan: string;
|
|
833
|
+
contentHash: string;
|
|
834
|
+
}[] | undefined;
|
|
835
|
+
origin?: {
|
|
836
|
+
kind: "from-scratch";
|
|
837
|
+
} | {
|
|
838
|
+
kind: "mined-accelerant";
|
|
839
|
+
sourceRunId: string;
|
|
840
|
+
suggestionHash: string;
|
|
841
|
+
} | undefined;
|
|
842
|
+
}>;
|
|
843
|
+
export type AuthoredRuleInput = z.infer<typeof AuthoredRuleInputSchema>;
|
|
844
|
+
/**
|
|
845
|
+
* SLICE B — the on-disk shape of `.totem/spine/authored-rules.yaml`. A file-level
|
|
846
|
+
* authoring header carries the §5/§8 leakage-guard ATTESTATIONS once for the
|
|
847
|
+
* session (not per-rule, since all rules in one file are authored under one
|
|
848
|
+
* frozen split), followed by the rules. Slice B RECORDS these faithfully into the
|
|
849
|
+
* authoring-ledger (strategy's boundary confirm: B records `splitRef` /
|
|
850
|
+
* `authoredAfterSplit` / `fixturePrs`); the MECHANICAL verification — the split
|
|
851
|
+
* was frozen BEFORE authoring (§5.1/FM(g)), fixtures resolve train-side (§5.2),
|
|
852
|
+
* the harness is sandboxed (§5.4) — is the cert-run harness in SLICE C. The
|
|
853
|
+
* attestations are `literal(true)`: an author who cannot attest them is not
|
|
854
|
+
* authoring legitimately, so a `false` fails the read rather than recording a
|
|
855
|
+
* self-defeating attestation. `.strict()` rejects unknown header keys.
|
|
856
|
+
*/
|
|
857
|
+
export declare const AuthoredRulesFileSchema: z.ZodObject<{
|
|
858
|
+
/** The frozen split (ADR-110 §6) the rules were authored under (recorded; verified in C). Trimmed (GCA) so stray whitespace can't bypass the non-empty check or perturb the revision fingerprint. */
|
|
859
|
+
splitRef: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
860
|
+
/** §1(g) embargo attestation — authored AFTER the split was frozen. Always `true`; verified in C. */
|
|
861
|
+
authoredAfterSplit: z.ZodLiteral<true>;
|
|
862
|
+
/** §5 attestation — the author did not inspect the held-out slice. Always `true`; sandboxed in C. */
|
|
863
|
+
heldOutNonInspectionAttestation: z.ZodLiteral<true>;
|
|
864
|
+
/** The authored rules (≥1). */
|
|
865
|
+
rules: z.ZodArray<z.ZodObject<{
|
|
866
|
+
/** Agent-id or operator handle — attributable (mirrors the provenance field). Trimmed. */
|
|
867
|
+
author: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
868
|
+
/**
|
|
869
|
+
* ISO-8601 authoring date — trimmed + calendar-validated at the INTAKE boundary
|
|
870
|
+
* (CR diff-review): the same `isIso8601CalendarDate` the record provenance uses,
|
|
871
|
+
* so a malformed `not-a-date` fails here with a clean `CONFIG_INVALID` instead of
|
|
872
|
+
* escaping to a raw ZodError at record construction (pass 1).
|
|
873
|
+
*/
|
|
874
|
+
authoredAt: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
875
|
+
/** The declared DEFECT the rule targets — the pre-image, not its fix (ADR-110 §4 TP-def). Trimmed. */
|
|
876
|
+
targetDefect: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
877
|
+
/** The matcher engine the author declares; the eligibility check confirms it can represent the class. */
|
|
878
|
+
declaredEngine: z.ZodEnum<["regex", "ast", "ast-grep"]>;
|
|
879
|
+
/**
|
|
880
|
+
* The structural rule-CLASS the author CLAIMS. Fed to the INDEPENDENT
|
|
881
|
+
* `evaluateStructuralEligibility` against the DI whitelist; it is NOT stored
|
|
882
|
+
* verbatim on the record — the *verdict* (`structuralEligibility`, basis
|
|
883
|
+
* `whitelist:<class>`) is. Naming a class is a claim the check adjudicates,
|
|
884
|
+
* never a self-certification of `decidable`. Trimmed so a stray space can't
|
|
885
|
+
* cause an exact-match miss against the registry.
|
|
886
|
+
*/
|
|
887
|
+
structuralClass: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
888
|
+
/** The human-written matcher (same DSL the compiler accepts from the miner). */
|
|
889
|
+
dslSource: z.ZodEffects<z.ZodString, string, string>;
|
|
890
|
+
/** ≥1 real lc instance the rule claims to catch — ALL train-side (§5). */
|
|
891
|
+
positiveFixtures: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
892
|
+
pr: z.ZodNumber;
|
|
893
|
+
preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
894
|
+
kind: z.ZodLiteral<"lesson">;
|
|
895
|
+
lessonRef: z.ZodString;
|
|
896
|
+
badExample: z.ZodEffects<z.ZodString, string, string>;
|
|
897
|
+
goodExample: z.ZodEffects<z.ZodString, string, string>;
|
|
898
|
+
}, "strict", z.ZodTypeAny, {
|
|
899
|
+
kind: "lesson";
|
|
900
|
+
lessonRef: string;
|
|
901
|
+
badExample: string;
|
|
902
|
+
goodExample: string;
|
|
903
|
+
}, {
|
|
904
|
+
kind: "lesson";
|
|
905
|
+
lessonRef: string;
|
|
906
|
+
badExample: string;
|
|
907
|
+
goodExample: string;
|
|
908
|
+
}>, z.ZodObject<{
|
|
909
|
+
kind: z.ZodLiteral<"commit">;
|
|
910
|
+
preimageCommitSha: z.ZodString;
|
|
911
|
+
mergeCommitSha: z.ZodString;
|
|
912
|
+
}, "strict", z.ZodTypeAny, {
|
|
913
|
+
kind: "commit";
|
|
914
|
+
preimageCommitSha: string;
|
|
915
|
+
mergeCommitSha: string;
|
|
916
|
+
}, {
|
|
917
|
+
kind: "commit";
|
|
918
|
+
preimageCommitSha: string;
|
|
919
|
+
mergeCommitSha: string;
|
|
920
|
+
}>]>;
|
|
921
|
+
filePath: z.ZodEffects<z.ZodString, string, string>;
|
|
922
|
+
matchedSpan: z.ZodEffects<z.ZodString, string, string>;
|
|
923
|
+
contentHash: z.ZodEffects<z.ZodString, string, string>;
|
|
924
|
+
}, "strict", z.ZodTypeAny, {
|
|
925
|
+
pr: number;
|
|
926
|
+
preimageSource: {
|
|
927
|
+
kind: "lesson";
|
|
928
|
+
lessonRef: string;
|
|
929
|
+
badExample: string;
|
|
930
|
+
goodExample: string;
|
|
931
|
+
} | {
|
|
932
|
+
kind: "commit";
|
|
933
|
+
preimageCommitSha: string;
|
|
934
|
+
mergeCommitSha: string;
|
|
935
|
+
};
|
|
936
|
+
filePath: string;
|
|
937
|
+
matchedSpan: string;
|
|
938
|
+
contentHash: string;
|
|
939
|
+
}, {
|
|
940
|
+
pr: number;
|
|
941
|
+
preimageSource: {
|
|
942
|
+
kind: "lesson";
|
|
943
|
+
lessonRef: string;
|
|
944
|
+
badExample: string;
|
|
945
|
+
goodExample: string;
|
|
946
|
+
} | {
|
|
947
|
+
kind: "commit";
|
|
948
|
+
preimageCommitSha: string;
|
|
949
|
+
mergeCommitSha: string;
|
|
950
|
+
};
|
|
951
|
+
filePath: string;
|
|
952
|
+
matchedSpan: string;
|
|
953
|
+
contentHash: string;
|
|
954
|
+
}>, {
|
|
955
|
+
pr: number;
|
|
956
|
+
preimageSource: {
|
|
957
|
+
kind: "lesson";
|
|
958
|
+
lessonRef: string;
|
|
959
|
+
badExample: string;
|
|
960
|
+
goodExample: string;
|
|
961
|
+
} | {
|
|
962
|
+
kind: "commit";
|
|
963
|
+
preimageCommitSha: string;
|
|
964
|
+
mergeCommitSha: string;
|
|
965
|
+
};
|
|
966
|
+
filePath: string;
|
|
967
|
+
matchedSpan: string;
|
|
968
|
+
contentHash: string;
|
|
969
|
+
}, {
|
|
970
|
+
pr: number;
|
|
971
|
+
preimageSource: {
|
|
972
|
+
kind: "lesson";
|
|
973
|
+
lessonRef: string;
|
|
974
|
+
badExample: string;
|
|
975
|
+
goodExample: string;
|
|
976
|
+
} | {
|
|
977
|
+
kind: "commit";
|
|
978
|
+
preimageCommitSha: string;
|
|
979
|
+
mergeCommitSha: string;
|
|
980
|
+
};
|
|
981
|
+
filePath: string;
|
|
982
|
+
matchedSpan: string;
|
|
983
|
+
contentHash: string;
|
|
984
|
+
}>, "many">;
|
|
985
|
+
/** Declared near-misses the rule must stay silent on (feeds §6 negative controls). */
|
|
986
|
+
negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
987
|
+
pr: z.ZodNumber;
|
|
988
|
+
preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
989
|
+
kind: z.ZodLiteral<"lesson">;
|
|
990
|
+
lessonRef: z.ZodString;
|
|
991
|
+
badExample: z.ZodEffects<z.ZodString, string, string>;
|
|
992
|
+
goodExample: z.ZodEffects<z.ZodString, string, string>;
|
|
993
|
+
}, "strict", z.ZodTypeAny, {
|
|
994
|
+
kind: "lesson";
|
|
995
|
+
lessonRef: string;
|
|
996
|
+
badExample: string;
|
|
997
|
+
goodExample: string;
|
|
998
|
+
}, {
|
|
999
|
+
kind: "lesson";
|
|
1000
|
+
lessonRef: string;
|
|
1001
|
+
badExample: string;
|
|
1002
|
+
goodExample: string;
|
|
1003
|
+
}>, z.ZodObject<{
|
|
1004
|
+
kind: z.ZodLiteral<"commit">;
|
|
1005
|
+
preimageCommitSha: z.ZodString;
|
|
1006
|
+
mergeCommitSha: z.ZodString;
|
|
1007
|
+
}, "strict", z.ZodTypeAny, {
|
|
1008
|
+
kind: "commit";
|
|
1009
|
+
preimageCommitSha: string;
|
|
1010
|
+
mergeCommitSha: string;
|
|
1011
|
+
}, {
|
|
1012
|
+
kind: "commit";
|
|
1013
|
+
preimageCommitSha: string;
|
|
1014
|
+
mergeCommitSha: string;
|
|
1015
|
+
}>]>;
|
|
1016
|
+
filePath: z.ZodEffects<z.ZodString, string, string>;
|
|
1017
|
+
matchedSpan: z.ZodEffects<z.ZodString, string, string>;
|
|
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
|
+
/**
|
|
1081
|
+
* Accelerant lineage (§7). Optional in the YAML; the reader defaults an
|
|
1082
|
+
* absent value to `{ kind: 'from-scratch' }` when constructing the record, so
|
|
1083
|
+
* the persisted `origin` is always explicit (§7 lineage is never erased).
|
|
1084
|
+
*/
|
|
1085
|
+
origin: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
1086
|
+
kind: z.ZodLiteral<"from-scratch">;
|
|
1087
|
+
}, "strip", z.ZodTypeAny, {
|
|
1088
|
+
kind: "from-scratch";
|
|
1089
|
+
}, {
|
|
1090
|
+
kind: "from-scratch";
|
|
1091
|
+
}>, z.ZodObject<{
|
|
1092
|
+
kind: z.ZodLiteral<"mined-accelerant">;
|
|
1093
|
+
sourceRunId: z.ZodEffects<z.ZodString, string, string>;
|
|
1094
|
+
suggestionHash: z.ZodEffects<z.ZodString, string, string>;
|
|
1095
|
+
}, "strip", z.ZodTypeAny, {
|
|
1096
|
+
kind: "mined-accelerant";
|
|
1097
|
+
sourceRunId: string;
|
|
1098
|
+
suggestionHash: string;
|
|
1099
|
+
}, {
|
|
1100
|
+
kind: "mined-accelerant";
|
|
1101
|
+
sourceRunId: string;
|
|
1102
|
+
suggestionHash: string;
|
|
1103
|
+
}>]>>;
|
|
1104
|
+
}, "strict", z.ZodTypeAny, {
|
|
1105
|
+
author: string;
|
|
1106
|
+
authoredAt: string;
|
|
1107
|
+
targetDefect: string;
|
|
1108
|
+
positiveFixtures: {
|
|
1109
|
+
pr: number;
|
|
1110
|
+
preimageSource: {
|
|
1111
|
+
kind: "lesson";
|
|
1112
|
+
lessonRef: string;
|
|
1113
|
+
badExample: string;
|
|
1114
|
+
goodExample: string;
|
|
1115
|
+
} | {
|
|
1116
|
+
kind: "commit";
|
|
1117
|
+
preimageCommitSha: string;
|
|
1118
|
+
mergeCommitSha: string;
|
|
1119
|
+
};
|
|
1120
|
+
filePath: string;
|
|
1121
|
+
matchedSpan: string;
|
|
1122
|
+
contentHash: string;
|
|
1123
|
+
}[];
|
|
1124
|
+
dslSource: string;
|
|
1125
|
+
declaredEngine: "regex" | "ast" | "ast-grep";
|
|
1126
|
+
structuralClass: string;
|
|
1127
|
+
negativeFixtures?: {
|
|
1128
|
+
pr: number;
|
|
1129
|
+
preimageSource: {
|
|
1130
|
+
kind: "lesson";
|
|
1131
|
+
lessonRef: string;
|
|
1132
|
+
badExample: string;
|
|
1133
|
+
goodExample: string;
|
|
1134
|
+
} | {
|
|
1135
|
+
kind: "commit";
|
|
1136
|
+
preimageCommitSha: string;
|
|
1137
|
+
mergeCommitSha: string;
|
|
1138
|
+
};
|
|
1139
|
+
filePath: string;
|
|
1140
|
+
matchedSpan: string;
|
|
1141
|
+
contentHash: string;
|
|
1142
|
+
}[] | undefined;
|
|
1143
|
+
origin?: {
|
|
1144
|
+
kind: "from-scratch";
|
|
1145
|
+
} | {
|
|
1146
|
+
kind: "mined-accelerant";
|
|
1147
|
+
sourceRunId: string;
|
|
1148
|
+
suggestionHash: string;
|
|
1149
|
+
} | undefined;
|
|
1150
|
+
}, {
|
|
1151
|
+
author: string;
|
|
1152
|
+
authoredAt: string;
|
|
1153
|
+
targetDefect: string;
|
|
1154
|
+
positiveFixtures: {
|
|
1155
|
+
pr: number;
|
|
1156
|
+
preimageSource: {
|
|
1157
|
+
kind: "lesson";
|
|
1158
|
+
lessonRef: string;
|
|
1159
|
+
badExample: string;
|
|
1160
|
+
goodExample: string;
|
|
1161
|
+
} | {
|
|
1162
|
+
kind: "commit";
|
|
1163
|
+
preimageCommitSha: string;
|
|
1164
|
+
mergeCommitSha: string;
|
|
1165
|
+
};
|
|
1166
|
+
filePath: string;
|
|
1167
|
+
matchedSpan: string;
|
|
1168
|
+
contentHash: string;
|
|
1169
|
+
}[];
|
|
1170
|
+
dslSource: string;
|
|
1171
|
+
declaredEngine: "regex" | "ast" | "ast-grep";
|
|
1172
|
+
structuralClass: string;
|
|
1173
|
+
negativeFixtures?: {
|
|
1174
|
+
pr: number;
|
|
1175
|
+
preimageSource: {
|
|
1176
|
+
kind: "lesson";
|
|
1177
|
+
lessonRef: string;
|
|
1178
|
+
badExample: string;
|
|
1179
|
+
goodExample: string;
|
|
1180
|
+
} | {
|
|
1181
|
+
kind: "commit";
|
|
1182
|
+
preimageCommitSha: string;
|
|
1183
|
+
mergeCommitSha: string;
|
|
1184
|
+
};
|
|
1185
|
+
filePath: string;
|
|
1186
|
+
matchedSpan: string;
|
|
1187
|
+
contentHash: string;
|
|
1188
|
+
}[] | undefined;
|
|
1189
|
+
origin?: {
|
|
1190
|
+
kind: "from-scratch";
|
|
1191
|
+
} | {
|
|
1192
|
+
kind: "mined-accelerant";
|
|
1193
|
+
sourceRunId: string;
|
|
1194
|
+
suggestionHash: string;
|
|
1195
|
+
} | undefined;
|
|
1196
|
+
}>, "many">;
|
|
1197
|
+
}, "strict", z.ZodTypeAny, {
|
|
1198
|
+
rules: {
|
|
1199
|
+
author: string;
|
|
1200
|
+
authoredAt: string;
|
|
1201
|
+
targetDefect: string;
|
|
1202
|
+
positiveFixtures: {
|
|
1203
|
+
pr: number;
|
|
1204
|
+
preimageSource: {
|
|
1205
|
+
kind: "lesson";
|
|
1206
|
+
lessonRef: string;
|
|
1207
|
+
badExample: string;
|
|
1208
|
+
goodExample: string;
|
|
1209
|
+
} | {
|
|
1210
|
+
kind: "commit";
|
|
1211
|
+
preimageCommitSha: string;
|
|
1212
|
+
mergeCommitSha: string;
|
|
1213
|
+
};
|
|
1214
|
+
filePath: string;
|
|
1215
|
+
matchedSpan: string;
|
|
1216
|
+
contentHash: string;
|
|
1217
|
+
}[];
|
|
1218
|
+
dslSource: string;
|
|
1219
|
+
declaredEngine: "regex" | "ast" | "ast-grep";
|
|
1220
|
+
structuralClass: string;
|
|
1221
|
+
negativeFixtures?: {
|
|
1222
|
+
pr: number;
|
|
1223
|
+
preimageSource: {
|
|
1224
|
+
kind: "lesson";
|
|
1225
|
+
lessonRef: string;
|
|
1226
|
+
badExample: string;
|
|
1227
|
+
goodExample: string;
|
|
1228
|
+
} | {
|
|
1229
|
+
kind: "commit";
|
|
1230
|
+
preimageCommitSha: string;
|
|
1231
|
+
mergeCommitSha: string;
|
|
1232
|
+
};
|
|
1233
|
+
filePath: string;
|
|
1234
|
+
matchedSpan: string;
|
|
1235
|
+
contentHash: string;
|
|
1236
|
+
}[] | undefined;
|
|
1237
|
+
origin?: {
|
|
1238
|
+
kind: "from-scratch";
|
|
1239
|
+
} | {
|
|
1240
|
+
kind: "mined-accelerant";
|
|
1241
|
+
sourceRunId: string;
|
|
1242
|
+
suggestionHash: string;
|
|
1243
|
+
} | undefined;
|
|
1244
|
+
}[];
|
|
1245
|
+
splitRef: string;
|
|
1246
|
+
authoredAfterSplit: true;
|
|
1247
|
+
heldOutNonInspectionAttestation: true;
|
|
1248
|
+
}, {
|
|
1249
|
+
rules: {
|
|
1250
|
+
author: string;
|
|
1251
|
+
authoredAt: string;
|
|
1252
|
+
targetDefect: string;
|
|
1253
|
+
positiveFixtures: {
|
|
1254
|
+
pr: number;
|
|
1255
|
+
preimageSource: {
|
|
1256
|
+
kind: "lesson";
|
|
1257
|
+
lessonRef: string;
|
|
1258
|
+
badExample: string;
|
|
1259
|
+
goodExample: string;
|
|
1260
|
+
} | {
|
|
1261
|
+
kind: "commit";
|
|
1262
|
+
preimageCommitSha: string;
|
|
1263
|
+
mergeCommitSha: string;
|
|
1264
|
+
};
|
|
1265
|
+
filePath: string;
|
|
1266
|
+
matchedSpan: string;
|
|
1267
|
+
contentHash: string;
|
|
1268
|
+
}[];
|
|
1269
|
+
dslSource: string;
|
|
1270
|
+
declaredEngine: "regex" | "ast" | "ast-grep";
|
|
1271
|
+
structuralClass: string;
|
|
1272
|
+
negativeFixtures?: {
|
|
1273
|
+
pr: number;
|
|
1274
|
+
preimageSource: {
|
|
1275
|
+
kind: "lesson";
|
|
1276
|
+
lessonRef: string;
|
|
1277
|
+
badExample: string;
|
|
1278
|
+
goodExample: string;
|
|
1279
|
+
} | {
|
|
1280
|
+
kind: "commit";
|
|
1281
|
+
preimageCommitSha: string;
|
|
1282
|
+
mergeCommitSha: string;
|
|
1283
|
+
};
|
|
1284
|
+
filePath: string;
|
|
1285
|
+
matchedSpan: string;
|
|
1286
|
+
contentHash: string;
|
|
1287
|
+
}[] | undefined;
|
|
1288
|
+
origin?: {
|
|
1289
|
+
kind: "from-scratch";
|
|
1290
|
+
} | {
|
|
1291
|
+
kind: "mined-accelerant";
|
|
1292
|
+
sourceRunId: string;
|
|
1293
|
+
suggestionHash: string;
|
|
1294
|
+
} | undefined;
|
|
1295
|
+
}[];
|
|
1296
|
+
splitRef: string;
|
|
1297
|
+
authoredAfterSplit: true;
|
|
1298
|
+
heldOutNonInspectionAttestation: true;
|
|
1299
|
+
}>;
|
|
1300
|
+
export type AuthoredRulesFile = z.infer<typeof AuthoredRulesFileSchema>;
|
|
1301
|
+
/**
|
|
1302
|
+
* One decidable `(engine, structuralClass)` pair. The whitelist of these lives
|
|
1303
|
+
* in the CLI registry (slice B); the registry lists ONLY pairs the engine can
|
|
1304
|
+
* actually represent, so "exactly one match" subsumes ADR-112 §3's "AND the
|
|
1305
|
+
* engine can represent that class" condition.
|
|
1306
|
+
*/
|
|
1307
|
+
export interface WhitelistEntry {
|
|
1308
|
+
engine: DeclaredEngine;
|
|
1309
|
+
structuralClass: string;
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* ADR-112 §3 — the INDEPENDENT structural-eligibility check. A CLOSED registry
|
|
1313
|
+
* predicate, NOT prose: `decidable` is true iff EXACTLY ONE whitelist entry
|
|
1314
|
+
* matches `(declaredEngine, structuralClass)`. Unknown class, unsupported
|
|
1315
|
+
* engine, or multiple matches → `decidable: false` (NO default-to-structural).
|
|
1316
|
+
* The author supplies `declaredEngine` + `structuralClass`; this check OWNS the
|
|
1317
|
+
* verdict — any author-supplied disposition is irrelevant here (FM(d)).
|
|
1318
|
+
* Deterministic + pure (no IO, no LLM) — the same input always yields the same
|
|
1319
|
+
* verdict (Tenet-15).
|
|
1320
|
+
*/
|
|
1321
|
+
export declare function evaluateStructuralEligibility(input: {
|
|
1322
|
+
declaredEngine: DeclaredEngine;
|
|
1323
|
+
structuralClass: string;
|
|
1324
|
+
}, whitelist: readonly WhitelistEntry[], judgedBy: string): StructEligResult;
|
|
1325
|
+
/**
|
|
1326
|
+
* ADR-112 §8 — mint a stable, deterministic authored rule-id. The seed is
|
|
1327
|
+
* `sha256(JSON.stringify([author, targetDefect]))[:16]` (an INJECTIVE encoding —
|
|
1328
|
+
* see the inline note) — `dslSource` is DELIBERATELY EXCLUDED so an author can
|
|
1329
|
+
* tighten/refactor the matcher without orphaning the rule's ledger history. On collision with an already-resolved id (two rules sharing the same
|
|
1330
|
+
* `(author, targetDefect)`), a stable `-N` counter is appended. The RESOLVED id
|
|
1331
|
+
* is what callers persist — never recompute the raw seed at read time, or a
|
|
1332
|
+
* later sibling could shift the suffix (the gemini/agy break). The
|
|
1333
|
+
* `never-remine` marker is keyed to `targetDefect`, handled by the accelerant
|
|
1334
|
+
* miner, not here.
|
|
1335
|
+
*/
|
|
1336
|
+
export declare function mintAuthoredRuleId(author: string, targetDefect: string, existingIds: ReadonlySet<string>): string;
|
|
1337
|
+
/**
|
|
1338
|
+
* The authored producer's compile-stage input — what `toCompileFeed` builds for
|
|
1339
|
+
* `runCompileStage`. Deliberately NOT a `ClassifyStageResult`: an authored rule
|
|
1340
|
+
* has no mining emission ledger, so faking one would be a provenance lie. The
|
|
1341
|
+
* classifier ledger it carries records `dispositionSource: 'authored-whitelist'`.
|
|
1342
|
+
*/
|
|
1343
|
+
export interface AuthoredCompileFeed {
|
|
1344
|
+
candidates: CompileInputCandidate[];
|
|
1345
|
+
classifierLedger: ClassifierLedger;
|
|
1346
|
+
}
|
|
1347
|
+
/**
|
|
1348
|
+
* ADR-112 §2/§8 — turn structurally-DECIDABLE authored rules into the input
|
|
1349
|
+
* `runCompileStage` consumes, reusing the ONE G-series compiler (never a second).
|
|
1350
|
+
* The disposition is set HERE to `'structural'` from the INDEPENDENT eligibility
|
|
1351
|
+
* verdict (§3) — the author never sets it. A NON-decidable record is a contract
|
|
1352
|
+
* violation → FAIL LOUD (the FM(d) backstop in code), never a silent skip.
|
|
1353
|
+
* `classifierLedgerRef = authored:<authoringLedgerRef>` is unique per rule (the
|
|
1354
|
+
* authoring ledger is 1:1 with the rule); a duplicate fails loud so the downstream
|
|
1355
|
+
* 1:1 classifier-ledger join can't silently collapse.
|
|
1356
|
+
*/
|
|
1357
|
+
export declare function toCompileFeed(records: readonly AuthoredRuleRecord[]): AuthoredCompileFeed;
|
|
1358
|
+
//# sourceMappingURL=authored-rule.d.ts.map
|