@aldus-runtime/regression 0.2.0-next.2 → 0.2.0-next.21
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/corpus.d.ts +24 -3
- package/dist/corpus.d.ts.map +1 -1
- package/dist/corpus.js +82 -1
- package/dist/corpus.js.map +1 -1
- package/dist/errors.d.ts +10 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +10 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/metrics.d.ts +21 -0
- package/dist/metrics.d.ts.map +1 -1
- package/dist/metrics.js +6 -0
- package/dist/metrics.js.map +1 -1
- package/package.json +3 -3
- package/src/corpus.ts +94 -1
- package/src/errors.ts +10 -0
- package/src/index.ts +2 -0
- package/src/metrics.ts +28 -0
package/dist/corpus.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ export declare const defectCorpusSchema: z.ZodObject<{
|
|
|
120
120
|
}, z.core.$strip>;
|
|
121
121
|
labelledAt: z.ZodISODateTime;
|
|
122
122
|
}, z.core.$strip>>;
|
|
123
|
-
}, z.core.$
|
|
123
|
+
}, z.core.$strict>;
|
|
124
124
|
/** @see defectCorpusSchema */
|
|
125
125
|
export type DefectCorpus = z.infer<typeof defectCorpusSchema>;
|
|
126
126
|
/** One finding an evaluator reported. */
|
|
@@ -140,6 +140,7 @@ export declare const evaluatorOutcomeSchema: z.ZodObject<{
|
|
|
140
140
|
severity: z.ZodOptional<z.ZodString>;
|
|
141
141
|
confidence: z.ZodOptional<z.ZodNumber>;
|
|
142
142
|
}, z.core.$strip>>;
|
|
143
|
+
siteMetricsMeasurable: z.ZodOptional<z.ZodBoolean>;
|
|
143
144
|
}, z.core.$strip>;
|
|
144
145
|
/** @see evaluatorOutcomeSchema */
|
|
145
146
|
export type EvaluatorOutcome = z.infer<typeof evaluatorOutcomeSchema>;
|
|
@@ -162,13 +163,33 @@ export declare const evaluatorRunSchema: z.ZodObject<{
|
|
|
162
163
|
severity: z.ZodOptional<z.ZodString>;
|
|
163
164
|
confidence: z.ZodOptional<z.ZodNumber>;
|
|
164
165
|
}, z.core.$strip>>;
|
|
166
|
+
siteMetricsMeasurable: z.ZodOptional<z.ZodBoolean>;
|
|
165
167
|
}, z.core.$strip>>;
|
|
166
168
|
executedAt: z.ZodISODateTime;
|
|
167
|
-
}, z.core.$
|
|
169
|
+
}, z.core.$strict>;
|
|
168
170
|
/** @see evaluatorRunSchema */
|
|
169
171
|
export type EvaluatorRun = z.infer<typeof evaluatorRunSchema>;
|
|
170
172
|
/** Schema version this package stamps on records it constructs. */
|
|
171
|
-
export declare const REGRESSION_SCHEMA_VERSION = "1.
|
|
173
|
+
export declare const REGRESSION_SCHEMA_VERSION = "1.11";
|
|
174
|
+
/** How a record's declared schema version relates to the one this runtime implements. */
|
|
175
|
+
export type SchemaVersionRelation = "older" | "same" | "newer";
|
|
176
|
+
/**
|
|
177
|
+
* Compare a record's declared schema version against {@link REGRESSION_SCHEMA_VERSION}.
|
|
178
|
+
*
|
|
179
|
+
* Exported because the two directions are not the same kind of question. **Newer** is soundness
|
|
180
|
+
* and belongs here: this runtime cannot know what a later version's fields mean, so it refuses.
|
|
181
|
+
* **Older** is policy and belongs to the caller — whether a run from an earlier version is
|
|
182
|
+
* comparable to today's depends on what changed between them, which this package cannot know
|
|
183
|
+
* either. What it can do is stop every caller reimplementing the comparison, which is the part
|
|
184
|
+
* that would drift.
|
|
185
|
+
*
|
|
186
|
+
* A record must be readable in order to be upgraded, so this is deliberately a question a caller
|
|
187
|
+
* can ask *before* parsing, and an older record still parses.
|
|
188
|
+
*
|
|
189
|
+
* @param recordVersion - The `schemaVersion` field of a record, `MAJOR.MINOR` (ADR-0003).
|
|
190
|
+
* @throws {AldusError} `ALDUS_CORPUS_MALFORMED` if `recordVersion` is not `MAJOR.MINOR`.
|
|
191
|
+
*/
|
|
192
|
+
export declare function compareSchemaVersion(recordVersion: string): SchemaVersionRelation;
|
|
172
193
|
/**
|
|
173
194
|
* Validate a corpus and check the uniqueness constraint Zod cannot express.
|
|
174
195
|
*
|
package/dist/corpus.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"corpus.d.ts","sourceRoot":"","sources":["../src/corpus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,aAA6B,CAAC;AAE1D;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,aAA6B,CAAC;AAExD;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,uCAAmE,CAAC;AAEhG,2BAA2B;AAC3B,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,wDAAwD;AACxD,eAAO,MAAM,kBAAkB;;;;iBASuB,CAAC;AAEvD,8BAA8B;AAC9B,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;iBA2DzB,CAAC;AAEL,4BAA4B;AAC5B,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,gDAAgD;AAChD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"corpus.d.ts","sourceRoot":"","sources":["../src/corpus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,aAA6B,CAAC;AAE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;AAE9D,mEAAmE;AACnE,eAAO,MAAM,yBAAyB,SAAiB,CAAC;AAExD,yFAAyF;AACzF,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,qBAAqB,CAqBjF;AAwBD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAkC9D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAgC9D"}
|
package/dist/corpus.js
CHANGED
|
@@ -136,6 +136,11 @@ export const defectCorpusSchema = z
|
|
|
136
136
|
/** The labelled cases. */
|
|
137
137
|
cases: z.array(defectCaseSchema).max(100_000),
|
|
138
138
|
})
|
|
139
|
+
// Strict: an unknown key is refused, not stripped. Without this a record from a later runtime
|
|
140
|
+
// parses and its added fields vanish, handing the caller an object that looks complete and is
|
|
141
|
+
// not. See SCHEMA_VERSION_UNSUPPORTED — the version check and this are the same guarantee, one
|
|
142
|
+
// for a declared newer version and one for an undeclared newer shape.
|
|
143
|
+
.strict()
|
|
139
144
|
.meta({
|
|
140
145
|
id: "DefectCorpus",
|
|
141
146
|
title: "DefectCorpus",
|
|
@@ -161,8 +166,27 @@ export const evaluatorOutcomeSchema = z
|
|
|
161
166
|
caseId: identifier,
|
|
162
167
|
/** Whether the evaluator flagged the subject. */
|
|
163
168
|
flagged: z.boolean(),
|
|
164
|
-
/**
|
|
169
|
+
/**
|
|
170
|
+
* The defect occurrences it enumerated. Empty when not flagged, **and also empty when the
|
|
171
|
+
* evaluator flagged without enumerating** (#140).
|
|
172
|
+
*
|
|
173
|
+
* An empty list under `flagged: true` is therefore not a contradiction and must not be
|
|
174
|
+
* repaired by inventing an entry. A wrapped legacy evaluator reports that it had something to
|
|
175
|
+
* say and not how much; fabricating one finding would make its report count as one defect,
|
|
176
|
+
* which is the statistic this distinction exists to protect.
|
|
177
|
+
*/
|
|
165
178
|
findings: z.array(evaluatorFindingSchema).max(256),
|
|
179
|
+
/**
|
|
180
|
+
* Whether site-level metrics are computable for this case (#140).
|
|
181
|
+
*
|
|
182
|
+
* `false` when the evaluator flagged without enumerating, or when a report could not be mapped
|
|
183
|
+
* to this case's subject scope at all. Site-level precision and recall are then **unmeasurable
|
|
184
|
+
* rather than zero**, and a metric that silently treated an unenumerated flag as zero findings
|
|
185
|
+
* would report perfect precision for an evaluator nobody measured.
|
|
186
|
+
*
|
|
187
|
+
* Absent means measurable, which is what every record written before this field meant.
|
|
188
|
+
*/
|
|
189
|
+
siteMetricsMeasurable: z.boolean().optional(),
|
|
166
190
|
})
|
|
167
191
|
.meta({ id: "EvaluatorOutcome", title: "EvaluatorOutcome" });
|
|
168
192
|
/**
|
|
@@ -186,6 +210,7 @@ export const evaluatorRunSchema = z
|
|
|
186
210
|
/** When the run was executed. */
|
|
187
211
|
executedAt: z.iso.datetime({ offset: true }),
|
|
188
212
|
})
|
|
213
|
+
.strict()
|
|
189
214
|
.meta({
|
|
190
215
|
id: "EvaluatorRun",
|
|
191
216
|
title: "EvaluatorRun",
|
|
@@ -195,6 +220,60 @@ export const evaluatorRunSchema = z
|
|
|
195
220
|
});
|
|
196
221
|
/** Schema version this package stamps on records it constructs. */
|
|
197
222
|
export const REGRESSION_SCHEMA_VERSION = SCHEMA_VERSION;
|
|
223
|
+
/**
|
|
224
|
+
* Compare a record's declared schema version against {@link REGRESSION_SCHEMA_VERSION}.
|
|
225
|
+
*
|
|
226
|
+
* Exported because the two directions are not the same kind of question. **Newer** is soundness
|
|
227
|
+
* and belongs here: this runtime cannot know what a later version's fields mean, so it refuses.
|
|
228
|
+
* **Older** is policy and belongs to the caller — whether a run from an earlier version is
|
|
229
|
+
* comparable to today's depends on what changed between them, which this package cannot know
|
|
230
|
+
* either. What it can do is stop every caller reimplementing the comparison, which is the part
|
|
231
|
+
* that would drift.
|
|
232
|
+
*
|
|
233
|
+
* A record must be readable in order to be upgraded, so this is deliberately a question a caller
|
|
234
|
+
* can ask *before* parsing, and an older record still parses.
|
|
235
|
+
*
|
|
236
|
+
* @param recordVersion - The `schemaVersion` field of a record, `MAJOR.MINOR` (ADR-0003).
|
|
237
|
+
* @throws {AldusError} `ALDUS_CORPUS_MALFORMED` if `recordVersion` is not `MAJOR.MINOR`.
|
|
238
|
+
*/
|
|
239
|
+
export function compareSchemaVersion(recordVersion) {
|
|
240
|
+
const parse = (value) => {
|
|
241
|
+
const match = /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(value);
|
|
242
|
+
if (match === null) {
|
|
243
|
+
// Path and code only — never the received value (contract §19.2).
|
|
244
|
+
throw regressionError(RegressionErrorCodes.CORPUS_MALFORMED, "A schema version must be MAJOR.MINOR.", {
|
|
245
|
+
category: "validation",
|
|
246
|
+
details: { issues: [{ path: "schemaVersion", code: "invalid_format" }] },
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
return [Number(match[1]), Number(match[2])];
|
|
250
|
+
};
|
|
251
|
+
const [recordMajor, recordMinor] = parse(recordVersion);
|
|
252
|
+
const [runtimeMajor, runtimeMinor] = parse(REGRESSION_SCHEMA_VERSION);
|
|
253
|
+
if (recordMajor !== runtimeMajor)
|
|
254
|
+
return recordMajor > runtimeMajor ? "newer" : "older";
|
|
255
|
+
if (recordMinor !== runtimeMinor)
|
|
256
|
+
return recordMinor > runtimeMinor ? "newer" : "older";
|
|
257
|
+
return "same";
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Refuse a record declaring a version this runtime does not implement.
|
|
261
|
+
*
|
|
262
|
+
* Only `newer` is refused. An older record parses, and {@link compareSchemaVersion} is how a
|
|
263
|
+
* caller decides whether to trust it.
|
|
264
|
+
*/
|
|
265
|
+
function assertSchemaVersionSupported(recordVersion, record) {
|
|
266
|
+
if (compareSchemaVersion(recordVersion) !== "newer")
|
|
267
|
+
return;
|
|
268
|
+
throw regressionError(RegressionErrorCodes.SCHEMA_VERSION_UNSUPPORTED, `A ${record} declares a schema version newer than this runtime implements. Its fields cannot ` +
|
|
269
|
+
"be interpreted here, and the schema discards what it does not declare, so accepting it " +
|
|
270
|
+
"would return a record that looks complete and is not.", {
|
|
271
|
+
category: "validation",
|
|
272
|
+
// The runtime's own version is this package's constant, not received input, so naming it is
|
|
273
|
+
// not a value leak. The record's version is not named (contract §19.2).
|
|
274
|
+
details: { runtimeSchemaVersion: REGRESSION_SCHEMA_VERSION, relation: "newer" },
|
|
275
|
+
});
|
|
276
|
+
}
|
|
198
277
|
/**
|
|
199
278
|
* Validate a corpus and check the uniqueness constraint Zod cannot express.
|
|
200
279
|
*
|
|
@@ -214,6 +293,7 @@ export function parseDefectCorpus(input) {
|
|
|
214
293
|
},
|
|
215
294
|
});
|
|
216
295
|
}
|
|
296
|
+
assertSchemaVersionSupported(result.data.schemaVersion, "corpus");
|
|
217
297
|
const seen = new Set();
|
|
218
298
|
for (const entry of result.data.cases) {
|
|
219
299
|
if (seen.has(entry.caseId)) {
|
|
@@ -242,6 +322,7 @@ export function parseEvaluatorRun(input) {
|
|
|
242
322
|
},
|
|
243
323
|
});
|
|
244
324
|
}
|
|
325
|
+
assertSchemaVersionSupported(result.data.schemaVersion, "run");
|
|
245
326
|
const seen = new Set();
|
|
246
327
|
for (const outcome of result.data.outcomes) {
|
|
247
328
|
if (seen.has(outcome.caseId)) {
|
package/dist/corpus.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"corpus.js","sourceRoot":"","sources":["../src/corpus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEpE,iCAAiC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EAAE,CAAC;YAC7B,MAAM,eAAe,CACnB,oBAAoB,CAAC,iBAAiB,EACtC,sBAAsB,MAAM,CAAC,IAAI,CAAC,WAAW,4BAA4B,OAAO,CAAC,MAAM,IAAI,EAC3F,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAC9E,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -32,6 +32,16 @@ export declare const RegressionErrorCodes: {
|
|
|
32
32
|
readonly BLIND_SPOT_DUPLICATE: "ALDUS_BLIND_SPOT_DUPLICATE";
|
|
33
33
|
/** A promotion policy is internally inconsistent — a threshold outside its valid range. */
|
|
34
34
|
readonly POLICY_INVALID: "ALDUS_POLICY_INVALID";
|
|
35
|
+
/**
|
|
36
|
+
* A record declares a schema version newer than this runtime implements.
|
|
37
|
+
*
|
|
38
|
+
* Refused rather than accepted, because this runtime cannot know what a later version's fields
|
|
39
|
+
* mean and the schemas discard what they do not declare. Accepting one returns an object that
|
|
40
|
+
* looks complete and is not — a read path answering wrongly with no signal, which is worse than
|
|
41
|
+
* refusing. Whether an *older* record is comparable is the caller's policy, not this package's:
|
|
42
|
+
* see `compareSchemaVersion`.
|
|
43
|
+
*/
|
|
44
|
+
readonly SCHEMA_VERSION_UNSUPPORTED: "ALDUS_SCHEMA_VERSION_UNSUPPORTED";
|
|
35
45
|
};
|
|
36
46
|
/** @see RegressionErrorCodes */
|
|
37
47
|
export type RegressionErrorCode = (typeof RegressionErrorCodes)[keyof typeof RegressionErrorCodes];
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names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AM,mBAAmB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;AAEnG,sEAAsE;AACtE,wBAAgB,eAAe,CAC7B,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IAAE,QAAQ,EAAE,aAAa,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAC3F,UAAU,CAEZ"}
|
package/dist/errors.js
CHANGED
|
@@ -32,6 +32,16 @@ export const RegressionErrorCodes = {
|
|
|
32
32
|
BLIND_SPOT_DUPLICATE: "ALDUS_BLIND_SPOT_DUPLICATE",
|
|
33
33
|
/** A promotion policy is internally inconsistent — a threshold outside its valid range. */
|
|
34
34
|
POLICY_INVALID: "ALDUS_POLICY_INVALID",
|
|
35
|
+
/**
|
|
36
|
+
* A record declares a schema version newer than this runtime implements.
|
|
37
|
+
*
|
|
38
|
+
* Refused rather than accepted, because this runtime cannot know what a later version's fields
|
|
39
|
+
* mean and the schemas discard what they do not declare. Accepting one returns an object that
|
|
40
|
+
* looks complete and is not — a read path answering wrongly with no signal, which is worse than
|
|
41
|
+
* refusing. Whether an *older* record is comparable is the caller's policy, not this package's:
|
|
42
|
+
* see `compareSchemaVersion`.
|
|
43
|
+
*/
|
|
44
|
+
SCHEMA_VERSION_UNSUPPORTED: "ALDUS_SCHEMA_VERSION_UNSUPPORTED",
|
|
35
45
|
};
|
|
36
46
|
/** Construct an {@link AldusError} with a regression-harness code. */
|
|
37
47
|
export function regressionError(code, message, options) {
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAsB,MAAM,qBAAqB,CAAC;AAErE,oDAAoD;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AAC,CAAC;AAChD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* @packageDocumentation
|
|
19
19
|
*/
|
|
20
|
-
export { REGRESSION_SCHEMA_VERSION, defectCaseSchema, defectCorpusSchema, evaluatorFindingSchema, evaluatorOutcomeSchema, evaluatorRunSchema, findingCategory, humanFindingSchema, parseDefectCorpus, parseEvaluatorRun, scopeDimensions, severityLevel, type DefectCase, type DefectCorpus, type EvaluatorFinding, type EvaluatorOutcome, type EvaluatorRun, type HumanFinding, type ScopeDimensions, } from "./corpus.js";
|
|
20
|
+
export { REGRESSION_SCHEMA_VERSION, defectCaseSchema, compareSchemaVersion, defectCorpusSchema, evaluatorFindingSchema, evaluatorOutcomeSchema, evaluatorRunSchema, findingCategory, humanFindingSchema, parseDefectCorpus, parseEvaluatorRun, scopeDimensions, severityLevel, type DefectCase, type DefectCorpus, type EvaluatorFinding, type EvaluatorOutcome, type EvaluatorRun, type HumanFinding, type ScopeDimensions, type SchemaVersionRelation, } from "./corpus.js";
|
|
21
21
|
export { WHOLE_CORPUS_SLICE, deriveScopeSelectors, observedDimensions, scopeKey, scopeLabel, scopeMatches, type ScopeSelector, } from "./scope.js";
|
|
22
22
|
export { DEFAULT_CORRECTION_HARM_WEIGHTS, DEFAULT_PROMOTION_THRESHOLDS, assertPolicyValid, correctionHarm, defaultPromotionPolicy, severityWeight, type CorrectionHarmWeights, type PolicyOrigin, type PromotionPolicy, type PromotionThresholds, type SeverityWeights, } from "./policy.js";
|
|
23
23
|
export { compareRun, type CaseComparison, type CaseVerdict, type CompareOptions, type ComparisonReport, type SliceMetrics, } from "./metrics.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,qBAAqB,GAC3B,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,KAAK,aAAa,GACnB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,+BAA+B,EAC/B,4BAA4B,EAC5B,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,eAAe,GACrB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,KAAK,SAAS,EACd,KAAK,eAAe,GACrB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,eAAe,EACf,8BAA8B,EAC9B,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,YAAY,GAClB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGxF,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* @packageDocumentation
|
|
19
19
|
*/
|
|
20
20
|
// --- Defect corpus (§12.1, §12.3, §24) --------------------------------------------------------
|
|
21
|
-
export { REGRESSION_SCHEMA_VERSION, defectCaseSchema, defectCorpusSchema, evaluatorFindingSchema, evaluatorOutcomeSchema, evaluatorRunSchema, findingCategory, humanFindingSchema, parseDefectCorpus, parseEvaluatorRun, scopeDimensions, severityLevel, } from "./corpus.js";
|
|
21
|
+
export { REGRESSION_SCHEMA_VERSION, defectCaseSchema, compareSchemaVersion, defectCorpusSchema, evaluatorFindingSchema, evaluatorOutcomeSchema, evaluatorRunSchema, findingCategory, humanFindingSchema, parseDefectCorpus, parseEvaluatorRun, scopeDimensions, severityLevel, } from "./corpus.js";
|
|
22
22
|
// --- Scope slicing (§12.1) --------------------------------------------------------------------
|
|
23
23
|
export { WHOLE_CORPUS_SLICE, deriveScopeSelectors, observedDimensions, scopeKey, scopeLabel, scopeMatches, } from "./scope.js";
|
|
24
24
|
// --- Promotion policy (§12.1, §25.9; ADR-0010) ------------------------------------------------
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,iGAAiG;AACjG,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,aAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,iGAAiG;AACjG,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,aAAa,GASd,MAAM,aAAa,CAAC;AAErB,iGAAiG;AACjG,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,QAAQ,EACR,UAAU,EACV,YAAY,GAEb,MAAM,YAAY,CAAC;AAEpB,iGAAiG;AACjG,OAAO,EACL,+BAA+B,EAC/B,4BAA4B,EAC5B,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,cAAc,GAMf,MAAM,aAAa,CAAC;AAErB,iGAAiG;AACjG,OAAO,EACL,UAAU,GAMX,MAAM,cAAc,CAAC;AAEtB,iGAAiG;AACjG,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,GAGhB,MAAM,iBAAiB,CAAC;AAEzB,iGAAiG;AACjG,OAAO,EACL,eAAe,EACf,8BAA8B,GAK/B,MAAM,gBAAgB,CAAC;AAExB,iGAAiG;AACjG,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAExF,iGAAiG;AACjG,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAA4B,MAAM,aAAa,CAAC"}
|
package/dist/metrics.d.ts
CHANGED
|
@@ -44,6 +44,19 @@ export interface CaseComparison {
|
|
|
44
44
|
* negative — it did catch the case — but a promotion reader should see it.
|
|
45
45
|
*/
|
|
46
46
|
categoryMismatch: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Whether site-level comparison means anything for this case (#140).
|
|
49
|
+
*
|
|
50
|
+
* `false` when the evaluator flagged without enumerating what it found — a wrapped legacy
|
|
51
|
+
* evaluator reporting that it had something to say, and nothing about how much or where.
|
|
52
|
+
*
|
|
53
|
+
* The case-level verdict is still sound: a flag is a flag, and §12's precision and recall over
|
|
54
|
+
* *cases* are computable. What is not computable is anything per site, and the previous code
|
|
55
|
+
* quietly answered it anyway — with no evaluator categories to compare, `categoryMismatch` came
|
|
56
|
+
* out `false`, which reads as *the categories agreed*. An evaluator nobody measured would have
|
|
57
|
+
* scored a clean sheet.
|
|
58
|
+
*/
|
|
59
|
+
siteMetricsMeasurable: boolean;
|
|
47
60
|
/** Harm a spurious flag would cause here; zero unless this is a false positive. */
|
|
48
61
|
unnecessaryCorrectionHarm: number;
|
|
49
62
|
}
|
|
@@ -68,6 +81,14 @@ export interface SliceMetrics {
|
|
|
68
81
|
trueNegatives: number;
|
|
69
82
|
/** True positives found under the wrong category (contract §12.3). */
|
|
70
83
|
categoryMismatches: number;
|
|
84
|
+
/**
|
|
85
|
+
* Cases whose site-level metrics are unmeasurable (#140).
|
|
86
|
+
*
|
|
87
|
+
* Reported rather than folded in, because a slice where this is large is a slice whose
|
|
88
|
+
* category agreement means much less than the other numbers suggest. Zero is the honest value
|
|
89
|
+
* only when it is true.
|
|
90
|
+
*/
|
|
91
|
+
unmeasurableSiteMetrics: number;
|
|
71
92
|
/** `truePositives / defectiveCases`; `undefined` when there are no defective cases. */
|
|
72
93
|
recall: number | undefined;
|
|
73
94
|
/** `falsePositives / cleanCases`; `undefined` when there are no clean cases. */
|
package/dist/metrics.d.ts.map
CHANGED
|
@@ -1 +1 @@
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
39
39
|
severity: entry.severity,
|
|
40
40
|
severityWeight: weight,
|
|
41
41
|
categoryMismatch,
|
|
42
|
+
// A flag with nothing enumerated. Not a contradiction to be repaired by inventing a finding —
|
|
43
|
+
// that would make one report count as one defect, which is exactly the statistic #140 exists
|
|
44
|
+
// to protect.
|
|
45
|
+
siteMetricsMeasurable: outcome?.siteMetricsMeasurable ?? !(flagged && (outcome?.findings ?? []).length === 0),
|
|
42
46
|
unnecessaryCorrectionHarm: harm,
|
|
43
47
|
};
|
|
44
48
|
}
|
|
@@ -72,6 +76,8 @@ function summarise(selector, comparisons, labellers) {
|
|
|
72
76
|
falsePositives,
|
|
73
77
|
trueNegatives,
|
|
74
78
|
categoryMismatches: comparisons.filter((comparison) => comparison.categoryMismatch).length,
|
|
79
|
+
unmeasurableSiteMetrics: comparisons.filter((comparison) => !comparison.siteMetricsMeasurable)
|
|
80
|
+
.length,
|
|
75
81
|
recall: defectiveCases === 0 ? undefined : truePositives / defectiveCases,
|
|
76
82
|
falsePositiveRate: cleanCases === 0 ? undefined : falsePositives / cleanCases,
|
|
77
83
|
severityWeightedRecall: defectiveWeight === 0 ? undefined : caughtWeight / defectiveWeight,
|
package/dist/metrics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAwB,MAAM,aAAa,CAAC;AACnF,OAAO,EACL,oBAAoB,EACpB,QAAQ,EACR,YAAY,EACZ,kBAAkB,GAEnB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAA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vB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;QACtC,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,WAAW,EAAE,SAAS,CAAC,kBAAkB,EAAE,WAAW,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACnF,MAAM;QACN,WAAW;QACX,kBAAkB,EAAE,MAAM,CAAC,KAAK;aAC7B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aACrD,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;KAChC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aldus-runtime/regression",
|
|
3
|
-
"version": "0.2.0-next.
|
|
3
|
+
"version": "0.2.0-next.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Aldus Regression Harness — defect corpora, scope-aware evaluator metrics, blind-spot registry, and evaluator promotion evidence.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"typecheck:test": "tsc -p tsconfig.test.json"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@aldus-runtime/core": "0.2.0-next.
|
|
36
|
+
"@aldus-runtime/core": "0.2.0-next.21",
|
|
37
37
|
"zod": "^4.4.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@aldus-runtime/testkit": "0.2.0-next.
|
|
40
|
+
"@aldus-runtime/testkit": "0.2.0-next.21",
|
|
41
41
|
"@types/node": "^26.2.0",
|
|
42
42
|
"typescript": "^7.0.2",
|
|
43
43
|
"vitest": "^4.1.10"
|
package/src/corpus.ts
CHANGED
|
@@ -156,6 +156,11 @@ export const defectCorpusSchema = z
|
|
|
156
156
|
/** The labelled cases. */
|
|
157
157
|
cases: z.array(defectCaseSchema).max(100_000),
|
|
158
158
|
})
|
|
159
|
+
// Strict: an unknown key is refused, not stripped. Without this a record from a later runtime
|
|
160
|
+
// parses and its added fields vanish, handing the caller an object that looks complete and is
|
|
161
|
+
// not. See SCHEMA_VERSION_UNSUPPORTED — the version check and this are the same guarantee, one
|
|
162
|
+
// for a declared newer version and one for an undeclared newer shape.
|
|
163
|
+
.strict()
|
|
159
164
|
.meta({
|
|
160
165
|
id: "DefectCorpus",
|
|
161
166
|
title: "DefectCorpus",
|
|
@@ -190,8 +195,27 @@ export const evaluatorOutcomeSchema = z
|
|
|
190
195
|
caseId: identifier,
|
|
191
196
|
/** Whether the evaluator flagged the subject. */
|
|
192
197
|
flagged: z.boolean(),
|
|
193
|
-
/**
|
|
198
|
+
/**
|
|
199
|
+
* The defect occurrences it enumerated. Empty when not flagged, **and also empty when the
|
|
200
|
+
* evaluator flagged without enumerating** (#140).
|
|
201
|
+
*
|
|
202
|
+
* An empty list under `flagged: true` is therefore not a contradiction and must not be
|
|
203
|
+
* repaired by inventing an entry. A wrapped legacy evaluator reports that it had something to
|
|
204
|
+
* say and not how much; fabricating one finding would make its report count as one defect,
|
|
205
|
+
* which is the statistic this distinction exists to protect.
|
|
206
|
+
*/
|
|
194
207
|
findings: z.array(evaluatorFindingSchema).max(256),
|
|
208
|
+
/**
|
|
209
|
+
* Whether site-level metrics are computable for this case (#140).
|
|
210
|
+
*
|
|
211
|
+
* `false` when the evaluator flagged without enumerating, or when a report could not be mapped
|
|
212
|
+
* to this case's subject scope at all. Site-level precision and recall are then **unmeasurable
|
|
213
|
+
* rather than zero**, and a metric that silently treated an unenumerated flag as zero findings
|
|
214
|
+
* would report perfect precision for an evaluator nobody measured.
|
|
215
|
+
*
|
|
216
|
+
* Absent means measurable, which is what every record written before this field meant.
|
|
217
|
+
*/
|
|
218
|
+
siteMetricsMeasurable: z.boolean().optional(),
|
|
195
219
|
})
|
|
196
220
|
.meta({ id: "EvaluatorOutcome", title: "EvaluatorOutcome" });
|
|
197
221
|
|
|
@@ -219,6 +243,7 @@ export const evaluatorRunSchema = z
|
|
|
219
243
|
/** When the run was executed. */
|
|
220
244
|
executedAt: z.iso.datetime({ offset: true }),
|
|
221
245
|
})
|
|
246
|
+
.strict()
|
|
222
247
|
.meta({
|
|
223
248
|
id: "EvaluatorRun",
|
|
224
249
|
title: "EvaluatorRun",
|
|
@@ -234,6 +259,70 @@ export type EvaluatorRun = z.infer<typeof evaluatorRunSchema>;
|
|
|
234
259
|
/** Schema version this package stamps on records it constructs. */
|
|
235
260
|
export const REGRESSION_SCHEMA_VERSION = SCHEMA_VERSION;
|
|
236
261
|
|
|
262
|
+
/** How a record's declared schema version relates to the one this runtime implements. */
|
|
263
|
+
export type SchemaVersionRelation = "older" | "same" | "newer";
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Compare a record's declared schema version against {@link REGRESSION_SCHEMA_VERSION}.
|
|
267
|
+
*
|
|
268
|
+
* Exported because the two directions are not the same kind of question. **Newer** is soundness
|
|
269
|
+
* and belongs here: this runtime cannot know what a later version's fields mean, so it refuses.
|
|
270
|
+
* **Older** is policy and belongs to the caller — whether a run from an earlier version is
|
|
271
|
+
* comparable to today's depends on what changed between them, which this package cannot know
|
|
272
|
+
* either. What it can do is stop every caller reimplementing the comparison, which is the part
|
|
273
|
+
* that would drift.
|
|
274
|
+
*
|
|
275
|
+
* A record must be readable in order to be upgraded, so this is deliberately a question a caller
|
|
276
|
+
* can ask *before* parsing, and an older record still parses.
|
|
277
|
+
*
|
|
278
|
+
* @param recordVersion - The `schemaVersion` field of a record, `MAJOR.MINOR` (ADR-0003).
|
|
279
|
+
* @throws {AldusError} `ALDUS_CORPUS_MALFORMED` if `recordVersion` is not `MAJOR.MINOR`.
|
|
280
|
+
*/
|
|
281
|
+
export function compareSchemaVersion(recordVersion: string): SchemaVersionRelation {
|
|
282
|
+
const parse = (value: string): readonly [number, number] => {
|
|
283
|
+
const match = /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(value);
|
|
284
|
+
if (match === null) {
|
|
285
|
+
// Path and code only — never the received value (contract §19.2).
|
|
286
|
+
throw regressionError(
|
|
287
|
+
RegressionErrorCodes.CORPUS_MALFORMED,
|
|
288
|
+
"A schema version must be MAJOR.MINOR.",
|
|
289
|
+
{
|
|
290
|
+
category: "validation",
|
|
291
|
+
details: { issues: [{ path: "schemaVersion", code: "invalid_format" }] },
|
|
292
|
+
},
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
return [Number(match[1]), Number(match[2])] as const;
|
|
296
|
+
};
|
|
297
|
+
const [recordMajor, recordMinor] = parse(recordVersion);
|
|
298
|
+
const [runtimeMajor, runtimeMinor] = parse(REGRESSION_SCHEMA_VERSION);
|
|
299
|
+
if (recordMajor !== runtimeMajor) return recordMajor > runtimeMajor ? "newer" : "older";
|
|
300
|
+
if (recordMinor !== runtimeMinor) return recordMinor > runtimeMinor ? "newer" : "older";
|
|
301
|
+
return "same";
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Refuse a record declaring a version this runtime does not implement.
|
|
306
|
+
*
|
|
307
|
+
* Only `newer` is refused. An older record parses, and {@link compareSchemaVersion} is how a
|
|
308
|
+
* caller decides whether to trust it.
|
|
309
|
+
*/
|
|
310
|
+
function assertSchemaVersionSupported(recordVersion: string, record: "corpus" | "run"): void {
|
|
311
|
+
if (compareSchemaVersion(recordVersion) !== "newer") return;
|
|
312
|
+
throw regressionError(
|
|
313
|
+
RegressionErrorCodes.SCHEMA_VERSION_UNSUPPORTED,
|
|
314
|
+
`A ${record} declares a schema version newer than this runtime implements. Its fields cannot ` +
|
|
315
|
+
"be interpreted here, and the schema discards what it does not declare, so accepting it " +
|
|
316
|
+
"would return a record that looks complete and is not.",
|
|
317
|
+
{
|
|
318
|
+
category: "validation",
|
|
319
|
+
// The runtime's own version is this package's constant, not received input, so naming it is
|
|
320
|
+
// not a value leak. The record's version is not named (contract §19.2).
|
|
321
|
+
details: { runtimeSchemaVersion: REGRESSION_SCHEMA_VERSION, relation: "newer" },
|
|
322
|
+
},
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
|
|
237
326
|
/**
|
|
238
327
|
* Validate a corpus and check the uniqueness constraint Zod cannot express.
|
|
239
328
|
*
|
|
@@ -258,6 +347,8 @@ export function parseDefectCorpus(input: unknown): DefectCorpus {
|
|
|
258
347
|
);
|
|
259
348
|
}
|
|
260
349
|
|
|
350
|
+
assertSchemaVersionSupported(result.data.schemaVersion, "corpus");
|
|
351
|
+
|
|
261
352
|
const seen = new Set<string>();
|
|
262
353
|
for (const entry of result.data.cases) {
|
|
263
354
|
if (seen.has(entry.caseId)) {
|
|
@@ -296,6 +387,8 @@ export function parseEvaluatorRun(input: unknown): EvaluatorRun {
|
|
|
296
387
|
);
|
|
297
388
|
}
|
|
298
389
|
|
|
390
|
+
assertSchemaVersionSupported(result.data.schemaVersion, "run");
|
|
391
|
+
|
|
299
392
|
const seen = new Set<string>();
|
|
300
393
|
for (const outcome of result.data.outcomes) {
|
|
301
394
|
if (seen.has(outcome.caseId)) {
|
package/src/errors.ts
CHANGED
|
@@ -34,6 +34,16 @@ export const RegressionErrorCodes = {
|
|
|
34
34
|
BLIND_SPOT_DUPLICATE: "ALDUS_BLIND_SPOT_DUPLICATE",
|
|
35
35
|
/** A promotion policy is internally inconsistent — a threshold outside its valid range. */
|
|
36
36
|
POLICY_INVALID: "ALDUS_POLICY_INVALID",
|
|
37
|
+
/**
|
|
38
|
+
* A record declares a schema version newer than this runtime implements.
|
|
39
|
+
*
|
|
40
|
+
* Refused rather than accepted, because this runtime cannot know what a later version's fields
|
|
41
|
+
* mean and the schemas discard what they do not declare. Accepting one returns an object that
|
|
42
|
+
* looks complete and is not — a read path answering wrongly with no signal, which is worse than
|
|
43
|
+
* refusing. Whether an *older* record is comparable is the caller's policy, not this package's:
|
|
44
|
+
* see `compareSchemaVersion`.
|
|
45
|
+
*/
|
|
46
|
+
SCHEMA_VERSION_UNSUPPORTED: "ALDUS_SCHEMA_VERSION_UNSUPPORTED",
|
|
37
47
|
} as const;
|
|
38
48
|
|
|
39
49
|
/** @see RegressionErrorCodes */
|
package/src/index.ts
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
export {
|
|
23
23
|
REGRESSION_SCHEMA_VERSION,
|
|
24
24
|
defectCaseSchema,
|
|
25
|
+
compareSchemaVersion,
|
|
25
26
|
defectCorpusSchema,
|
|
26
27
|
evaluatorFindingSchema,
|
|
27
28
|
evaluatorOutcomeSchema,
|
|
@@ -39,6 +40,7 @@ export {
|
|
|
39
40
|
type EvaluatorRun,
|
|
40
41
|
type HumanFinding,
|
|
41
42
|
type ScopeDimensions,
|
|
43
|
+
type SchemaVersionRelation,
|
|
42
44
|
} from "./corpus.js";
|
|
43
45
|
|
|
44
46
|
// --- Scope slicing (§12.1) --------------------------------------------------------------------
|
package/src/metrics.ts
CHANGED
|
@@ -54,6 +54,19 @@ export interface CaseComparison {
|
|
|
54
54
|
* negative — it did catch the case — but a promotion reader should see it.
|
|
55
55
|
*/
|
|
56
56
|
categoryMismatch: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Whether site-level comparison means anything for this case (#140).
|
|
59
|
+
*
|
|
60
|
+
* `false` when the evaluator flagged without enumerating what it found — a wrapped legacy
|
|
61
|
+
* evaluator reporting that it had something to say, and nothing about how much or where.
|
|
62
|
+
*
|
|
63
|
+
* The case-level verdict is still sound: a flag is a flag, and §12's precision and recall over
|
|
64
|
+
* *cases* are computable. What is not computable is anything per site, and the previous code
|
|
65
|
+
* quietly answered it anyway — with no evaluator categories to compare, `categoryMismatch` came
|
|
66
|
+
* out `false`, which reads as *the categories agreed*. An evaluator nobody measured would have
|
|
67
|
+
* scored a clean sheet.
|
|
68
|
+
*/
|
|
69
|
+
siteMetricsMeasurable: boolean;
|
|
57
70
|
/** Harm a spurious flag would cause here; zero unless this is a false positive. */
|
|
58
71
|
unnecessaryCorrectionHarm: number;
|
|
59
72
|
}
|
|
@@ -79,6 +92,14 @@ export interface SliceMetrics {
|
|
|
79
92
|
trueNegatives: number;
|
|
80
93
|
/** True positives found under the wrong category (contract §12.3). */
|
|
81
94
|
categoryMismatches: number;
|
|
95
|
+
/**
|
|
96
|
+
* Cases whose site-level metrics are unmeasurable (#140).
|
|
97
|
+
*
|
|
98
|
+
* Reported rather than folded in, because a slice where this is large is a slice whose
|
|
99
|
+
* category agreement means much less than the other numbers suggest. Zero is the honest value
|
|
100
|
+
* only when it is true.
|
|
101
|
+
*/
|
|
102
|
+
unmeasurableSiteMetrics: number;
|
|
82
103
|
/** `truePositives / defectiveCases`; `undefined` when there are no defective cases. */
|
|
83
104
|
recall: number | undefined;
|
|
84
105
|
/** `falsePositives / cleanCases`; `undefined` when there are no clean cases. */
|
|
@@ -159,6 +180,11 @@ function compareCase(
|
|
|
159
180
|
severity: entry.severity,
|
|
160
181
|
severityWeight: weight,
|
|
161
182
|
categoryMismatch,
|
|
183
|
+
// A flag with nothing enumerated. Not a contradiction to be repaired by inventing a finding —
|
|
184
|
+
// that would make one report count as one defect, which is exactly the statistic #140 exists
|
|
185
|
+
// to protect.
|
|
186
|
+
siteMetricsMeasurable:
|
|
187
|
+
outcome?.siteMetricsMeasurable ?? !(flagged && (outcome?.findings ?? []).length === 0),
|
|
162
188
|
unnecessaryCorrectionHarm: harm,
|
|
163
189
|
};
|
|
164
190
|
}
|
|
@@ -206,6 +232,8 @@ function summarise(
|
|
|
206
232
|
falsePositives,
|
|
207
233
|
trueNegatives,
|
|
208
234
|
categoryMismatches: comparisons.filter((comparison) => comparison.categoryMismatch).length,
|
|
235
|
+
unmeasurableSiteMetrics: comparisons.filter((comparison) => !comparison.siteMetricsMeasurable)
|
|
236
|
+
.length,
|
|
209
237
|
recall: defectiveCases === 0 ? undefined : truePositives / defectiveCases,
|
|
210
238
|
falsePositiveRate: cleanCases === 0 ? undefined : falsePositives / cleanCases,
|
|
211
239
|
severityWeightedRecall: defectiveWeight === 0 ? undefined : caughtWeight / defectiveWeight,
|