eval-quality 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +142 -67
- package/corpus/dev/README.md +20 -13
- package/corpus/dev/compile-seal-example/brief.json +1 -1
- package/corpus/dev/compile-seal-example/contract.json +1 -1
- package/corpus/dev/contracts/absent-collection-locations.json +1 -1
- package/corpus/dev/contracts/absent-sibling-groups.json +1 -1
- package/corpus/dev/contracts/absent-success-indicator.json +1 -1
- package/corpus/dev/contracts/empty-channel-roles.json +1 -1
- package/corpus/dev/contracts/empty-collection-locations.json +1 -1
- package/corpus/dev/contracts/empty-request-shapes.json +1 -1
- package/corpus/dev/contracts/empty-sibling-groups.json +1 -1
- package/corpus/dev/contracts/fragment-selection.json +1 -0
- package/corpus/dev/contracts/no-collection-quantifier.json +1 -1
- package/corpus/dev/contracts/no-operation-inventory.json +1 -1
- package/corpus/dev/contracts/no-read-back-relation.json +1 -1
- package/corpus/dev/contracts/no-state-change-marker.json +1 -1
- package/corpus/dev/contracts/no-type-violating-step.json +1 -1
- package/corpus/dev/contracts/per-key-split-oracles.json +1 -1
- package/corpus/dev/contracts/review-corpus.json +1 -0
- package/corpus/dev/contracts/satisfied-declarations.json +1 -1
- package/corpus/dev/contracts/single-required-response-key.json +1 -1
- package/corpus/dev/contracts/split-indicator-oracle.json +1 -1
- package/corpus/dev/contracts/unaddressed-parameter-sibling.json +1 -1
- package/corpus/dev/contracts/unnamed-reference-set.json +1 -1
- package/corpus/dev/contracts/wrong-cardinality-form.json +1 -1
- package/corpus/dev/index.json +1 -1
- package/dist/application/index.d.ts +2 -0
- package/dist/application/index.js +1 -0
- package/dist/application/score.d.ts +48 -0
- package/dist/application/score.js +186 -0
- package/dist/cli/arguments.d.ts +7 -3
- package/dist/cli/arguments.js +73 -5
- package/dist/cli/exit-codes.d.ts +6 -2
- package/dist/cli/exit-codes.js +8 -9
- package/dist/cli/main.js +9 -0
- package/dist/cli/render.d.ts +3 -6
- package/dist/cli/render.js +57 -5
- package/dist/cli/run.d.ts +13 -3
- package/dist/cli/run.js +136 -16
- package/dist/core/canonical/canonicalize.d.ts +12 -0
- package/dist/core/canonical/canonicalize.js +18 -4
- package/dist/core/compile/bindings.d.ts +89 -0
- package/dist/core/compile/bindings.js +334 -0
- package/dist/core/compile/compile.d.ts +17 -0
- package/dist/core/compile/compile.js +37 -1
- package/dist/core/compile/excluded-content.d.ts +11 -0
- package/dist/core/compile/excluded-content.js +42 -0
- package/dist/core/compile/expression-legality.d.ts +49 -0
- package/dist/core/compile/expression-legality.js +158 -38
- package/dist/core/compile/forbidden-inputs.d.ts +8 -1
- package/dist/core/compile/forbidden-inputs.js +16 -3
- package/dist/core/compile/interface-inventory.d.ts +57 -2
- package/dist/core/compile/interface-inventory.js +119 -13
- package/dist/core/compile/reachability.d.ts +28 -1
- package/dist/core/compile/reachability.js +167 -35
- package/dist/core/compile/schema-version.d.ts +2 -0
- package/dist/core/compile/schema-version.js +25 -0
- package/dist/core/compile/sensitivity-witness.d.ts +31 -12
- package/dist/core/compile/sensitivity-witness.js +110 -23
- package/dist/core/compile/step-reference.d.ts +2 -0
- package/dist/core/compile/step-reference.js +49 -0
- package/dist/core/coverage/operations.d.ts +62 -0
- package/dist/core/coverage/operations.js +57 -0
- package/dist/core/coverage/relevance.d.ts +4 -2
- package/dist/core/coverage/relevance.js +22 -23
- package/dist/core/coverage/satisfaction.d.ts +2 -2
- package/dist/core/coverage/satisfaction.js +73 -48
- package/dist/core/declared-inputs.d.ts +83 -4
- package/dist/core/declared-inputs.js +105 -8
- package/dist/core/emit/emit.d.ts +9 -0
- package/dist/core/emit/emit.js +214 -0
- package/dist/core/emit/private-artifact-digest.d.ts +11 -0
- package/dist/core/emit/private-artifact-digest.js +31 -0
- package/dist/core/evaluate/evidence-resolution.d.ts +10 -3
- package/dist/core/evaluate/evidence-resolution.js +74 -11
- package/dist/core/evaluate/operators.d.ts +22 -0
- package/dist/core/evaluate/operators.js +17 -1
- package/dist/core/evaluate/resolution.d.ts +14 -3
- package/dist/core/evaluate/resolution.js +63 -3
- package/dist/core/excluded-content.d.ts +65 -0
- package/dist/core/excluded-content.js +113 -0
- package/dist/core/failure-codes.d.ts +2 -2
- package/dist/core/failure-codes.js +7 -2
- package/dist/core/ingest/conditions.d.ts +201 -0
- package/dist/core/ingest/conditions.js +48 -0
- package/dist/core/ingest/index.d.ts +13 -0
- package/dist/core/ingest/index.js +11 -0
- package/dist/core/ingest/ingest.d.ts +68 -0
- package/dist/core/ingest/ingest.js +318 -0
- package/dist/core/lineage/stage-table.d.ts +21 -4
- package/dist/core/lineage/stage-table.js +35 -3
- package/dist/core/preflight/plan.d.ts +7 -5
- package/dist/core/preflight/plan.js +75 -32
- package/dist/core/preflight/projection.d.ts +6 -3
- package/dist/core/preflight/projection.js +22 -2
- package/dist/core/preflight/reduce.js +47 -7
- package/dist/core/preflight/witness-evidence.d.ts +5 -5
- package/dist/core/preflight/witness-evidence.js +73 -20
- package/dist/core/schemas/artifact.d.ts +1049 -30
- package/dist/core/schemas/constraint-ledger.js +51 -0
- package/dist/core/schemas/defect-signature.d.ts +695 -0
- package/dist/core/schemas/defect-signature.js +175 -0
- package/dist/core/schemas/eval-contract.d.ts +550 -12
- package/dist/core/schemas/eval-contract.js +32 -2
- package/dist/core/schemas/evidence-artifact.d.ts +109 -19
- package/dist/core/schemas/evidence-artifact.js +64 -8
- package/dist/core/schemas/interface.d.ts +741 -13
- package/dist/core/schemas/interface.js +120 -7
- package/dist/core/schemas/isolation-manifest.js +16 -9
- package/dist/core/schemas/plan.d.ts +329 -3
- package/dist/core/schemas/plan.js +89 -3
- package/dist/core/schemas/pointer.d.ts +47 -1
- package/dist/core/schemas/pointer.js +89 -8
- package/dist/core/schemas/port-messages.d.ts +194 -10
- package/dist/core/schemas/port-messages.js +73 -6
- package/dist/core/schemas/probe-body.d.ts +18 -0
- package/dist/core/schemas/probe-body.js +13 -0
- package/dist/core/schemas/probe-qualification.d.ts +168 -0
- package/dist/core/schemas/probe-qualification.js +106 -0
- package/dist/core/schemas/probe.d.ts +431 -0
- package/dist/core/schemas/probe.js +6 -2
- package/dist/core/schemas/scoring-policy.d.ts +1 -0
- package/dist/core/schemas/scoring-policy.js +6 -1
- package/dist/core/schemas/sealed-evaluator-brief.d.ts +1 -0
- package/dist/core/schemas/sealed-evaluator-brief.js +4 -1
- package/dist/core/schemas/sealed-run-record.d.ts +161 -12
- package/dist/core/schemas/sealed-run-record.js +92 -15
- package/dist/core/schemas/sensitivity-witness.d.ts +108 -6
- package/dist/core/schemas/sensitivity-witness.js +61 -5
- package/dist/core/score/binding-order.d.ts +31 -0
- package/dist/core/score/binding-order.js +88 -0
- package/dist/core/score/bindings.d.ts +93 -0
- package/dist/core/score/bindings.js +309 -0
- package/dist/core/score/ladder-table.d.ts +23 -0
- package/dist/core/score/ladder-table.js +109 -0
- package/dist/core/score/ladder.d.ts +229 -0
- package/dist/core/score/ladder.js +464 -0
- package/dist/core/score/mode-agreement.d.ts +30 -0
- package/dist/core/score/mode-agreement.js +16 -0
- package/dist/core/score/outcome-table.d.ts +17 -0
- package/dist/core/score/outcome-table.js +172 -0
- package/dist/core/score/outcome.d.ts +466 -0
- package/dist/core/score/outcome.js +562 -0
- package/dist/core/score/qualification.d.ts +83 -0
- package/dist/core/score/qualification.js +645 -0
- package/dist/core/score/quotation.d.ts +56 -0
- package/dist/core/score/quotation.js +226 -0
- package/dist/core/score/reduce-trials.d.ts +80 -0
- package/dist/core/score/reduce-trials.js +90 -0
- package/dist/core/score/score.d.ts +72 -0
- package/dist/core/score/score.js +607 -0
- package/dist/core/score/selection.d.ts +80 -0
- package/dist/core/score/selection.js +98 -0
- package/dist/core/score/strength.d.ts +58 -0
- package/dist/core/score/strength.js +227 -0
- package/dist/core/score/witness.d.ts +138 -0
- package/dist/core/score/witness.js +320 -0
- package/dist/core/seal/derived-reference.d.ts +2 -9
- package/dist/core/seal/derived-reference.js +293 -46
- package/dist/core/seal/plan-index.d.ts +18 -3
- package/dist/core/seal/plan-index.js +44 -8
- package/dist/core/seal/seal.js +8 -3
- package/dist/core/stage-contracts.d.ts +62 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/ports/environment-probe-port.d.ts +60 -4
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.js +1 -0
- package/dist/testing/probe-conformance.d.ts +29 -0
- package/dist/testing/probe-conformance.js +34 -5
- package/package.json +12 -3
- package/schemas/eval-contract.schema.json +1787 -797
- package/schemas/evidence-artifact.schema.json +126 -9
- package/schemas/isolation-manifest.schema.json +17 -10
- package/schemas/probe.schema.json +636 -5
- package/schemas/rubric.schema.json +1 -1
- package/schemas/scoring-policy.schema.json +8 -1
- package/schemas/sealed-evaluator-brief.schema.json +11 -1
- package/schemas/sealed-run-record.schema.json +314 -40
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AD-34's stage-shape vocabulary. Two conformance types pin the exact shapes
|
|
3
|
-
* of `compile` and `seal`;
|
|
4
|
-
* plan/reduce pair, which `preflight` implements
|
|
3
|
+
* of `compile` and `seal`; four generic types cover the rest -- the
|
|
4
|
+
* conditional plan/reduce pair, which `preflight` implements, `IngestStage`,
|
|
5
|
+
* generic over the one product it owns, and `ScoreStage`, generic over both
|
|
6
|
+
* the trial set's element type and the product it owns.
|
|
5
7
|
*
|
|
6
8
|
* AD-24's six-stage input/output/owner/lineage table lives in
|
|
7
9
|
* `core/lineage/stage-table.ts`. This file holds the stage *shapes* TypeScript
|
|
@@ -9,7 +11,15 @@
|
|
|
9
11
|
* Neither imports the other.
|
|
10
12
|
*/
|
|
11
13
|
import type { EvalContract } from './schemas/eval-contract.ts';
|
|
14
|
+
import type { EvaluatorConfiguration } from './schemas/evaluator-configuration.ts';
|
|
15
|
+
import type { EvidenceArtifact } from './schemas/evidence-artifact.ts';
|
|
16
|
+
import type { IsolationManifest } from './schemas/isolation-manifest.ts';
|
|
17
|
+
import type { PreflightVerdict } from './schemas/preflight-verdict.ts';
|
|
18
|
+
import type { Probe } from './schemas/probe.ts';
|
|
19
|
+
import type { ScoringPolicy } from './schemas/scoring-policy.ts';
|
|
12
20
|
import type { SealedEvaluatorBrief } from './schemas/sealed-evaluator-brief.ts';
|
|
21
|
+
import type { SealedRunRecord } from './schemas/sealed-run-record.ts';
|
|
22
|
+
import type { WaiverStateValue } from './score/outcome.ts';
|
|
13
23
|
/** The core compile stage's one runtime option. Core behavior never depends on an implicit configuration source (AD-1), so this is required; `application/compile.ts` is the only caller that supplies a default. */
|
|
14
24
|
export type CompileOptions = {
|
|
15
25
|
readonly strict: boolean;
|
|
@@ -28,3 +38,53 @@ export type SealStage = (contract: EvalContract) => SealedEvaluatorBrief;
|
|
|
28
38
|
export type PlanStage<InputArtifact, RequestDescription> = (input: InputArtifact) => RequestDescription;
|
|
29
39
|
/** A stage's pure reducing half: the plan plus the observations a port produced, reduced to the next artifact. */
|
|
30
40
|
export type ReduceStage<RequestDescription, Observation, OutputArtifact> = (plan: RequestDescription, observations: Observation) => OutputArtifact;
|
|
41
|
+
/**
|
|
42
|
+
* The ingest stage: the three artifacts AD-24's table declares as its inputs,
|
|
43
|
+
* validated into the internal product it owns. `core/ingest/ingest.ts`
|
|
44
|
+
* implements it.
|
|
45
|
+
*
|
|
46
|
+
* Three parameters and no fourth. AD-24 names `mode` as a value input and the
|
|
47
|
+
* sealed run record is where mode is read from, so restating it as an argument
|
|
48
|
+
* would create a disagreement case the design has no rule for.
|
|
49
|
+
*
|
|
50
|
+
* The manifest and the evaluator configuration both admit `null` because AD-16
|
|
51
|
+
* and AD-24 each make an absent artifact a condition this stage records rather
|
|
52
|
+
* than a shape a caller may not present. Their other shared clause, incomplete,
|
|
53
|
+
* is a schema rejection raised before this stage sees anything.
|
|
54
|
+
*
|
|
55
|
+
* Generic over the product for the same reason `ReduceStage` is: a concrete
|
|
56
|
+
* return type would import from `core/ingest/`, which imports this file back.
|
|
57
|
+
*/
|
|
58
|
+
export type IngestStage<Product> = (record: SealedRunRecord, manifest: IsolationManifest | null, configuration: EvaluatorConfiguration | null) => Product;
|
|
59
|
+
/**
|
|
60
|
+
* The score stage: `STAGE_SIGNATURES.score`'s five declared artifact inputs,
|
|
61
|
+
* plus the two caller-supplied value parameters neither the trial set nor
|
|
62
|
+
* any declared input carries a source for (`score.ts`'s own Boundaries:
|
|
63
|
+
* `waiver` mirrors `outcome.ts:58-61`'s AD-5 expiry citation, and
|
|
64
|
+
* `evaluationFault` has no citation anywhere and is recorded as a genuine
|
|
65
|
+
* gap this parameter closes).
|
|
66
|
+
*
|
|
67
|
+
* Generic over both the trial set's element type and the owned product, for
|
|
68
|
+
* the same reason `IngestStage` is generic over its product: a concrete
|
|
69
|
+
* `ValidatedObservations` here would import `core/ingest/ingest.ts`, and a
|
|
70
|
+
* concrete `ScoredOutcomesAndVerdict` would import `core/score/score.ts`,
|
|
71
|
+
* either of which imports this file back to type itself.
|
|
72
|
+
*/
|
|
73
|
+
export type ScoreStage<Trials, Product> = (contract: EvalContract, trials: readonly Trials[], probe: Probe, preflightVerdict: PreflightVerdict, policy: ScoringPolicy, waiver: WaiverStateValue, evaluationFault: boolean) => Product;
|
|
74
|
+
/**
|
|
75
|
+
* The emit stage: `STAGE_SIGNATURES.emit`'s one declared artifact input plus
|
|
76
|
+
* the three caller-attested AD-11 digests, minting the `EvidenceArtifact`
|
|
77
|
+
* neither `score` nor any earlier stage can construct alone. One generic
|
|
78
|
+
* parameter, not two: `EvidenceArtifact` is imported concretely here, the
|
|
79
|
+
* same way this file already imports several other concrete schema types
|
|
80
|
+
* above, so importing one more from the same directory opens no cycle;
|
|
81
|
+
* only the input (`ScoredOutcomesAndVerdict`, defined in
|
|
82
|
+
* `core/score/score.ts`) needs genericity, for the same import-cycle reason
|
|
83
|
+
* `IngestStage`/`ScoreStage` are generic over theirs.
|
|
84
|
+
*
|
|
85
|
+
* The three digests are plain `string` rather than a `Digest` type: no
|
|
86
|
+
* `core/schemas` module exports a bare TypeScript `Digest` type, only the
|
|
87
|
+
* Zod schema, and `EvidenceArtifact`'s own parse is where their AD-27 shape
|
|
88
|
+
* is actually enforced.
|
|
89
|
+
*/
|
|
90
|
+
export type EmitStage<Input> = (scored: Input, corpusDigest: string, fixtureDigest: string, evaluatorConfigurationDigest: string) => EvidenceArtifact;
|
package/dist/index.d.ts
CHANGED
|
@@ -12,4 +12,4 @@ export type { ScoringPolicy } from './core/schemas/scoring-policy.ts';
|
|
|
12
12
|
export type { SealedEvaluatorBrief } from './core/schemas/sealed-evaluator-brief.ts';
|
|
13
13
|
export type { SealedRunRecord } from './core/schemas/sealed-run-record.ts';
|
|
14
14
|
export type { FixtureReset, ManifestationWitness, SensitivityWitness, SensitivityWitnessLeg, WitnessChannel, WitnessInputs, } from './core/schemas/sensitivity-witness.ts';
|
|
15
|
-
export declare const VERSION = "0.
|
|
15
|
+
export declare const VERSION = "0.3.0";
|
package/dist/index.js
CHANGED
|
@@ -31,10 +31,11 @@ export type EnvironmentProbePort = {
|
|
|
31
31
|
};
|
|
32
32
|
/** the boundary parsers `application/` and the conformance suite validate with. */
|
|
33
33
|
export declare const probeParsers: {
|
|
34
|
-
readonly request: import("zod").ZodObject<{
|
|
34
|
+
readonly request: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
35
35
|
probeId: import("zod").ZodString;
|
|
36
36
|
interfaceId: import("zod").ZodString;
|
|
37
37
|
operationId: import("zod").ZodString;
|
|
38
|
+
kind: import("zod").ZodLiteral<"api">;
|
|
38
39
|
method: import("zod").ZodEnum<{
|
|
39
40
|
DELETE: "DELETE";
|
|
40
41
|
GET: "GET";
|
|
@@ -56,11 +57,33 @@ export declare const probeParsers: {
|
|
|
56
57
|
kind: import("zod").ZodLiteral<"absent">;
|
|
57
58
|
}, import("zod/v4/core").$strict>], "kind">;
|
|
58
59
|
}, import("zod/v4/core").$strict>;
|
|
59
|
-
}, import("zod/v4/core").$strict
|
|
60
|
-
readonly response: import("zod").ZodObject<{
|
|
60
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
61
61
|
probeId: import("zod").ZodString;
|
|
62
62
|
interfaceId: import("zod").ZodString;
|
|
63
63
|
operationId: import("zod").ZodString;
|
|
64
|
+
kind: import("zod").ZodLiteral<"cli">;
|
|
65
|
+
executable: import("zod").ZodString;
|
|
66
|
+
subcommandPath: import("zod").ZodArray<import("zod").ZodString>;
|
|
67
|
+
channels: import("zod").ZodObject<{
|
|
68
|
+
argument: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodType<import("../core/schemas/primitives.ts").JsonValue, unknown, import("zod/v4/core").$ZodTypeInternals<import("../core/schemas/primitives.ts").JsonValue, unknown>>>;
|
|
69
|
+
option: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodType<import("../core/schemas/primitives.ts").JsonValue, unknown, import("zod/v4/core").$ZodTypeInternals<import("../core/schemas/primitives.ts").JsonValue, unknown>>>;
|
|
70
|
+
environment: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>;
|
|
71
|
+
stdin: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
72
|
+
kind: import("zod").ZodLiteral<"json">;
|
|
73
|
+
value: import("zod").ZodType<import("../core/schemas/primitives.ts").JsonValue, unknown, import("zod/v4/core").$ZodTypeInternals<import("../core/schemas/primitives.ts").JsonValue, unknown>>;
|
|
74
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
75
|
+
kind: import("zod").ZodLiteral<"text">;
|
|
76
|
+
value: import("zod").ZodString;
|
|
77
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
78
|
+
kind: import("zod").ZodLiteral<"absent">;
|
|
79
|
+
}, import("zod/v4/core").$strict>], "kind">;
|
|
80
|
+
}, import("zod/v4/core").$strict>;
|
|
81
|
+
}, import("zod/v4/core").$strict>], "kind">;
|
|
82
|
+
readonly response: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
83
|
+
probeId: import("zod").ZodString;
|
|
84
|
+
interfaceId: import("zod").ZodString;
|
|
85
|
+
operationId: import("zod").ZodString;
|
|
86
|
+
kind: import("zod").ZodLiteral<"api">;
|
|
64
87
|
status: import("zod").ZodInt;
|
|
65
88
|
headers: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>;
|
|
66
89
|
body: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
@@ -72,5 +95,38 @@ export declare const probeParsers: {
|
|
|
72
95
|
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
73
96
|
kind: import("zod").ZodLiteral<"absent">;
|
|
74
97
|
}, import("zod/v4/core").$strict>], "kind">;
|
|
75
|
-
}, import("zod/v4/core").$strict
|
|
98
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
99
|
+
probeId: import("zod").ZodString;
|
|
100
|
+
interfaceId: import("zod").ZodString;
|
|
101
|
+
operationId: import("zod").ZodString;
|
|
102
|
+
kind: import("zod").ZodLiteral<"cli">;
|
|
103
|
+
exitCode: import("zod").ZodInt;
|
|
104
|
+
stdout: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
105
|
+
kind: import("zod").ZodLiteral<"json">;
|
|
106
|
+
value: import("zod").ZodType<import("../core/schemas/primitives.ts").JsonValue, unknown, import("zod/v4/core").$ZodTypeInternals<import("../core/schemas/primitives.ts").JsonValue, unknown>>;
|
|
107
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
108
|
+
kind: import("zod").ZodLiteral<"text">;
|
|
109
|
+
value: import("zod").ZodString;
|
|
110
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
111
|
+
kind: import("zod").ZodLiteral<"absent">;
|
|
112
|
+
}, import("zod/v4/core").$strict>], "kind">;
|
|
113
|
+
stderr: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
114
|
+
kind: import("zod").ZodLiteral<"json">;
|
|
115
|
+
value: import("zod").ZodType<import("../core/schemas/primitives.ts").JsonValue, unknown, import("zod/v4/core").$ZodTypeInternals<import("../core/schemas/primitives.ts").JsonValue, unknown>>;
|
|
116
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
117
|
+
kind: import("zod").ZodLiteral<"text">;
|
|
118
|
+
value: import("zod").ZodString;
|
|
119
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
120
|
+
kind: import("zod").ZodLiteral<"absent">;
|
|
121
|
+
}, import("zod/v4/core").$strict>], "kind">;
|
|
122
|
+
artifacts: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
123
|
+
kind: import("zod").ZodLiteral<"json">;
|
|
124
|
+
value: import("zod").ZodType<import("../core/schemas/primitives.ts").JsonValue, unknown, import("zod/v4/core").$ZodTypeInternals<import("../core/schemas/primitives.ts").JsonValue, unknown>>;
|
|
125
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
126
|
+
kind: import("zod").ZodLiteral<"text">;
|
|
127
|
+
value: import("zod").ZodString;
|
|
128
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
129
|
+
kind: import("zod").ZodLiteral<"absent">;
|
|
130
|
+
}, import("zod/v4/core").$strict>], "kind">>;
|
|
131
|
+
}, import("zod/v4/core").$strict>], "kind">;
|
|
76
132
|
};
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* Type re-exports use `export type`; `biome.json` sets
|
|
11
11
|
* `style.useExportType: "error"`.
|
|
12
12
|
*/
|
|
13
|
+
export type { RuntimeFaultCode } from '../core/schemas/faults.ts';
|
|
14
|
+
export { RUNTIME_FAULT_CODES, RuntimeFault } from '../core/schemas/faults.ts';
|
|
13
15
|
export type { ClockReadRequest, ClockReadResponse, CorpusResolveRequest, CorpusResolveResponse, FileReadRequest, FileReadResponse, FileWriteRequest, FileWriteResponse, ProbeObservation, ProbeObservedBody, ProbeRequest, ProbeRequestBody, } from '../core/schemas/port-messages.ts';
|
|
14
16
|
export type { ProbeTargetAuthorization, ProbeTargetPolicy, } from '../core/schemas/probe-policy.ts';
|
|
15
17
|
export type { ClockPort } from '../ports/clock-port.ts';
|
package/dist/testing/index.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* Type re-exports use `export type`; `biome.json` sets
|
|
11
11
|
* `style.useExportType: "error"`.
|
|
12
12
|
*/
|
|
13
|
+
export { RUNTIME_FAULT_CODES, RuntimeFault } from '../core/schemas/faults.js';
|
|
13
14
|
export { clockReadParsers } from '../ports/clock-port.js';
|
|
14
15
|
export { corpusResolveParsers } from '../ports/corpus-port.js';
|
|
15
16
|
export { probeParsers } from '../ports/environment-probe-port.js';
|
|
@@ -6,6 +6,35 @@
|
|
|
6
6
|
* Each of the thirteen builds its own `'resolves'` subject and reads
|
|
7
7
|
* `underlyingCalls()` from a counter starting at zero, so every count below is
|
|
8
8
|
* absolute.
|
|
9
|
+
*
|
|
10
|
+
* **This suite certifies an adapter for the `api` mechanism and says nothing
|
|
11
|
+
* about the `cli` one.** Every scenario is HTTP: redirects, methods, schemes,
|
|
12
|
+
* an anomalous status. `ProbeSubject` requires an unauthorized-method request,
|
|
13
|
+
* a redirecting request and a not-found request, none of which a command
|
|
14
|
+
* adapter has. So an adapter that runs commands cannot present a subject here,
|
|
15
|
+
* and an adapter that passes all nineteen has been shown nothing about whether
|
|
16
|
+
* it can run one safely: it may deny an unmapped executable or execute a shell
|
|
17
|
+
* string, and this suite cannot tell the difference.
|
|
18
|
+
*
|
|
19
|
+
* That is a real gap in the published surface and it is wider than this suite.
|
|
20
|
+
* `ProbeTargetPolicy` has one authorization shape and every field in it is
|
|
21
|
+
* HTTP: scheme, host, port, resolved addresses, methods, safe methods,
|
|
22
|
+
* redirects, request and response byte caps. **A command interface cannot be
|
|
23
|
+
* authorized at all**, so AD-35's "an adapter denies by default and permits
|
|
24
|
+
* only what that mapping names" has nothing to name for the mechanism this
|
|
25
|
+
* release adds, and a conformance arm built on top of a policy that cannot
|
|
26
|
+
* express a command authorization would certify against nothing.
|
|
27
|
+
*
|
|
28
|
+
* Closing it is a declaration first and a suite second: a command
|
|
29
|
+
* authorization naming a permitted executable, the subcommand paths and
|
|
30
|
+
* environment keys it may carry, and its own elapsed and output-byte caps;
|
|
31
|
+
* then the denials to certify — an executable no mapping names, a refusal to
|
|
32
|
+
* accept a pre-built argument vector, a non-zero exit as an observation rather
|
|
33
|
+
* than a fault, each cap enforced. That is a design addition to the published
|
|
34
|
+
* surface rather than a repair, and it is not made here. Until it exists an
|
|
35
|
+
* adopter writing a command adapter has no policy to declare and no harness to
|
|
36
|
+
* run, and this comment is here so nobody concludes from a green run that they
|
|
37
|
+
* have either.
|
|
9
38
|
*/
|
|
10
39
|
import type { ProbeRequest } from '../core/schemas/port-messages.ts';
|
|
11
40
|
import type { ProbeTargetPolicy } from '../core/schemas/probe-policy.ts';
|
|
@@ -23,9 +23,9 @@ const PROBE_ASSERTIONS = [
|
|
|
23
23
|
request: (subject) => subject.faultingRequest,
|
|
24
24
|
expectation: {
|
|
25
25
|
kind: 'resolves',
|
|
26
|
-
check: (observation) => observation.status === 500
|
|
26
|
+
check: (observation) => observation.kind === 'api' && observation.status === 500
|
|
27
27
|
? undefined
|
|
28
|
-
: `observed status ${observation.status}, expected 500`,
|
|
28
|
+
: `observed ${observation.kind === 'api' ? `status ${observation.status}` : 'a command observation'}, expected status 500`,
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
31
|
{
|
|
@@ -114,14 +114,42 @@ const PROBE_ASSERTIONS = [
|
|
|
114
114
|
expectation: { kind: 'rejects', code: CAPPED },
|
|
115
115
|
},
|
|
116
116
|
];
|
|
117
|
-
function checkResolved(assertion, expectation, value) {
|
|
117
|
+
function checkResolved(assertion, expectation, value, request) {
|
|
118
118
|
const parsed = probeParsers.response.safeParse(value);
|
|
119
119
|
if (!parsed.success) {
|
|
120
120
|
return titledOutcome(assertion.id, assertion.title, false, 'the resolved value is not a schema-valid ProbeObservation');
|
|
121
121
|
}
|
|
122
|
+
// Schema validity is not correlation. Both messages are unions now, so an
|
|
123
|
+
// adapter can answer a command request with a schema-valid HTTP observation
|
|
124
|
+
// and satisfy every assertion below without running a command or consulting
|
|
125
|
+
// a policy. The four echoed fields are what tie one answer to one question,
|
|
126
|
+
// and `ProbeRequest.probeId`'s own description already says the port returns
|
|
127
|
+
// them unchanged.
|
|
128
|
+
const mismatch = echoMismatch(request, parsed.data);
|
|
129
|
+
if (mismatch !== undefined) {
|
|
130
|
+
return titledOutcome(assertion.id, assertion.title, false, mismatch);
|
|
131
|
+
}
|
|
122
132
|
const complaint = expectation.check?.(parsed.data);
|
|
123
133
|
return titledOutcome(assertion.id, assertion.title, complaint === undefined, complaint ?? '');
|
|
124
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Which of the four echoed fields the observation failed to return unchanged,
|
|
137
|
+
* or `undefined` when it answered the question it was asked.
|
|
138
|
+
*/
|
|
139
|
+
function echoMismatch(request, observation) {
|
|
140
|
+
const echoed = [
|
|
141
|
+
['kind', request.kind, observation.kind],
|
|
142
|
+
['probeId', request.probeId, observation.probeId],
|
|
143
|
+
['interfaceId', request.interfaceId, observation.interfaceId],
|
|
144
|
+
['operationId', request.operationId, observation.operationId],
|
|
145
|
+
];
|
|
146
|
+
for (const [field, asked, answered] of echoed) {
|
|
147
|
+
if (asked === answered)
|
|
148
|
+
continue;
|
|
149
|
+
return `observed ${field} "${answered}" for a request carrying "${asked}", so the answer does not correlate with the question`;
|
|
150
|
+
}
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
125
153
|
function checkRejected(assertion, expectedCode, error) {
|
|
126
154
|
const view = faultView(error);
|
|
127
155
|
if (view === undefined) {
|
|
@@ -153,12 +181,13 @@ async function runProbeAssertion(assertion, subject) {
|
|
|
153
181
|
if (!run.ok) {
|
|
154
182
|
return titledOutcome(assertion.id, assertion.title, false, run.detail);
|
|
155
183
|
}
|
|
156
|
-
const
|
|
184
|
+
const request = assertion.request(subject);
|
|
185
|
+
const settled = await settle(run.built.port(request, new AbortController().signal));
|
|
157
186
|
let result;
|
|
158
187
|
if (assertion.expectation.kind === 'resolves') {
|
|
159
188
|
result =
|
|
160
189
|
settled.kind === 'resolved'
|
|
161
|
-
? checkResolved(assertion, assertion.expectation, settled.value)
|
|
190
|
+
? checkResolved(assertion, assertion.expectation, settled.value, request)
|
|
162
191
|
: titledOutcome(assertion.id, assertion.title, false, `rejected with ${describeThrown(settled.error)} instead of returning an observation`);
|
|
163
192
|
}
|
|
164
193
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eval-quality",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Compile disciplined Behavioral Evaluation Contracts and score their ability to catch known defects.",
|
|
5
5
|
"author": "Murat Ozcan",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -87,11 +87,17 @@
|
|
|
87
87
|
"check:ad28-registry": "node scripts/check-ad28-registry.ts",
|
|
88
88
|
"generate:ad31-table": "node scripts/generate-ad31-table.ts",
|
|
89
89
|
"check:ad31-table": "node scripts/check-ad31-table.ts",
|
|
90
|
+
"generate:ad33-table": "node scripts/generate-ad33-table.ts",
|
|
91
|
+
"check:ad33-table": "node scripts/check-ad33-table.ts",
|
|
92
|
+
"generate:ad21-table": "node scripts/generate-ad21-table.ts",
|
|
93
|
+
"check:ad21-table": "node scripts/check-ad21-table.ts",
|
|
90
94
|
"check:layers": "node scripts/check-dependency-direction.ts",
|
|
91
95
|
"check:lineage": "node scripts/check-lineage-ownership.ts",
|
|
92
96
|
"check:boundary": "node scripts/check-package-boundary.ts",
|
|
93
97
|
"generate:dev-corpus": "node scripts/generate-dev-corpus.ts",
|
|
94
98
|
"check:corpus": "node scripts/check-dev-corpus.ts",
|
|
99
|
+
"generate:worked-example": "node scripts/generate-worked-example.ts",
|
|
100
|
+
"check:worked-example": "node scripts/check-worked-example.ts",
|
|
95
101
|
"check:website-deps": "node scripts/audit-lockfile-age.mjs --lockfile website/package-lock.json && node scripts/check-licenses.mjs --lockfile website/package-lock.json",
|
|
96
102
|
"check:shareable": "node scripts/check-shareable.mjs",
|
|
97
103
|
"bench:digest": "node scripts/bench-digest.ts",
|
|
@@ -99,9 +105,12 @@
|
|
|
99
105
|
"docs:build": "node tools/build-docs.mjs",
|
|
100
106
|
"docs:preview": "npm --prefix website run preview",
|
|
101
107
|
"docs:validate-links": "node tools/validate-doc-links.js",
|
|
108
|
+
"release:patch": "gh workflow run publish.yml --ref main -f bump=patch",
|
|
109
|
+
"release:minor": "gh workflow run publish.yml --ref main -f bump=minor",
|
|
110
|
+
"release:major": "gh workflow run publish.yml --ref main -f bump=major",
|
|
102
111
|
"release:prepare": "node scripts/release-prepare.mjs",
|
|
103
|
-
"release:publish": "gh workflow run publish.yml --ref main",
|
|
104
|
-
"validate": "npm run build && npm run typecheck && npm run lint && npm run check:docs && npm run check:doc-invocations && npm run check:shareable && npm run lint:spine && npm run check:vectors && npm run check:schemas && npm run check:ad5-registry && npm run check:ad28-registry && npm run check:ad31-table && npm run check:layers && npm run check:lineage && npm run check:boundary && npm run check:corpus && npm run check:website-deps && npm run test:coverage",
|
|
112
|
+
"release:publish": "gh workflow run publish.yml --ref main -f bump=none",
|
|
113
|
+
"validate": "npm run build && npm run typecheck && npm run lint && npm run check:docs && npm run check:doc-invocations && npm run check:shareable && npm run lint:spine && npm run check:vectors && npm run check:schemas && npm run check:ad5-registry && npm run check:ad28-registry && npm run check:ad31-table && npm run check:ad33-table && npm run check:ad21-table && npm run check:layers && npm run check:lineage && npm run check:boundary && npm run check:corpus && npm run check:worked-example && npm run check:website-deps && npm run test:coverage",
|
|
105
114
|
"prepack": "npm run clean && npm run build",
|
|
106
115
|
"prepublishOnly": "node scripts/assert-publish-authorized.mjs"
|
|
107
116
|
},
|