@mmnto/totem 1.64.2 → 1.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ast-gate.d.ts +9 -0
- package/dist/ast-gate.d.ts.map +1 -1
- package/dist/ast-gate.js +64 -25
- package/dist/ast-gate.js.map +1 -1
- package/dist/ast-gate.test.js +47 -0
- package/dist/ast-gate.test.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/spine/windtunnel-lock.d.ts +440 -0
- package/dist/spine/windtunnel-lock.d.ts.map +1 -0
- package/dist/spine/windtunnel-lock.js +115 -0
- package/dist/spine/windtunnel-lock.js.map +1 -0
- package/dist/spine/windtunnel-lock.test.d.ts +2 -0
- package/dist/spine/windtunnel-lock.test.d.ts.map +1 -0
- package/dist/spine/windtunnel-lock.test.js +214 -0
- package/dist/spine/windtunnel-lock.test.js.map +1 -0
- package/dist/spine/windtunnel-parity.test.d.ts +2 -0
- package/dist/spine/windtunnel-parity.test.d.ts.map +1 -0
- package/dist/spine/windtunnel-parity.test.js +192 -0
- package/dist/spine/windtunnel-parity.test.js.map +1 -0
- package/dist/spine/windtunnel-scorer.d.ts +93 -0
- package/dist/spine/windtunnel-scorer.d.ts.map +1 -0
- package/dist/spine/windtunnel-scorer.js +191 -0
- package/dist/spine/windtunnel-scorer.js.map +1 -0
- package/dist/spine/windtunnel-scorer.test.d.ts +2 -0
- package/dist/spine/windtunnel-scorer.test.d.ts.map +1 -0
- package/dist/spine/windtunnel-scorer.test.js +533 -0
- package/dist/spine/windtunnel-scorer.test.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const WindtunnelLockSchema: z.ZodEffects<z.ZodObject<{
|
|
3
|
+
schema: z.ZodLiteral<"windtunnel.lock.v1">;
|
|
4
|
+
canonicalPath: z.ZodString;
|
|
5
|
+
gate: z.ZodString;
|
|
6
|
+
frozenAt: z.ZodOptional<z.ZodObject<{
|
|
7
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
8
|
+
commit: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
timestamp?: string | undefined;
|
|
11
|
+
commit?: string | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
timestamp?: string | undefined;
|
|
14
|
+
commit?: string | undefined;
|
|
15
|
+
}>>;
|
|
16
|
+
phase: z.ZodEnum<["harness", "certifying"]>;
|
|
17
|
+
corpus: z.ZodObject<{
|
|
18
|
+
repo: z.ZodString;
|
|
19
|
+
selectionRule: z.ZodObject<{
|
|
20
|
+
state: z.ZodString;
|
|
21
|
+
predicate: z.ZodString;
|
|
22
|
+
window: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
23
|
+
type: z.ZodLiteral<"all">;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
type: "all";
|
|
26
|
+
}, {
|
|
27
|
+
type: "all";
|
|
28
|
+
}>, z.ZodObject<{
|
|
29
|
+
type: z.ZodLiteral<"bounded">;
|
|
30
|
+
n: z.ZodNumber;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
type: "bounded";
|
|
33
|
+
n: number;
|
|
34
|
+
}, {
|
|
35
|
+
type: "bounded";
|
|
36
|
+
n: number;
|
|
37
|
+
}>]>;
|
|
38
|
+
asOfCommit: z.ZodString;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
state: string;
|
|
41
|
+
predicate: string;
|
|
42
|
+
window: {
|
|
43
|
+
type: "all";
|
|
44
|
+
} | {
|
|
45
|
+
type: "bounded";
|
|
46
|
+
n: number;
|
|
47
|
+
};
|
|
48
|
+
asOfCommit: string;
|
|
49
|
+
}, {
|
|
50
|
+
state: string;
|
|
51
|
+
predicate: string;
|
|
52
|
+
window: {
|
|
53
|
+
type: "all";
|
|
54
|
+
} | {
|
|
55
|
+
type: "bounded";
|
|
56
|
+
n: number;
|
|
57
|
+
};
|
|
58
|
+
asOfCommit: string;
|
|
59
|
+
}>;
|
|
60
|
+
resolvedPrs: z.ZodArray<z.ZodObject<{
|
|
61
|
+
pr: z.ZodNumber;
|
|
62
|
+
mergeCommit: z.ZodString;
|
|
63
|
+
baseSha: z.ZodString;
|
|
64
|
+
headSha: z.ZodString;
|
|
65
|
+
diffSha: z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
headSha: string;
|
|
68
|
+
pr: number;
|
|
69
|
+
mergeCommit: string;
|
|
70
|
+
baseSha: string;
|
|
71
|
+
diffSha?: string | undefined;
|
|
72
|
+
}, {
|
|
73
|
+
headSha: string;
|
|
74
|
+
pr: number;
|
|
75
|
+
mergeCommit: string;
|
|
76
|
+
baseSha: string;
|
|
77
|
+
diffSha?: string | undefined;
|
|
78
|
+
}>, "many">;
|
|
79
|
+
}, "strip", z.ZodTypeAny, {
|
|
80
|
+
repo: string;
|
|
81
|
+
selectionRule: {
|
|
82
|
+
state: string;
|
|
83
|
+
predicate: string;
|
|
84
|
+
window: {
|
|
85
|
+
type: "all";
|
|
86
|
+
} | {
|
|
87
|
+
type: "bounded";
|
|
88
|
+
n: number;
|
|
89
|
+
};
|
|
90
|
+
asOfCommit: string;
|
|
91
|
+
};
|
|
92
|
+
resolvedPrs: {
|
|
93
|
+
headSha: string;
|
|
94
|
+
pr: number;
|
|
95
|
+
mergeCommit: string;
|
|
96
|
+
baseSha: string;
|
|
97
|
+
diffSha?: string | undefined;
|
|
98
|
+
}[];
|
|
99
|
+
}, {
|
|
100
|
+
repo: string;
|
|
101
|
+
selectionRule: {
|
|
102
|
+
state: string;
|
|
103
|
+
predicate: string;
|
|
104
|
+
window: {
|
|
105
|
+
type: "all";
|
|
106
|
+
} | {
|
|
107
|
+
type: "bounded";
|
|
108
|
+
n: number;
|
|
109
|
+
};
|
|
110
|
+
asOfCommit: string;
|
|
111
|
+
};
|
|
112
|
+
resolvedPrs: {
|
|
113
|
+
headSha: string;
|
|
114
|
+
pr: number;
|
|
115
|
+
mergeCommit: string;
|
|
116
|
+
baseSha: string;
|
|
117
|
+
diffSha?: string | undefined;
|
|
118
|
+
}[];
|
|
119
|
+
}>;
|
|
120
|
+
fpDefinition: z.ZodObject<{
|
|
121
|
+
rubricRef: z.ZodString;
|
|
122
|
+
groundTruthRef: z.ZodString;
|
|
123
|
+
adjudicator: z.ZodString;
|
|
124
|
+
precisionFloor: z.ZodLiteral<1>;
|
|
125
|
+
}, "strip", z.ZodTypeAny, {
|
|
126
|
+
rubricRef: string;
|
|
127
|
+
groundTruthRef: string;
|
|
128
|
+
adjudicator: string;
|
|
129
|
+
precisionFloor: 1;
|
|
130
|
+
}, {
|
|
131
|
+
rubricRef: string;
|
|
132
|
+
groundTruthRef: string;
|
|
133
|
+
adjudicator: string;
|
|
134
|
+
precisionFloor: 1;
|
|
135
|
+
}>;
|
|
136
|
+
controls: z.ZodObject<{
|
|
137
|
+
positiveRef: z.ZodString;
|
|
138
|
+
negativeRef: z.ZodString;
|
|
139
|
+
integrity: z.ZodObject<{
|
|
140
|
+
mechanism: z.ZodString;
|
|
141
|
+
fixtureSha: z.ZodString;
|
|
142
|
+
}, "strip", z.ZodTypeAny, {
|
|
143
|
+
mechanism: string;
|
|
144
|
+
fixtureSha: string;
|
|
145
|
+
}, {
|
|
146
|
+
mechanism: string;
|
|
147
|
+
fixtureSha: string;
|
|
148
|
+
}>;
|
|
149
|
+
}, "strip", z.ZodTypeAny, {
|
|
150
|
+
positiveRef: string;
|
|
151
|
+
negativeRef: string;
|
|
152
|
+
integrity: {
|
|
153
|
+
mechanism: string;
|
|
154
|
+
fixtureSha: string;
|
|
155
|
+
};
|
|
156
|
+
}, {
|
|
157
|
+
positiveRef: string;
|
|
158
|
+
negativeRef: string;
|
|
159
|
+
integrity: {
|
|
160
|
+
mechanism: string;
|
|
161
|
+
fixtureSha: string;
|
|
162
|
+
};
|
|
163
|
+
}>;
|
|
164
|
+
cullRateThreshold: z.ZodNumber;
|
|
165
|
+
exposureDenominator: z.ZodObject<{
|
|
166
|
+
activeRulesEvaluated: z.ZodObject<{
|
|
167
|
+
floor: z.ZodNumber;
|
|
168
|
+
}, "strip", z.ZodTypeAny, {
|
|
169
|
+
floor: number;
|
|
170
|
+
}, {
|
|
171
|
+
floor: number;
|
|
172
|
+
}>;
|
|
173
|
+
filesTouchedInWindow: z.ZodObject<{
|
|
174
|
+
floor: z.ZodNumber;
|
|
175
|
+
}, "strip", z.ZodTypeAny, {
|
|
176
|
+
floor: number;
|
|
177
|
+
}, {
|
|
178
|
+
floor: number;
|
|
179
|
+
}>;
|
|
180
|
+
positiveControlsExercised: z.ZodObject<{
|
|
181
|
+
floor: z.ZodNumber;
|
|
182
|
+
}, "strip", z.ZodTypeAny, {
|
|
183
|
+
floor: number;
|
|
184
|
+
}, {
|
|
185
|
+
floor: number;
|
|
186
|
+
}>;
|
|
187
|
+
}, "strip", z.ZodTypeAny, {
|
|
188
|
+
activeRulesEvaluated: {
|
|
189
|
+
floor: number;
|
|
190
|
+
};
|
|
191
|
+
filesTouchedInWindow: {
|
|
192
|
+
floor: number;
|
|
193
|
+
};
|
|
194
|
+
positiveControlsExercised: {
|
|
195
|
+
floor: number;
|
|
196
|
+
};
|
|
197
|
+
}, {
|
|
198
|
+
activeRulesEvaluated: {
|
|
199
|
+
floor: number;
|
|
200
|
+
};
|
|
201
|
+
filesTouchedInWindow: {
|
|
202
|
+
floor: number;
|
|
203
|
+
};
|
|
204
|
+
positiveControlsExercised: {
|
|
205
|
+
floor: number;
|
|
206
|
+
};
|
|
207
|
+
}>;
|
|
208
|
+
}, "strip", z.ZodTypeAny, {
|
|
209
|
+
schema: "windtunnel.lock.v1";
|
|
210
|
+
corpus: {
|
|
211
|
+
repo: string;
|
|
212
|
+
selectionRule: {
|
|
213
|
+
state: string;
|
|
214
|
+
predicate: string;
|
|
215
|
+
window: {
|
|
216
|
+
type: "all";
|
|
217
|
+
} | {
|
|
218
|
+
type: "bounded";
|
|
219
|
+
n: number;
|
|
220
|
+
};
|
|
221
|
+
asOfCommit: string;
|
|
222
|
+
};
|
|
223
|
+
resolvedPrs: {
|
|
224
|
+
headSha: string;
|
|
225
|
+
pr: number;
|
|
226
|
+
mergeCommit: string;
|
|
227
|
+
baseSha: string;
|
|
228
|
+
diffSha?: string | undefined;
|
|
229
|
+
}[];
|
|
230
|
+
};
|
|
231
|
+
canonicalPath: string;
|
|
232
|
+
gate: string;
|
|
233
|
+
phase: "harness" | "certifying";
|
|
234
|
+
fpDefinition: {
|
|
235
|
+
rubricRef: string;
|
|
236
|
+
groundTruthRef: string;
|
|
237
|
+
adjudicator: string;
|
|
238
|
+
precisionFloor: 1;
|
|
239
|
+
};
|
|
240
|
+
controls: {
|
|
241
|
+
positiveRef: string;
|
|
242
|
+
negativeRef: string;
|
|
243
|
+
integrity: {
|
|
244
|
+
mechanism: string;
|
|
245
|
+
fixtureSha: string;
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
cullRateThreshold: number;
|
|
249
|
+
exposureDenominator: {
|
|
250
|
+
activeRulesEvaluated: {
|
|
251
|
+
floor: number;
|
|
252
|
+
};
|
|
253
|
+
filesTouchedInWindow: {
|
|
254
|
+
floor: number;
|
|
255
|
+
};
|
|
256
|
+
positiveControlsExercised: {
|
|
257
|
+
floor: number;
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
frozenAt?: {
|
|
261
|
+
timestamp?: string | undefined;
|
|
262
|
+
commit?: string | undefined;
|
|
263
|
+
} | undefined;
|
|
264
|
+
}, {
|
|
265
|
+
schema: "windtunnel.lock.v1";
|
|
266
|
+
corpus: {
|
|
267
|
+
repo: string;
|
|
268
|
+
selectionRule: {
|
|
269
|
+
state: string;
|
|
270
|
+
predicate: string;
|
|
271
|
+
window: {
|
|
272
|
+
type: "all";
|
|
273
|
+
} | {
|
|
274
|
+
type: "bounded";
|
|
275
|
+
n: number;
|
|
276
|
+
};
|
|
277
|
+
asOfCommit: string;
|
|
278
|
+
};
|
|
279
|
+
resolvedPrs: {
|
|
280
|
+
headSha: string;
|
|
281
|
+
pr: number;
|
|
282
|
+
mergeCommit: string;
|
|
283
|
+
baseSha: string;
|
|
284
|
+
diffSha?: string | undefined;
|
|
285
|
+
}[];
|
|
286
|
+
};
|
|
287
|
+
canonicalPath: string;
|
|
288
|
+
gate: string;
|
|
289
|
+
phase: "harness" | "certifying";
|
|
290
|
+
fpDefinition: {
|
|
291
|
+
rubricRef: string;
|
|
292
|
+
groundTruthRef: string;
|
|
293
|
+
adjudicator: string;
|
|
294
|
+
precisionFloor: 1;
|
|
295
|
+
};
|
|
296
|
+
controls: {
|
|
297
|
+
positiveRef: string;
|
|
298
|
+
negativeRef: string;
|
|
299
|
+
integrity: {
|
|
300
|
+
mechanism: string;
|
|
301
|
+
fixtureSha: string;
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
cullRateThreshold: number;
|
|
305
|
+
exposureDenominator: {
|
|
306
|
+
activeRulesEvaluated: {
|
|
307
|
+
floor: number;
|
|
308
|
+
};
|
|
309
|
+
filesTouchedInWindow: {
|
|
310
|
+
floor: number;
|
|
311
|
+
};
|
|
312
|
+
positiveControlsExercised: {
|
|
313
|
+
floor: number;
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
frozenAt?: {
|
|
317
|
+
timestamp?: string | undefined;
|
|
318
|
+
commit?: string | undefined;
|
|
319
|
+
} | undefined;
|
|
320
|
+
}>, {
|
|
321
|
+
schema: "windtunnel.lock.v1";
|
|
322
|
+
corpus: {
|
|
323
|
+
repo: string;
|
|
324
|
+
selectionRule: {
|
|
325
|
+
state: string;
|
|
326
|
+
predicate: string;
|
|
327
|
+
window: {
|
|
328
|
+
type: "all";
|
|
329
|
+
} | {
|
|
330
|
+
type: "bounded";
|
|
331
|
+
n: number;
|
|
332
|
+
};
|
|
333
|
+
asOfCommit: string;
|
|
334
|
+
};
|
|
335
|
+
resolvedPrs: {
|
|
336
|
+
headSha: string;
|
|
337
|
+
pr: number;
|
|
338
|
+
mergeCommit: string;
|
|
339
|
+
baseSha: string;
|
|
340
|
+
diffSha?: string | undefined;
|
|
341
|
+
}[];
|
|
342
|
+
};
|
|
343
|
+
canonicalPath: string;
|
|
344
|
+
gate: string;
|
|
345
|
+
phase: "harness" | "certifying";
|
|
346
|
+
fpDefinition: {
|
|
347
|
+
rubricRef: string;
|
|
348
|
+
groundTruthRef: string;
|
|
349
|
+
adjudicator: string;
|
|
350
|
+
precisionFloor: 1;
|
|
351
|
+
};
|
|
352
|
+
controls: {
|
|
353
|
+
positiveRef: string;
|
|
354
|
+
negativeRef: string;
|
|
355
|
+
integrity: {
|
|
356
|
+
mechanism: string;
|
|
357
|
+
fixtureSha: string;
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
cullRateThreshold: number;
|
|
361
|
+
exposureDenominator: {
|
|
362
|
+
activeRulesEvaluated: {
|
|
363
|
+
floor: number;
|
|
364
|
+
};
|
|
365
|
+
filesTouchedInWindow: {
|
|
366
|
+
floor: number;
|
|
367
|
+
};
|
|
368
|
+
positiveControlsExercised: {
|
|
369
|
+
floor: number;
|
|
370
|
+
};
|
|
371
|
+
};
|
|
372
|
+
frozenAt?: {
|
|
373
|
+
timestamp?: string | undefined;
|
|
374
|
+
commit?: string | undefined;
|
|
375
|
+
} | undefined;
|
|
376
|
+
}, {
|
|
377
|
+
schema: "windtunnel.lock.v1";
|
|
378
|
+
corpus: {
|
|
379
|
+
repo: string;
|
|
380
|
+
selectionRule: {
|
|
381
|
+
state: string;
|
|
382
|
+
predicate: string;
|
|
383
|
+
window: {
|
|
384
|
+
type: "all";
|
|
385
|
+
} | {
|
|
386
|
+
type: "bounded";
|
|
387
|
+
n: number;
|
|
388
|
+
};
|
|
389
|
+
asOfCommit: string;
|
|
390
|
+
};
|
|
391
|
+
resolvedPrs: {
|
|
392
|
+
headSha: string;
|
|
393
|
+
pr: number;
|
|
394
|
+
mergeCommit: string;
|
|
395
|
+
baseSha: string;
|
|
396
|
+
diffSha?: string | undefined;
|
|
397
|
+
}[];
|
|
398
|
+
};
|
|
399
|
+
canonicalPath: string;
|
|
400
|
+
gate: string;
|
|
401
|
+
phase: "harness" | "certifying";
|
|
402
|
+
fpDefinition: {
|
|
403
|
+
rubricRef: string;
|
|
404
|
+
groundTruthRef: string;
|
|
405
|
+
adjudicator: string;
|
|
406
|
+
precisionFloor: 1;
|
|
407
|
+
};
|
|
408
|
+
controls: {
|
|
409
|
+
positiveRef: string;
|
|
410
|
+
negativeRef: string;
|
|
411
|
+
integrity: {
|
|
412
|
+
mechanism: string;
|
|
413
|
+
fixtureSha: string;
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
cullRateThreshold: number;
|
|
417
|
+
exposureDenominator: {
|
|
418
|
+
activeRulesEvaluated: {
|
|
419
|
+
floor: number;
|
|
420
|
+
};
|
|
421
|
+
filesTouchedInWindow: {
|
|
422
|
+
floor: number;
|
|
423
|
+
};
|
|
424
|
+
positiveControlsExercised: {
|
|
425
|
+
floor: number;
|
|
426
|
+
};
|
|
427
|
+
};
|
|
428
|
+
frozenAt?: {
|
|
429
|
+
timestamp?: string | undefined;
|
|
430
|
+
commit?: string | undefined;
|
|
431
|
+
} | undefined;
|
|
432
|
+
}>;
|
|
433
|
+
export type WindtunnelLock = z.infer<typeof WindtunnelLockSchema>;
|
|
434
|
+
/**
|
|
435
|
+
* Compute a content-based per-firing label id (A2).
|
|
436
|
+
* Keyed on hash(ruleId + pr + filePath + normalizedMatchedLineText) to survive
|
|
437
|
+
* line-drift without raw line-number anchoring.
|
|
438
|
+
*/
|
|
439
|
+
export declare function firingLabelId(ruleId: string, pr: number, filePath: string, normalizedMatchedLineText: string): string;
|
|
440
|
+
//# sourceMappingURL=windtunnel-lock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windtunnel-lock.d.ts","sourceRoot":"","sources":["../../src/spine/windtunnel-lock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2F7B,CAAC;AAEL,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAIlE;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,EAChB,yBAAyB,EAAE,MAAM,GAChC,MAAM,CAMR"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
// ─── Named constants ─────────────────────────────────
|
|
4
|
+
const COMMIT_SHA_REGEX = /^[0-9a-f]{40}$/;
|
|
5
|
+
const MIN_ACTIVE_RULES_FLOOR = 2;
|
|
6
|
+
// ─── Sub-schemas ─────────────────────────────────────
|
|
7
|
+
const ResolvedPrSchema = z.object({
|
|
8
|
+
pr: z.number().int().positive(),
|
|
9
|
+
mergeCommit: z.string().regex(COMMIT_SHA_REGEX, 'mergeCommit must be a 40-hex SHA'),
|
|
10
|
+
baseSha: z.string().regex(COMMIT_SHA_REGEX, 'baseSha must be a 40-hex SHA'),
|
|
11
|
+
headSha: z.string().regex(COMMIT_SHA_REGEX, 'headSha must be a 40-hex SHA'),
|
|
12
|
+
diffSha: z.string().regex(COMMIT_SHA_REGEX, 'diffSha must be a 40-hex SHA').optional(),
|
|
13
|
+
});
|
|
14
|
+
// ─── Main schema ─────────────────────────────────────
|
|
15
|
+
export const WindtunnelLockSchema = z
|
|
16
|
+
.object({
|
|
17
|
+
schema: z.literal('windtunnel.lock.v1'),
|
|
18
|
+
canonicalPath: z.string(),
|
|
19
|
+
gate: z.string(),
|
|
20
|
+
// frozenAt.commit is NOT trusted as a freeze proof (C3 — proof is git-derived at run time).
|
|
21
|
+
frozenAt: z
|
|
22
|
+
.object({
|
|
23
|
+
timestamp: z.string().optional(),
|
|
24
|
+
commit: z.string().optional(),
|
|
25
|
+
})
|
|
26
|
+
.optional(),
|
|
27
|
+
phase: z.enum(['harness', 'certifying']),
|
|
28
|
+
corpus: z.object({
|
|
29
|
+
repo: z.string(),
|
|
30
|
+
selectionRule: z.object({
|
|
31
|
+
state: z.string(),
|
|
32
|
+
predicate: z.string(),
|
|
33
|
+
window: z.discriminatedUnion('type', [
|
|
34
|
+
z.object({ type: z.literal('all') }),
|
|
35
|
+
z.object({ type: z.literal('bounded'), n: z.number().int().positive() }),
|
|
36
|
+
]),
|
|
37
|
+
asOfCommit: z.string().regex(COMMIT_SHA_REGEX, 'asOfCommit must be a 40-hex SHA'),
|
|
38
|
+
}),
|
|
39
|
+
resolvedPrs: z.array(ResolvedPrSchema).min(1, 'resolvedPrs must be non-empty'),
|
|
40
|
+
}),
|
|
41
|
+
fpDefinition: z.object({
|
|
42
|
+
rubricRef: z.string(),
|
|
43
|
+
groundTruthRef: z.string(),
|
|
44
|
+
adjudicator: z.string(),
|
|
45
|
+
precisionFloor: z.literal(1.0),
|
|
46
|
+
}),
|
|
47
|
+
controls: z.object({
|
|
48
|
+
positiveRef: z.string(),
|
|
49
|
+
negativeRef: z.string(),
|
|
50
|
+
integrity: z.object({
|
|
51
|
+
mechanism: z.string(),
|
|
52
|
+
// fixtureSha is a git hash-object digest (40-hex) that feeds the
|
|
53
|
+
// hard-error integrity gate — validate its format here so a malformed
|
|
54
|
+
// value fails at parse, not cryptically at run (greptile P2).
|
|
55
|
+
fixtureSha: z.string().regex(COMMIT_SHA_REGEX, 'fixtureSha must be a 40-hex SHA'),
|
|
56
|
+
}),
|
|
57
|
+
}),
|
|
58
|
+
cullRateThreshold: z
|
|
59
|
+
.number()
|
|
60
|
+
.min(0, 'cullRateThreshold must be >= 0')
|
|
61
|
+
.lt(1, 'cullRateThreshold must be < 1'),
|
|
62
|
+
exposureDenominator: z.object({
|
|
63
|
+
activeRulesEvaluated: z.object({
|
|
64
|
+
floor: z
|
|
65
|
+
.number()
|
|
66
|
+
.int()
|
|
67
|
+
.min(MIN_ACTIVE_RULES_FLOOR, `activeRulesEvaluated.floor must be >= ${MIN_ACTIVE_RULES_FLOOR}`),
|
|
68
|
+
}),
|
|
69
|
+
filesTouchedInWindow: z.object({
|
|
70
|
+
floor: z.number().int().nonnegative(),
|
|
71
|
+
}),
|
|
72
|
+
positiveControlsExercised: z.object({
|
|
73
|
+
floor: z.number().int().nonnegative(),
|
|
74
|
+
}),
|
|
75
|
+
}),
|
|
76
|
+
})
|
|
77
|
+
.superRefine((data, ctx) => {
|
|
78
|
+
const prs = data.corpus.resolvedPrs;
|
|
79
|
+
const prNums = prs.map((p) => p.pr);
|
|
80
|
+
// C4: unique pr numbers
|
|
81
|
+
const uniquePrs = new Set(prNums);
|
|
82
|
+
if (uniquePrs.size !== prNums.length) {
|
|
83
|
+
ctx.addIssue({
|
|
84
|
+
code: z.ZodIssueCode.custom,
|
|
85
|
+
message: 'resolvedPrs must have unique pr numbers',
|
|
86
|
+
path: ['corpus', 'resolvedPrs'],
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
// C4: sorted ascending by pr number
|
|
90
|
+
const sortedPrNums = [...prNums].sort((a, b) => a - b);
|
|
91
|
+
for (let i = 0; i < prNums.length; i++) {
|
|
92
|
+
if (prNums[i] !== sortedPrNums[i]) {
|
|
93
|
+
ctx.addIssue({
|
|
94
|
+
code: z.ZodIssueCode.custom,
|
|
95
|
+
message: 'resolvedPrs must be sorted ascending by pr number',
|
|
96
|
+
path: ['corpus', 'resolvedPrs'],
|
|
97
|
+
});
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
// ─── Utilities ───────────────────────────────────────
|
|
103
|
+
/**
|
|
104
|
+
* Compute a content-based per-firing label id (A2).
|
|
105
|
+
* Keyed on hash(ruleId + pr + filePath + normalizedMatchedLineText) to survive
|
|
106
|
+
* line-drift without raw line-number anchoring.
|
|
107
|
+
*/
|
|
108
|
+
export function firingLabelId(ruleId, pr, filePath, normalizedMatchedLineText) {
|
|
109
|
+
// A3: normalize path to forward-slash (Windows cross-platform)
|
|
110
|
+
const normalizedPath = filePath.replace(/\\/g, '/');
|
|
111
|
+
return createHash('sha256')
|
|
112
|
+
.update(`${ruleId}\x00${pr}\x00${normalizedPath}\x00${normalizedMatchedLineText}`)
|
|
113
|
+
.digest('hex');
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=windtunnel-lock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windtunnel-lock.js","sourceRoot":"","sources":["../../src/spine/windtunnel-lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wDAAwD;AAExD,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAC1C,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAEjC,wDAAwD;AAExD,MAAM,gBAAgB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