@aldus-runtime/regression 0.2.0-next.20 → 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 +22 -3
- package/dist/corpus.d.ts.map +1 -1
- package/dist/corpus.js +62 -0
- 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/package.json +4 -4
- package/src/corpus.ts +74 -0
- package/src/errors.ts +10 -0
- package/src/index.ts +2 -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. */
|
|
@@ -166,11 +166,30 @@ export declare const evaluatorRunSchema: z.ZodObject<{
|
|
|
166
166
|
siteMetricsMeasurable: z.ZodOptional<z.ZodBoolean>;
|
|
167
167
|
}, z.core.$strip>>;
|
|
168
168
|
executedAt: z.ZodISODateTime;
|
|
169
|
-
}, z.core.$
|
|
169
|
+
}, z.core.$strict>;
|
|
170
170
|
/** @see evaluatorRunSchema */
|
|
171
171
|
export type EvaluatorRun = z.infer<typeof evaluatorRunSchema>;
|
|
172
172
|
/** Schema version this package stamps on records it constructs. */
|
|
173
|
-
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;
|
|
174
193
|
/**
|
|
175
194
|
* Validate a corpus and check the uniqueness constraint Zod cannot express.
|
|
176
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,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AgD;AAChD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAuB3B,CAAC;AAEL,8BAA8B;AAC9B,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,yCAAyC;AACzC,eAAO,MAAM,sBAAsB;;;;iBAS2B,CAAC;AAE/D,kCAAkC;AAClC,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,6CAA6C;AAC7C,eAAO,MAAM,sBAAsB;;;;;;;;;iBA4B2B,CAAC;AAE/D,kCAAkC;AAClC,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;kBAuB3B,CAAC;AAEL,8BAA8B;AAC9B,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;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",
|
|
@@ -205,6 +210,7 @@ export const evaluatorRunSchema = z
|
|
|
205
210
|
/** When the run was executed. */
|
|
206
211
|
executedAt: z.iso.datetime({ offset: true }),
|
|
207
212
|
})
|
|
213
|
+
.strict()
|
|
208
214
|
.meta({
|
|
209
215
|
id: "EvaluatorRun",
|
|
210
216
|
title: "EvaluatorRun",
|
|
@@ -214,6 +220,60 @@ export const evaluatorRunSchema = z
|
|
|
214
220
|
});
|
|
215
221
|
/** Schema version this package stamps on records it constructs. */
|
|
216
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
|
+
}
|
|
217
277
|
/**
|
|
218
278
|
* Validate a corpus and check the uniqueness constraint Zod cannot express.
|
|
219
279
|
*
|
|
@@ -233,6 +293,7 @@ export function parseDefectCorpus(input) {
|
|
|
233
293
|
},
|
|
234
294
|
});
|
|
235
295
|
}
|
|
296
|
+
assertSchemaVersionSupported(result.data.schemaVersion, "corpus");
|
|
236
297
|
const seen = new Set();
|
|
237
298
|
for (const entry of result.data.cases) {
|
|
238
299
|
if (seen.has(entry.caseId)) {
|
|
@@ -261,6 +322,7 @@ export function parseEvaluatorRun(input) {
|
|
|
261
322
|
},
|
|
262
323
|
});
|
|
263
324
|
}
|
|
325
|
+
assertSchemaVersionSupported(result.data.schemaVersion, "run");
|
|
264
326
|
const seen = new Set();
|
|
265
327
|
for (const outcome of result.data.outcomes) {
|
|
266
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;AACjC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC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C;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":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAErE,oDAAoD;AACpD,eAAO,MAAM,oBAAoB;IAC/B,+DAA+D;aAC/D,gBAAgB,EAAE,wBAAwB;IAC1C,gDAAgD;aAChD,qBAAqB,EAAE,6BAA6B;IACpD,8EAA8E;aAC9E,oBAAoB,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C,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;AACpD,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,+DAA+D;IAC/D,gBAAgB,EAAE,wBAAwB;IAC1C,gDAAgD;IAChD,qBAAqB,EAAE,6BAA6B;IACpD,8EAA8E;IAC9E,oBAAoB,EAAE,4BAA4B;IAClD,6DAA6D;IAC7D,iBAAiB,EAAE,yBAAyB;IAC5C;;;;;;OAMG;IACH,mBAAmB,EAAE,2BAA2B;IAChD,mFAAmF;IACnF,2BAA2B,EAAE,mCAAmC;IAChE,6CAA6C;IAC7C,oBAAoB,EAAE,4BAA4B;IAClD,6CAA6C;IAC7C,oBAAoB,EAAE,4BAA4B;IAClD,2FAA2F;IAC3F,cAAc,EAAE,sBAAsB;
|
|
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;AACpD,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,+DAA+D;IAC/D,gBAAgB,EAAE,wBAAwB;IAC1C,gDAAgD;IAChD,qBAAqB,EAAE,6BAA6B;IACpD,8EAA8E;IAC9E,oBAAoB,EAAE,4BAA4B;IAClD,6DAA6D;IAC7D,iBAAiB,EAAE,yBAAyB;IAC5C;;;;;;OAMG;IACH,mBAAmB,EAAE,2BAA2B;IAChD,mFAAmF;IACnF,2BAA2B,EAAE,mCAAmC;IAChE,6CAA6C;IAC7C,oBAAoB,EAAE,4BAA4B;IAClD,6CAA6C;IAC7C,oBAAoB,EAAE,4BAA4B;IAClD,2FAA2F;IAC3F,cAAc,EAAE,sBAAsB;IACtC;;;;;;;;OAQG;IACH,0BAA0B,EAAE,kCAAkC;CACtD,CAAC;AAKX,sEAAsE;AACtE,MAAM,UAAU,eAAe,CAC7B,IAAyB,EACzB,OAAe,EACf,OAA4F;IAE5F,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,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/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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
|
-
"description": "Aldus Regression Harness
|
|
5
|
+
"description": "Aldus Regression Harness — defect corpora, scope-aware evaluator metrics, blind-spot registry, and evaluator promotion evidence.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -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",
|
|
@@ -238,6 +243,7 @@ export const evaluatorRunSchema = z
|
|
|
238
243
|
/** When the run was executed. */
|
|
239
244
|
executedAt: z.iso.datetime({ offset: true }),
|
|
240
245
|
})
|
|
246
|
+
.strict()
|
|
241
247
|
.meta({
|
|
242
248
|
id: "EvaluatorRun",
|
|
243
249
|
title: "EvaluatorRun",
|
|
@@ -253,6 +259,70 @@ export type EvaluatorRun = z.infer<typeof evaluatorRunSchema>;
|
|
|
253
259
|
/** Schema version this package stamps on records it constructs. */
|
|
254
260
|
export const REGRESSION_SCHEMA_VERSION = SCHEMA_VERSION;
|
|
255
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
|
+
|
|
256
326
|
/**
|
|
257
327
|
* Validate a corpus and check the uniqueness constraint Zod cannot express.
|
|
258
328
|
*
|
|
@@ -277,6 +347,8 @@ export function parseDefectCorpus(input: unknown): DefectCorpus {
|
|
|
277
347
|
);
|
|
278
348
|
}
|
|
279
349
|
|
|
350
|
+
assertSchemaVersionSupported(result.data.schemaVersion, "corpus");
|
|
351
|
+
|
|
280
352
|
const seen = new Set<string>();
|
|
281
353
|
for (const entry of result.data.cases) {
|
|
282
354
|
if (seen.has(entry.caseId)) {
|
|
@@ -315,6 +387,8 @@ export function parseEvaluatorRun(input: unknown): EvaluatorRun {
|
|
|
315
387
|
);
|
|
316
388
|
}
|
|
317
389
|
|
|
390
|
+
assertSchemaVersionSupported(result.data.schemaVersion, "run");
|
|
391
|
+
|
|
318
392
|
const seen = new Set<string>();
|
|
319
393
|
for (const outcome of result.data.outcomes) {
|
|
320
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) --------------------------------------------------------------------
|