@aldus-runtime/regression 0.2.0-next.20 → 0.2.0-next.22

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 CHANGED
@@ -120,7 +120,8 @@ export declare const defectCorpusSchema: z.ZodObject<{
120
120
  }, z.core.$strip>;
121
121
  labelledAt: z.ZodISODateTime;
122
122
  }, z.core.$strip>>;
123
- }, z.core.$strip>;
123
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
124
+ }, z.core.$strict>;
124
125
  /** @see defectCorpusSchema */
125
126
  export type DefectCorpus = z.infer<typeof defectCorpusSchema>;
126
127
  /** One finding an evaluator reported. */
@@ -166,11 +167,31 @@ export declare const evaluatorRunSchema: z.ZodObject<{
166
167
  siteMetricsMeasurable: z.ZodOptional<z.ZodBoolean>;
167
168
  }, z.core.$strip>>;
168
169
  executedAt: z.ZodISODateTime;
169
- }, z.core.$strip>;
170
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
171
+ }, z.core.$strict>;
170
172
  /** @see evaluatorRunSchema */
171
173
  export type EvaluatorRun = z.infer<typeof evaluatorRunSchema>;
172
174
  /** Schema version this package stamps on records it constructs. */
173
- export declare const REGRESSION_SCHEMA_VERSION = "1.8";
175
+ export declare const REGRESSION_SCHEMA_VERSION = "1.12";
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;
174
195
  /**
175
196
  * Validate a corpus and check the uniqueness constraint Zod cannot express.
176
197
  *
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkB3B,CAAC;AAEL,8BAA8B;AAC9B,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,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AAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAkC9D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAgC9D"}
package/dist/corpus.js CHANGED
@@ -135,7 +135,31 @@ export const defectCorpusSchema = z
135
135
  description: z.string().max(2000).optional(),
136
136
  /** The labelled cases. */
137
137
  cases: z.array(defectCaseSchema).max(100_000),
138
+ /**
139
+ * Adopter-owned data carried with this record.
140
+ *
141
+ * A declared extension point, because strictness without one is a rule with no exit. Refusing
142
+ * an undeclared key is right — a record from a later runtime whose added fields vanish hands
143
+ * the caller an object that looks complete and is not. But that argument is about *the
144
+ * runtime's* future fields, and it was applied to an adopter's own data, which is a different
145
+ * category and had a real pattern behind it: the provenance of a label belongs beside the
146
+ * label, in the same file, versioned together, because a label whose source lives in another
147
+ * file is one refactor away from a label with no source.
148
+ *
149
+ * So the two cases are separated rather than collapsed. An unknown key is refused; a declared
150
+ * one is **preserved through the parse**, which the previous sibling-key arrangement could not
151
+ * do — it survived only because readers went around the parser to the raw JSON.
152
+ *
153
+ * Core never interprets this. Same shape as `WorkflowEvent.details` and
154
+ * `SpendReservationTransition.detail` (§4.2: adopter-shaped concepts are opaque here).
155
+ */
156
+ metadata: z.record(z.string(), z.unknown()).optional(),
138
157
  })
158
+ // Strict: an unknown key is refused, not stripped. Without this a record from a later runtime
159
+ // parses and its added fields vanish, handing the caller an object that looks complete and is
160
+ // not. See SCHEMA_VERSION_UNSUPPORTED — the version check and this are the same guarantee, one
161
+ // for a declared newer version and one for an undeclared newer shape.
162
+ .strict()
139
163
  .meta({
140
164
  id: "DefectCorpus",
141
165
  title: "DefectCorpus",
@@ -204,7 +228,10 @@ export const evaluatorRunSchema = z
204
228
  outcomes: z.array(evaluatorOutcomeSchema).max(100_000),
205
229
  /** When the run was executed. */
206
230
  executedAt: z.iso.datetime({ offset: true }),
231
+ /** @see defectCorpusSchema.metadata */
232
+ metadata: z.record(z.string(), z.unknown()).optional(),
207
233
  })
234
+ .strict()
208
235
  .meta({
209
236
  id: "EvaluatorRun",
210
237
  title: "EvaluatorRun",
@@ -214,6 +241,60 @@ export const evaluatorRunSchema = z
214
241
  });
215
242
  /** Schema version this package stamps on records it constructs. */
216
243
  export const REGRESSION_SCHEMA_VERSION = SCHEMA_VERSION;
