@aldus-runtime/regression 0.2.0-next.56 → 0.2.0-next.58
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 +21 -21
- package/dist/corpus.d.ts.map +1 -1
- package/dist/corpus.js +84 -47
- package/dist/corpus.js.map +1 -1
- package/package.json +3 -3
- package/src/corpus.ts +93 -56
package/dist/corpus.d.ts
CHANGED
|
@@ -19,6 +19,27 @@
|
|
|
19
19
|
* Zod is the single source of truth; TypeScript types are inferred (ADR-0002).
|
|
20
20
|
*/
|
|
21
21
|
import { z } from "zod";
|
|
22
|
+
/** Schema version this package stamps on records it constructs. */
|
|
23
|
+
export declare const REGRESSION_SCHEMA_VERSION = "1.15";
|
|
24
|
+
/** How a record's declared schema version relates to the one this runtime implements. */
|
|
25
|
+
export type SchemaVersionRelation = "older" | "same" | "newer";
|
|
26
|
+
/**
|
|
27
|
+
* Compare a record's declared schema version against {@link REGRESSION_SCHEMA_VERSION}.
|
|
28
|
+
*
|
|
29
|
+
* Exported because the two directions are not the same kind of question. **Newer** is soundness
|
|
30
|
+
* and belongs here: this runtime cannot know what a later version's fields mean, so it refuses.
|
|
31
|
+
* **Older** is policy and belongs to the caller — whether a run from an earlier version is
|
|
32
|
+
* comparable to today's depends on what changed between them, which this package cannot know
|
|
33
|
+
* either. What it can do is stop every caller reimplementing the comparison, which is the part
|
|
34
|
+
* that would drift.
|
|
35
|
+
*
|
|
36
|
+
* A record must be readable in order to be upgraded, so this is deliberately a question a caller
|
|
37
|
+
* can ask *before* parsing, and an older record still parses.
|
|
38
|
+
*
|
|
39
|
+
* @param recordVersion - The `schemaVersion` field of a record, `MAJOR.MINOR` (ADR-0003).
|
|
40
|
+
* @throws {AldusError} `ALDUS_CORPUS_MALFORMED` if `recordVersion` is not `MAJOR.MINOR`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function compareSchemaVersion(recordVersion: string): SchemaVersionRelation;
|
|
22
43
|
/**
|
|
23
44
|
* A finding category, structured per contract §12.3.
|
|
24
45
|
*
|
|
@@ -171,27 +192,6 @@ export declare const evaluatorRunSchema: z.ZodObject<{
|
|
|
171
192
|
}, z.core.$strict>;
|
|
172
193
|
/** @see evaluatorRunSchema */
|
|
173
194
|
export type EvaluatorRun = z.infer<typeof evaluatorRunSchema>;
|
|
174
|
-
/** Schema version this package stamps on records it constructs. */
|
|
175
|
-
export declare const REGRESSION_SCHEMA_VERSION = "1.15";
|
|
176
|
-
/** How a record's declared schema version relates to the one this runtime implements. */
|
|
177
|
-
export type SchemaVersionRelation = "older" | "same" | "newer";
|
|
178
|
-
/**
|
|
179
|
-
* Compare a record's declared schema version against {@link REGRESSION_SCHEMA_VERSION}.
|
|
180
|
-
*
|
|
181
|
-
* Exported because the two directions are not the same kind of question. **Newer** is soundness
|
|
182
|
-
* and belongs here: this runtime cannot know what a later version's fields mean, so it refuses.
|
|
183
|
-
* **Older** is policy and belongs to the caller — whether a run from an earlier version is
|
|
184
|
-
* comparable to today's depends on what changed between them, which this package cannot know
|
|
185
|
-
* either. What it can do is stop every caller reimplementing the comparison, which is the part
|
|
186
|
-
* that would drift.
|
|
187
|
-
*
|
|
188
|
-
* A record must be readable in order to be upgraded, so this is deliberately a question a caller
|
|
189
|
-
* can ask *before* parsing, and an older record still parses.
|
|
190
|
-
*
|
|
191
|
-
* @param recordVersion - The `schemaVersion` field of a record, `MAJOR.MINOR` (ADR-0003).
|
|
192
|
-
* @throws {AldusError} `ALDUS_CORPUS_MALFORMED` if `recordVersion` is not `MAJOR.MINOR`.
|
|
193
|
-
*/
|
|
194
|
-
export declare function compareSchemaVersion(recordVersion: string): SchemaVersionRelation;
|
|
195
195
|
/**
|
|
196
196
|
* Validate a corpus and check the uniqueness constraint Zod cannot express.
|
|
197
197
|
*
|
package/dist/corpus.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"corpus.d.ts","sourceRoot":"","sources":["../src/corpus.ts"],"names":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,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;;;;;;;;;;;;;;;;;kBAyB3B,CAAC;AAEL,8BAA8B;AAC9B,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AA+B9D;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAiC9D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CA+B9D"}
|
package/dist/corpus.js
CHANGED
|
@@ -23,6 +23,73 @@ import { z } from "zod";
|
|
|
23
23
|
import { RegressionErrorCodes, regressionError } from "./errors.js";
|
|
24
24
|
/** A short opaque identifier. */
|
|
25
25
|
const identifier = z.string().min(1).max(200);
|
|
26
|
+
// --- Schema version (ADR-0003, ADR-0053) -----------------------------------------------------
|
|
27
|
+
/** Schema version this package stamps on records it constructs. */
|
|
28
|
+
export const REGRESSION_SCHEMA_VERSION = SCHEMA_VERSION;
|
|
29
|
+
/**
|
|
30
|
+
* Compare a record's declared schema version against {@link REGRESSION_SCHEMA_VERSION}.
|
|
31
|
+
*
|
|
32
|
+
* Exported because the two directions are not the same kind of question. **Newer** is soundness
|
|
33
|
+
* and belongs here: this runtime cannot know what a later version's fields mean, so it refuses.
|
|
34
|
+
* **Older** is policy and belongs to the caller — whether a run from an earlier version is
|
|
35
|
+
* comparable to today's depends on what changed between them, which this package cannot know
|
|
36
|
+
* either. What it can do is stop every caller reimplementing the comparison, which is the part
|
|
37
|
+
* that would drift.
|
|
38
|
+
*
|
|
39
|
+
* A record must be readable in order to be upgraded, so this is deliberately a question a caller
|
|
40
|
+
* can ask *before* parsing, and an older record still parses.
|
|
41
|
+
*
|
|
42
|
+
* @param recordVersion - The `schemaVersion` field of a record, `MAJOR.MINOR` (ADR-0003).
|
|
43
|
+
* @throws {AldusError} `ALDUS_CORPUS_MALFORMED` if `recordVersion` is not `MAJOR.MINOR`.
|
|
44
|
+
*/
|
|
45
|
+
export function compareSchemaVersion(recordVersion) {
|
|
46
|
+
const parse = (value) => {
|
|
47
|
+
const match = /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(value);
|
|
48
|
+
if (match === null) {
|
|
49
|
+
// Path and code only — never the received value (contract §19.2).
|
|
50
|
+
throw regressionError(RegressionErrorCodes.CORPUS_MALFORMED, "A schema version must be MAJOR.MINOR.", {
|
|
51
|
+
category: "validation",
|
|
52
|
+
details: { issues: [{ path: "schemaVersion", code: "invalid_format" }] },
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return [Number(match[1]), Number(match[2])];
|
|
56
|
+
};
|
|
57
|
+
const [recordMajor, recordMinor] = parse(recordVersion);
|
|
58
|
+
const [runtimeMajor, runtimeMinor] = parse(REGRESSION_SCHEMA_VERSION);
|
|
59
|
+
if (recordMajor !== runtimeMajor)
|
|
60
|
+
return recordMajor > runtimeMajor ? "newer" : "older";
|
|
61
|
+
if (recordMinor !== runtimeMinor)
|
|
62
|
+
return recordMinor > runtimeMinor ? "newer" : "older";
|
|
63
|
+
return "same";
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* True when `value` is a well-formed version this runtime does not implement.
|
|
67
|
+
*
|
|
68
|
+
* A malformed value answers `false` rather than throwing, so the format check that owns that
|
|
69
|
+
* failure reports it under its own code and the version rule fires only on a version.
|
|
70
|
+
*/
|
|
71
|
+
function declaresNewerVersion(value) {
|
|
72
|
+
return /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(value) && compareSchemaVersion(value) === "newer";
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The `schemaVersion` field of a record this package reads.
|
|
76
|
+
*
|
|
77
|
+
* **The exported schema carries the rule** (ADR-0053). `parseDefectCorpus` and `parseEvaluatorRun`
|
|
78
|
+
* refused a newer record while `defectCorpusSchema.safeParse` and `evaluatorRunSchema.safeParse`
|
|
79
|
+
* accepted the same bytes — a rule enforced at one entry point and not the other is a rule plus a
|
|
80
|
+
* bypass, and the exported object is the obvious door (#199). So the refusal lives on the field, and
|
|
81
|
+
* the parse functions check it first only so that a newer record fails with one clear
|
|
82
|
+
* `ALDUS_SCHEMA_VERSION_UNSUPPORTED` rather than a field issue about the version.
|
|
83
|
+
*
|
|
84
|
+
* This is **this package's** rule, not Core's: any newer version is refused, minor included, because
|
|
85
|
+
* these schemas are strict and a newer minor would fail on its added keys anyway. Refusing on the
|
|
86
|
+
* version names the reason. Core's records accept a newer minor and report it as a `forward` read
|
|
87
|
+
* (ADR-0003, ADR-0053).
|
|
88
|
+
*/
|
|
89
|
+
const recordSchemaVersion = schemaVersionString.refine((value) => !declaresNewerVersion(value), {
|
|
90
|
+
// Names this package's own constant, never the received value (contract §19.2).
|
|
91
|
+
message: `Schema version must not be newer than ${REGRESSION_SCHEMA_VERSION}, which is what this runtime implements.`,
|
|
92
|
+
});
|
|
26
93
|
/**
|
|
27
94
|
* A finding category, structured per contract §12.3.
|
|
28
95
|
*
|
|
@@ -128,7 +195,7 @@ export const defectCaseSchema = z
|
|
|
128
195
|
export const defectCorpusSchema = z
|
|
129
196
|
.object({
|
|
130
197
|
/** Schema version of this record (ADR-0003). */
|
|
131
|
-
schemaVersion:
|
|
198
|
+
schemaVersion: recordSchemaVersion,
|
|
132
199
|
/** Identity of this corpus. */
|
|
133
200
|
corpusId: identifier,
|
|
134
201
|
/** Human-readable purpose. */
|
|
@@ -217,7 +284,7 @@ export const evaluatorOutcomeSchema = z
|
|
|
217
284
|
export const evaluatorRunSchema = z
|
|
218
285
|
.object({
|
|
219
286
|
/** Schema version of this record (ADR-0003). */
|
|
220
|
-
schemaVersion:
|
|
287
|
+
schemaVersion: recordSchemaVersion,
|
|
221
288
|
/** Which evaluator produced these outcomes. */
|
|
222
289
|
evaluatorId: identifier,
|
|
223
290
|
/** Version of the evaluator. Metrics from different versions are not comparable. */
|
|
@@ -239,56 +306,26 @@ export const evaluatorRunSchema = z
|
|
|
239
306
|
"package consumes runs; it does not execute evaluators. ADDITIONAL CONSTRAINT NOT " +
|
|
240
307
|
"EXPRESSIBLE IN JSON SCHEMA: `caseId` must be unique within `outcomes`.",
|
|
241
308
|
});
|
|
242
|
-
/** Schema version this package stamps on records it constructs. */
|
|
243
|
-
export const REGRESSION_SCHEMA_VERSION = SCHEMA_VERSION;
|
|
244
309
|
/**
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
* Exported because the two directions are not the same kind of question. **Newer** is soundness
|
|
248
|
-
* and belongs here: this runtime cannot know what a later version's fields mean, so it refuses.
|
|
249
|
-
* **Older** is policy and belongs to the caller — whether a run from an earlier version is
|
|
250
|
-
* comparable to today's depends on what changed between them, which this package cannot know
|
|
251
|
-
* either. What it can do is stop every caller reimplementing the comparison, which is the part
|
|
252
|
-
* that would drift.
|
|
253
|
-
*
|
|
254
|
-
* A record must be readable in order to be upgraded, so this is deliberately a question a caller
|
|
255
|
-
* can ask *before* parsing, and an older record still parses.
|
|
256
|
-
*
|
|
257
|
-
* @param recordVersion - The `schemaVersion` field of a record, `MAJOR.MINOR` (ADR-0003).
|
|
258
|
-
* @throws {AldusError} `ALDUS_CORPUS_MALFORMED` if `recordVersion` is not `MAJOR.MINOR`.
|
|
259
|
-
*/
|
|
260
|
-
export function compareSchemaVersion(recordVersion) {
|
|
261
|
-
const parse = (value) => {
|
|
262
|
-
const match = /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(value);
|
|
263
|
-
if (match === null) {
|
|
264
|
-
// Path and code only — never the received value (contract §19.2).
|
|
265
|
-
throw regressionError(RegressionErrorCodes.CORPUS_MALFORMED, "A schema version must be MAJOR.MINOR.", {
|
|
266
|
-
category: "validation",
|
|
267
|
-
details: { issues: [{ path: "schemaVersion", code: "invalid_format" }] },
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
return [Number(match[1]), Number(match[2])];
|
|
271
|
-
};
|
|
272
|
-
const [recordMajor, recordMinor] = parse(recordVersion);
|
|
273
|
-
const [runtimeMajor, runtimeMinor] = parse(REGRESSION_SCHEMA_VERSION);
|
|
274
|
-
if (recordMajor !== runtimeMajor)
|
|
275
|
-
return recordMajor > runtimeMajor ? "newer" : "older";
|
|
276
|
-
if (recordMinor !== runtimeMinor)
|
|
277
|
-
return recordMinor > runtimeMinor ? "newer" : "older";
|
|
278
|
-
return "same";
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Refuse a record declaring a version this runtime does not implement.
|
|
310
|
+
* Refuse a record declaring a version this runtime does not implement, **before** its shape is
|
|
311
|
+
* read.
|
|
282
312
|
*
|
|
283
313
|
* Only `newer` is refused. An older record parses, and {@link compareSchemaVersion} is how a
|
|
284
314
|
* caller decides whether to trust it.
|
|
315
|
+
*
|
|
316
|
+
* Version before fields, for the same reason Core's `validateRecord` orders them so: a newer record
|
|
317
|
+
* fails with one `ALDUS_SCHEMA_VERSION_UNSUPPORTED` that names the cause, rather than a field issue
|
|
318
|
+
* that describes the symptom. A missing or malformed version is not this check's to report — it
|
|
319
|
+
* falls through, and the schema reports it precisely under `ALDUS_CORPUS_MALFORMED`.
|
|
285
320
|
*/
|
|
286
|
-
function assertSchemaVersionSupported(
|
|
287
|
-
if (
|
|
321
|
+
function assertSchemaVersionSupported(input, record) {
|
|
322
|
+
if (typeof input !== "object" || input === null)
|
|
323
|
+
return;
|
|
324
|
+
const declared = input.schemaVersion;
|
|
325
|
+
if (typeof declared !== "string" || !declaresNewerVersion(declared))
|
|
288
326
|
return;
|
|
289
327
|
throw regressionError(RegressionErrorCodes.SCHEMA_VERSION_UNSUPPORTED, `A ${record} declares a schema version newer than this runtime implements. Its fields cannot ` +
|
|
290
|
-
"be interpreted here,
|
|
291
|
-
"would return a record that looks complete and is not.", {
|
|
328
|
+
"be interpreted here, so accepting it would return a record that looks complete and is not.", {
|
|
292
329
|
category: "validation",
|
|
293
330
|
// The runtime's own version is this package's constant, not received input, so naming it is
|
|
294
331
|
// not a value leak. The record's version is not named (contract §19.2).
|
|
@@ -301,6 +338,7 @@ function assertSchemaVersionSupported(recordVersion, record) {
|
|
|
301
338
|
* @throws {AldusError} `ALDUS_CORPUS_MALFORMED` or `ALDUS_CORPUS_DUPLICATE_CASE`.
|
|
302
339
|
*/
|
|
303
340
|
export function parseDefectCorpus(input) {
|
|
341
|
+
assertSchemaVersionSupported(input, "corpus");
|
|
304
342
|
const result = defectCorpusSchema.safeParse(input);
|
|
305
343
|
if (!result.success) {
|
|
306
344
|
// Paths and issue codes only — never the received value (contract §19.2, ADR-0002).
|
|
@@ -314,7 +352,6 @@ export function parseDefectCorpus(input) {
|
|
|
314
352
|
},
|
|
315
353
|
});
|
|
316
354
|
}
|
|
317
|
-
assertSchemaVersionSupported(result.data.schemaVersion, "corpus");
|
|
318
355
|
const seen = new Set();
|
|
319
356
|
for (const entry of result.data.cases) {
|
|
320
357
|
if (seen.has(entry.caseId)) {
|
|
@@ -331,6 +368,7 @@ export function parseDefectCorpus(input) {
|
|
|
331
368
|
* @throws {AldusError} `ALDUS_CORPUS_MALFORMED` or `ALDUS_OUTCOME_DUPLICATE`.
|
|
332
369
|
*/
|
|
333
370
|
export function parseEvaluatorRun(input) {
|
|
371
|
+
assertSchemaVersionSupported(input, "run");
|
|
334
372
|
const result = evaluatorRunSchema.safeParse(input);
|
|
335
373
|
if (!result.success) {
|
|
336
374
|
throw regressionError(RegressionErrorCodes.CORPUS_MALFORMED, "The evaluator run does not validate.", {
|
|
@@ -343,7 +381,6 @@ export function parseEvaluatorRun(input) {
|
|
|
343
381
|
},
|
|
344
382
|
});
|
|
345
383
|
}
|
|
346
|
-
assertSchemaVersionSupported(result.data.schemaVersion, "run");
|
|
347
384
|
const seen = new Set();
|
|
348
385
|
for (const outcome of result.data.outcomes) {
|
|
349
386
|
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,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1F,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;AAE1D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,C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|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aldus-runtime/regression",
|
|
3
|
-
"version": "0.2.0-next.
|
|
3
|
+
"version": "0.2.0-next.58",
|
|
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.58",
|
|
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.58",
|
|
41
41
|
"@types/node": "^26.2.0",
|
|
42
42
|
"typescript": "^7.0.2",
|
|
43
43
|
"vitest": "^4.1.10"
|
package/src/corpus.ts
CHANGED
|
@@ -27,6 +27,83 @@ import { RegressionErrorCodes, regressionError } from "./errors.js";
|
|
|
27
27
|
/** A short opaque identifier. */
|
|
28
28
|
const identifier = z.string().min(1).max(200);
|
|
29
29
|
|
|
30
|
+
// --- Schema version (ADR-0003, ADR-0053) -----------------------------------------------------
|
|
31
|
+
|
|
32
|
+
/** Schema version this package stamps on records it constructs. */
|
|
33
|
+
export const REGRESSION_SCHEMA_VERSION = SCHEMA_VERSION;
|
|
34
|
+
|
|
35
|
+
/** How a record's declared schema version relates to the one this runtime implements. */
|
|
36
|
+
export type SchemaVersionRelation = "older" | "same" | "newer";
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Compare a record's declared schema version against {@link REGRESSION_SCHEMA_VERSION}.
|
|
40
|
+
*
|
|
41
|
+
* Exported because the two directions are not the same kind of question. **Newer** is soundness
|
|
42
|
+
* and belongs here: this runtime cannot know what a later version's fields mean, so it refuses.
|
|
43
|
+
* **Older** is policy and belongs to the caller — whether a run from an earlier version is
|
|
44
|
+
* comparable to today's depends on what changed between them, which this package cannot know
|
|
45
|
+
* either. What it can do is stop every caller reimplementing the comparison, which is the part
|
|
46
|
+
* that would drift.
|
|
47
|
+
*
|
|
48
|
+
* A record must be readable in order to be upgraded, so this is deliberately a question a caller
|
|
49
|
+
* can ask *before* parsing, and an older record still parses.
|
|
50
|
+
*
|
|
51
|
+
* @param recordVersion - The `schemaVersion` field of a record, `MAJOR.MINOR` (ADR-0003).
|
|
52
|
+
* @throws {AldusError} `ALDUS_CORPUS_MALFORMED` if `recordVersion` is not `MAJOR.MINOR`.
|
|
53
|
+
*/
|
|
54
|
+
export function compareSchemaVersion(recordVersion: string): SchemaVersionRelation {
|
|
55
|
+
const parse = (value: string): readonly [number, number] => {
|
|
56
|
+
const match = /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(value);
|
|
57
|
+
if (match === null) {
|
|
58
|
+
// Path and code only — never the received value (contract §19.2).
|
|
59
|
+
throw regressionError(
|
|
60
|
+
RegressionErrorCodes.CORPUS_MALFORMED,
|
|
61
|
+
"A schema version must be MAJOR.MINOR.",
|
|
62
|
+
{
|
|
63
|
+
category: "validation",
|
|
64
|
+
details: { issues: [{ path: "schemaVersion", code: "invalid_format" }] },
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return [Number(match[1]), Number(match[2])] as const;
|
|
69
|
+
};
|
|
70
|
+
const [recordMajor, recordMinor] = parse(recordVersion);
|
|
71
|
+
const [runtimeMajor, runtimeMinor] = parse(REGRESSION_SCHEMA_VERSION);
|
|
72
|
+
if (recordMajor !== runtimeMajor) return recordMajor > runtimeMajor ? "newer" : "older";
|
|
73
|
+
if (recordMinor !== runtimeMinor) return recordMinor > runtimeMinor ? "newer" : "older";
|
|
74
|
+
return "same";
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* True when `value` is a well-formed version this runtime does not implement.
|
|
79
|
+
*
|
|
80
|
+
* A malformed value answers `false` rather than throwing, so the format check that owns that
|
|
81
|
+
* failure reports it under its own code and the version rule fires only on a version.
|
|
82
|
+
*/
|
|
83
|
+
function declaresNewerVersion(value: string): boolean {
|
|
84
|
+
return /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(value) && compareSchemaVersion(value) === "newer";
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The `schemaVersion` field of a record this package reads.
|
|
89
|
+
*
|
|
90
|
+
* **The exported schema carries the rule** (ADR-0053). `parseDefectCorpus` and `parseEvaluatorRun`
|
|
91
|
+
* refused a newer record while `defectCorpusSchema.safeParse` and `evaluatorRunSchema.safeParse`
|
|
92
|
+
* accepted the same bytes — a rule enforced at one entry point and not the other is a rule plus a
|
|
93
|
+
* bypass, and the exported object is the obvious door (#199). So the refusal lives on the field, and
|
|
94
|
+
* the parse functions check it first only so that a newer record fails with one clear
|
|
95
|
+
* `ALDUS_SCHEMA_VERSION_UNSUPPORTED` rather than a field issue about the version.
|
|
96
|
+
*
|
|
97
|
+
* This is **this package's** rule, not Core's: any newer version is refused, minor included, because
|
|
98
|
+
* these schemas are strict and a newer minor would fail on its added keys anyway. Refusing on the
|
|
99
|
+
* version names the reason. Core's records accept a newer minor and report it as a `forward` read
|
|
100
|
+
* (ADR-0003, ADR-0053).
|
|
101
|
+
*/
|
|
102
|
+
const recordSchemaVersion = schemaVersionString.refine((value) => !declaresNewerVersion(value), {
|
|
103
|
+
// Names this package's own constant, never the received value (contract §19.2).
|
|
104
|
+
message: `Schema version must not be newer than ${REGRESSION_SCHEMA_VERSION}, which is what this runtime implements.`,
|
|
105
|
+
});
|
|
106
|
+
|
|
30
107
|
/**
|
|
31
108
|
* A finding category, structured per contract §12.3.
|
|
32
109
|
*
|
|
@@ -148,7 +225,7 @@ export type DefectCase = z.infer<typeof defectCaseSchema>;
|
|
|
148
225
|
export const defectCorpusSchema = z
|
|
149
226
|
.object({
|
|
150
227
|
/** Schema version of this record (ADR-0003). */
|
|
151
|
-
schemaVersion:
|
|
228
|
+
schemaVersion: recordSchemaVersion,
|
|
152
229
|
/** Identity of this corpus. */
|
|
153
230
|
corpusId: identifier,
|
|
154
231
|
/** Human-readable purpose. */
|
|
@@ -250,7 +327,7 @@ export type EvaluatorOutcome = z.infer<typeof evaluatorOutcomeSchema>;
|
|
|
250
327
|
export const evaluatorRunSchema = z
|
|
251
328
|
.object({
|
|
252
329
|
/** Schema version of this record (ADR-0003). */
|
|
253
|
-
schemaVersion:
|
|
330
|
+
schemaVersion: recordSchemaVersion,
|
|
254
331
|
/** Which evaluator produced these outcomes. */
|
|
255
332
|
evaluatorId: identifier,
|
|
256
333
|
/** Version of the evaluator. Metrics from different versions are not comparable. */
|
|
@@ -277,64 +354,26 @@ export const evaluatorRunSchema = z
|
|
|
277
354
|
/** @see evaluatorRunSchema */
|
|
278
355
|
export type EvaluatorRun = z.infer<typeof evaluatorRunSchema>;
|
|
279
356
|
|
|
280
|
-
/** Schema version this package stamps on records it constructs. */
|
|
281
|
-
export const REGRESSION_SCHEMA_VERSION = SCHEMA_VERSION;
|
|
282
|
-
|
|
283
|
-
/** How a record's declared schema version relates to the one this runtime implements. */
|
|
284
|
-
export type SchemaVersionRelation = "older" | "same" | "newer";
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Compare a record's declared schema version against {@link REGRESSION_SCHEMA_VERSION}.
|
|
288
|
-
*
|
|
289
|
-
* Exported because the two directions are not the same kind of question. **Newer** is soundness
|
|
290
|
-
* and belongs here: this runtime cannot know what a later version's fields mean, so it refuses.
|
|
291
|
-
* **Older** is policy and belongs to the caller — whether a run from an earlier version is
|
|
292
|
-
* comparable to today's depends on what changed between them, which this package cannot know
|
|
293
|
-
* either. What it can do is stop every caller reimplementing the comparison, which is the part
|
|
294
|
-
* that would drift.
|
|
295
|
-
*
|
|
296
|
-
* A record must be readable in order to be upgraded, so this is deliberately a question a caller
|
|
297
|
-
* can ask *before* parsing, and an older record still parses.
|
|
298
|
-
*
|
|
299
|
-
* @param recordVersion - The `schemaVersion` field of a record, `MAJOR.MINOR` (ADR-0003).
|
|
300
|
-
* @throws {AldusError} `ALDUS_CORPUS_MALFORMED` if `recordVersion` is not `MAJOR.MINOR`.
|
|
301
|
-
*/
|
|
302
|
-
export function compareSchemaVersion(recordVersion: string): SchemaVersionRelation {
|
|
303
|
-
const parse = (value: string): readonly [number, number] => {
|
|
304
|
-
const match = /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(value);
|
|
305
|
-
if (match === null) {
|
|
306
|
-
// Path and code only — never the received value (contract §19.2).
|
|
307
|
-
throw regressionError(
|
|
308
|
-
RegressionErrorCodes.CORPUS_MALFORMED,
|
|
309
|
-
"A schema version must be MAJOR.MINOR.",
|
|
310
|
-
{
|
|
311
|
-
category: "validation",
|
|
312
|
-
details: { issues: [{ path: "schemaVersion", code: "invalid_format" }] },
|
|
313
|
-
},
|
|
314
|
-
);
|
|
315
|
-
}
|
|
316
|
-
return [Number(match[1]), Number(match[2])] as const;
|
|
317
|
-
};
|
|
318
|
-
const [recordMajor, recordMinor] = parse(recordVersion);
|
|
319
|
-
const [runtimeMajor, runtimeMinor] = parse(REGRESSION_SCHEMA_VERSION);
|
|
320
|
-
if (recordMajor !== runtimeMajor) return recordMajor > runtimeMajor ? "newer" : "older";
|
|
321
|
-
if (recordMinor !== runtimeMinor) return recordMinor > runtimeMinor ? "newer" : "older";
|
|
322
|
-
return "same";
|
|
323
|
-
}
|
|
324
|
-
|
|
325
357
|
/**
|
|
326
|
-
* Refuse a record declaring a version this runtime does not implement
|
|
358
|
+
* Refuse a record declaring a version this runtime does not implement, **before** its shape is
|
|
359
|
+
* read.
|
|
327
360
|
*
|
|
328
361
|
* Only `newer` is refused. An older record parses, and {@link compareSchemaVersion} is how a
|
|
329
362
|
* caller decides whether to trust it.
|
|
363
|
+
*
|
|
364
|
+
* Version before fields, for the same reason Core's `validateRecord` orders them so: a newer record
|
|
365
|
+
* fails with one `ALDUS_SCHEMA_VERSION_UNSUPPORTED` that names the cause, rather than a field issue
|
|
366
|
+
* that describes the symptom. A missing or malformed version is not this check's to report — it
|
|
367
|
+
* falls through, and the schema reports it precisely under `ALDUS_CORPUS_MALFORMED`.
|
|
330
368
|
*/
|
|
331
|
-
function assertSchemaVersionSupported(
|
|
332
|
-
if (
|
|
369
|
+
function assertSchemaVersionSupported(input: unknown, record: "corpus" | "run"): void {
|
|
370
|
+
if (typeof input !== "object" || input === null) return;
|
|
371
|
+
const declared = (input as { schemaVersion?: unknown }).schemaVersion;
|
|
372
|
+
if (typeof declared !== "string" || !declaresNewerVersion(declared)) return;
|
|
333
373
|
throw regressionError(
|
|
334
374
|
RegressionErrorCodes.SCHEMA_VERSION_UNSUPPORTED,
|
|
335
375
|
`A ${record} declares a schema version newer than this runtime implements. Its fields cannot ` +
|
|
336
|
-
"be interpreted here,
|
|
337
|
-
"would return a record that looks complete and is not.",
|
|
376
|
+
"be interpreted here, so accepting it would return a record that looks complete and is not.",
|
|
338
377
|
{
|
|
339
378
|
category: "validation",
|
|
340
379
|
// The runtime's own version is this package's constant, not received input, so naming it is
|
|
@@ -350,6 +389,7 @@ function assertSchemaVersionSupported(recordVersion: string, record: "corpus" |
|
|
|
350
389
|
* @throws {AldusError} `ALDUS_CORPUS_MALFORMED` or `ALDUS_CORPUS_DUPLICATE_CASE`.
|
|
351
390
|
*/
|
|
352
391
|
export function parseDefectCorpus(input: unknown): DefectCorpus {
|
|
392
|
+
assertSchemaVersionSupported(input, "corpus");
|
|
353
393
|
const result = defectCorpusSchema.safeParse(input);
|
|
354
394
|
if (!result.success) {
|
|
355
395
|
// Paths and issue codes only — never the received value (contract §19.2, ADR-0002).
|
|
@@ -368,8 +408,6 @@ export function parseDefectCorpus(input: unknown): DefectCorpus {
|
|
|
368
408
|
);
|
|
369
409
|
}
|
|
370
410
|
|
|
371
|
-
assertSchemaVersionSupported(result.data.schemaVersion, "corpus");
|
|
372
|
-
|
|
373
411
|
const seen = new Set<string>();
|
|
374
412
|
for (const entry of result.data.cases) {
|
|
375
413
|
if (seen.has(entry.caseId)) {
|
|
@@ -391,6 +429,7 @@ export function parseDefectCorpus(input: unknown): DefectCorpus {
|
|
|
391
429
|
* @throws {AldusError} `ALDUS_CORPUS_MALFORMED` or `ALDUS_OUTCOME_DUPLICATE`.
|
|
392
430
|
*/
|
|
393
431
|
export function parseEvaluatorRun(input: unknown): EvaluatorRun {
|
|
432
|
+
assertSchemaVersionSupported(input, "run");
|
|
394
433
|
const result = evaluatorRunSchema.safeParse(input);
|
|
395
434
|
if (!result.success) {
|
|
396
435
|
throw regressionError(
|
|
@@ -408,8 +447,6 @@ export function parseEvaluatorRun(input: unknown): EvaluatorRun {
|
|
|
408
447
|
);
|
|
409
448
|
}
|
|
410
449
|
|
|
411
|
-
assertSchemaVersionSupported(result.data.schemaVersion, "run");
|
|
412
|
-
|
|
413
450
|
const seen = new Set<string>();
|
|
414
451
|
for (const outcome of result.data.outcomes) {
|
|
415
452
|
if (seen.has(outcome.caseId)) {
|