244
+ /**
245
+ * Compare a record's declared schema version against {@link REGRESSION_SCHEMA_VERSION}.
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.
282
+ *
283
+ * Only `newer` is refused. An older record parses, and {@link compareSchemaVersion} is how a
284
+ * caller decides whether to trust it.
285
+ */
286
+ function assertSchemaVersionSupported(recordVersion, record) {
287
+ if (compareSchemaVersion(recordVersion) !== "newer")
288
+ return;
289
+ throw regressionError(RegressionErrorCodes.SCHEMA_VERSION_UNSUPPORTED, `A ${record} declares a schema version newer than this runtime implements. Its fields cannot ` +
290
+ "be interpreted here, and the schema discards what it does not declare, so accepting it " +
291
+ "would return a record that looks complete and is not.", {
292
+ category: "validation",
293
+ // The runtime's own version is this package's constant, not received input, so naming it is
294
+ // not a value leak. The record's version is not named (contract §19.2).
295
+ details: { runtimeSchemaVersion: REGRESSION_SCHEMA_VERSION, relation: "newer" },
296
+ });
297
+ }
217
298
  /**
218
299
  * Validate a corpus and check the uniqueness constraint Zod cannot express.
219
300
  *
@@ -233,6 +314,7 @@ export function parseDefectCorpus(input) {
233
314
  },
234
315
  });
235
316
  }
317
+ assertSchemaVersionSupported(result.data.schemaVersion, "corpus");
236
318
  const seen = new Set();
237
319
  for (const entry of result.data.cases) {
238
320
  if (seen.has(entry.caseId)) {
@@ -261,6 +343,7 @@ export function parseEvaluatorRun(input) {
261
343
  },
262
344
  });
263
345
  }
346
+ assertSchemaVersionSupported(result.data.schemaVersion, "run");
264
347
  const seen = new Set();
265
348
  for (const outcome of result.data.outcomes) {
266
349
  if (seen.has(outcome.caseId)) {
@@ -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,MAA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,EACtC;YACE,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE;gBACP,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;oBAC1C,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;oBAC1B,IAAI,EAAE,KAAK,CAAC,IAAI;iBACjB,CAAC,CAAC;aACJ;SACF,CACF,CAAC;IACJ,CAAC;IAED,4BAA4B,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IAE/D,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC3C,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,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];
@@ -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,EAAE,4BAA4B;IAClD,6DAA6D;aAC7D,iBAAiB,EAAE,yBAAyB;IAC5C;;;;;;OAMG;aACH,mBAAmB,EAAE,2BAA2B;IAChD,mFAAmF;aACnF,2BAA2B,EAAE,mCAAmC;IAChE,6CAA6C;aAC7C,oBAAoB,EAAE,4BAA4B;IAClD,6CAA6C;aAC7C,oBAAoB,EAAE,4BAA4B;IAClD,2FAA2F;aAC3F,cAAc,EAAE,sBAAsB;CAC9B,CAAC;AAEX,gCAAgC;AAChC,MAAM,MAAM,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"}
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,EAAE,4BAA4B;IAClD,6DAA6D;aAC7D,iBAAiB,EAAE,yBAAyB;IAC5C;;;;;;OAMG;aACH,mBAAmB,EAAE,2BAA2B;IAChD,mFAAmF;aACnF,2BAA2B,EAAE,mCAAmC;IAChE,6CAA6C;aAC7C,oBAAoB,EAAE,4BAA4B;IAClD,6CAA6C;aAC7C,oBAAoB,EAAE,4BAA4B;IAClD,2FAA2F;aAC3F,cAAc,EAAE,sBAAsB;IACtC;;;;;;;;OAQG;aACH,0BAA0B,EAAE,kCAAkC;CACtD,CAAC;AAEX,gCAAgC;AAChC,MAAM,MAAM,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) {
@@ -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;CAC9B,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"}
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";
@@ -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,GACrB,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,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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,GAQd,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"}
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.20",
3
+ "version": "0.2.0-next.22",
4
4
  "type": "module",
5
- "description": "Aldus Regression Harness \u2014 defect corpora, scope-aware evaluator metrics, blind-spot registry, and evaluator promotion evidence.",
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.20",
36
+ "@aldus-runtime/core": "0.2.0-next.22",
37
37
  "zod": "^4.4.3"
38
38
  },
39
39
  "devDependencies": {
40
- "@aldus-runtime/testkit": "0.2.0-next.20",
40
+ "@aldus-runtime/testkit": "0.2.0-next.22",
41
41
  "@types/node": "^26.2.0",
42
42
  "typescript": "^7.0.2",
43
43
  "vitest": "^4.1.10"
package/src/corpus.ts CHANGED
@@ -155,7 +155,31 @@ export const defectCorpusSchema = z
155
155
  description: z.string().max(2000).optional(),
156
156
  /** The labelled cases. */
157
157
  cases: z.array(defectCaseSchema).max(100_000),
158
+ /**
159
+ * Adopter-owned data carried with this record.
160
+ *
161
+ * A declared extension point, because strictness without one is a rule with no exit. Refusing
162
+ * an undeclared key is right — a record from a later runtime whose added fields vanish hands
163
+ * the caller an object that looks complete and is not. But that argument is about *the
164
+ * runtime's* future fields, and it was applied to an adopter's own data, which is a different
165
+ * category and had a real pattern behind it: the provenance of a label belongs beside the
166
+ * label, in the same file, versioned together, because a label whose source lives in another
167
+ * file is one refactor away from a label with no source.
168
+ *
169
+ * So the two cases are separated rather than collapsed. An unknown key is refused; a declared
170
+ * one is **preserved through the parse**, which the previous sibling-key arrangement could not
171
+ * do — it survived only because readers went around the parser to the raw JSON.
172
+ *
173
+ * Core never interprets this. Same shape as `WorkflowEvent.details` and
174
+ * `SpendReservationTransition.detail` (§4.2: adopter-shaped concepts are opaque here).
175
+ */
176
+ metadata: z.record(z.string(), z.unknown()).optional(),
158
177
  })
178
+ // Strict: an unknown key is refused, not stripped. Without this a record from a later runtime
179
+ // parses and its added fields vanish, handing the caller an object that looks complete and is
180
+ // not. See SCHEMA_VERSION_UNSUPPORTED — the version check and this are the same guarantee, one
181
+ // for a declared newer version and one for an undeclared newer shape.
182
+ .strict()
159
183
  .meta({
160
184
  id: "DefectCorpus",
161
185
  title: "DefectCorpus",
@@ -237,7 +261,10 @@ export const evaluatorRunSchema = z
237
261
  outcomes: z.array(evaluatorOutcomeSchema).max(100_000),
238
262
  /** When the run was executed. */
239
263
  executedAt: z.iso.datetime({ offset: true }),
264
+ /** @see defectCorpusSchema.metadata */
265
+ metadata: z.record(z.string(), z.unknown()).optional(),
240
266
  })
267
+ .strict()
241
268
  .meta({
242
269
  id: "EvaluatorRun",
243
270
  title: "EvaluatorRun",
@@ -253,6 +280,70 @@ export type EvaluatorRun = z.infer<typeof evaluatorRunSchema>;
253
280
  /** Schema version this package stamps on records it constructs. */
254
281
  export const REGRESSION_SCHEMA_VERSION = SCHEMA_VERSION;
255
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
+ /**
326
+ * Refuse a record declaring a version this runtime does not implement.
327
+ *
328
+ * Only `newer` is refused. An older record parses, and {@link compareSchemaVersion} is how a
329
+ * caller decides whether to trust it.
330
+ */
331
+ function assertSchemaVersionSupported(recordVersion: string, record: "corpus" | "run"): void {
332
+ if (compareSchemaVersion(recordVersion) !== "newer") return;
333
+ throw regressionError(
334
+ RegressionErrorCodes.SCHEMA_VERSION_UNSUPPORTED,
335
+ `A ${record} declares a schema version newer than this runtime implements. Its fields cannot ` +
336
+ "be interpreted here, and the schema discards what it does not declare, so accepting it " +
337
+ "would return a record that looks complete and is not.",
338
+ {
339
+ category: "validation",
340
+ // The runtime's own version is this package's constant, not received input, so naming it is
341
+ // not a value leak. The record's version is not named (contract §19.2).
342
+ details: { runtimeSchemaVersion: REGRESSION_SCHEMA_VERSION, relation: "newer" },
343
+ },
344
+ );
345
+ }
346
+
256
347
  /**
257
348
  * Validate a corpus and check the uniqueness constraint Zod cannot express.
258
349
  *
@@ -277,6 +368,8 @@ export function parseDefectCorpus(input: unknown): DefectCorpus {
277
368
  );
278
369
  }
279
370
 
371
+ assertSchemaVersionSupported(result.data.schemaVersion, "corpus");
372
+
280
373
  const seen = new Set<string>();
281
374
  for (const entry of result.data.cases) {
282
375
  if (seen.has(entry.caseId)) {
@@ -315,6 +408,8 @@ export function parseEvaluatorRun(input: unknown): EvaluatorRun {
315
408
  );
316
409
  }
317
410
 
411
+ assertSchemaVersionSupported(result.data.schemaVersion, "run");
412
+
318
413
  const seen = new Set<string>();
319
414
  for (const outcome of result.data.outcomes) {
320
415
  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) --------------------------------------------------------------------