eval-quality 0.1.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/LICENSE +190 -0
- package/README.md +355 -0
- package/corpus/dev/README.md +36 -0
- package/corpus/dev/compile-seal-example/brief.json +1 -0
- package/corpus/dev/compile-seal-example/contract.json +1 -0
- package/corpus/dev/contracts/absent-collection-locations.json +1 -0
- package/corpus/dev/contracts/absent-sibling-groups.json +1 -0
- package/corpus/dev/contracts/absent-success-indicator.json +1 -0
- package/corpus/dev/contracts/empty-channel-roles.json +1 -0
- package/corpus/dev/contracts/empty-collection-locations.json +1 -0
- package/corpus/dev/contracts/empty-request-shapes.json +1 -0
- package/corpus/dev/contracts/empty-sibling-groups.json +1 -0
- package/corpus/dev/contracts/no-collection-quantifier.json +1 -0
- package/corpus/dev/contracts/no-operation-inventory.json +1 -0
- package/corpus/dev/contracts/no-read-back-relation.json +1 -0
- package/corpus/dev/contracts/no-state-change-marker.json +1 -0
- package/corpus/dev/contracts/no-type-violating-step.json +1 -0
- package/corpus/dev/contracts/per-key-split-oracles.json +1 -0
- package/corpus/dev/contracts/satisfied-declarations.json +1 -0
- package/corpus/dev/contracts/single-required-response-key.json +1 -0
- package/corpus/dev/contracts/split-indicator-oracle.json +1 -0
- package/corpus/dev/contracts/unaddressed-parameter-sibling.json +1 -0
- package/corpus/dev/contracts/unnamed-reference-set.json +1 -0
- package/corpus/dev/contracts/wrong-cardinality-form.json +1 -0
- package/corpus/dev/index.json +1 -0
- package/dist/adapters/index.d.ts +12 -0
- package/dist/adapters/index.js +3 -0
- package/dist/adapters/local-corpus-adapter.d.ts +7 -0
- package/dist/adapters/local-corpus-adapter.js +78 -0
- package/dist/adapters/node-file-system-adapter.d.ts +7 -0
- package/dist/adapters/node-file-system-adapter.js +39 -0
- package/dist/adapters/port-boundary.d.ts +18 -0
- package/dist/adapters/port-boundary.js +83 -0
- package/dist/adapters/system-clock-adapter.d.ts +10 -0
- package/dist/adapters/system-clock-adapter.js +18 -0
- package/dist/application/compile.d.ts +4 -0
- package/dist/application/compile.js +24 -0
- package/dist/application/diagnostics.d.ts +22 -0
- package/dist/application/diagnostics.js +18 -0
- package/dist/application/index.d.ts +23 -0
- package/dist/application/index.js +17 -0
- package/dist/application/invoke-port.d.ts +2 -0
- package/dist/application/invoke-port.js +45 -0
- package/dist/application/preflight.d.ts +27 -0
- package/dist/application/preflight.js +131 -0
- package/dist/application/seal.d.ts +4 -0
- package/dist/application/seal.js +28 -0
- package/dist/application/serialize.d.ts +6 -0
- package/dist/application/serialize.js +9 -0
- package/dist/cli/arguments.d.ts +28 -0
- package/dist/cli/arguments.js +167 -0
- package/dist/cli/exit-codes.d.ts +36 -0
- package/dist/cli/exit-codes.js +39 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +143 -0
- package/dist/cli/render.d.ts +26 -0
- package/dist/cli/render.js +53 -0
- package/dist/cli/run.d.ts +41 -0
- package/dist/cli/run.js +203 -0
- package/dist/core/canonical/canonicalize.d.ts +1 -0
- package/dist/core/canonical/canonicalize.js +113 -0
- package/dist/core/canonical/digest.d.ts +7 -0
- package/dist/core/canonical/digest.js +81 -0
- package/dist/core/canonical/scan-json.d.ts +1 -0
- package/dist/core/canonical/scan-json.js +298 -0
- package/dist/core/canonical/value-domain.d.ts +4 -0
- package/dist/core/canonical/value-domain.js +113 -0
- package/dist/core/compile/compile.d.ts +24 -0
- package/dist/core/compile/compile.js +67 -0
- package/dist/core/compile/declarations.d.ts +5 -0
- package/dist/core/compile/declarations.js +22 -0
- package/dist/core/compile/expression-legality.d.ts +14 -0
- package/dist/core/compile/expression-legality.js +346 -0
- package/dist/core/compile/forbidden-inputs.d.ts +5 -0
- package/dist/core/compile/forbidden-inputs.js +19 -0
- package/dist/core/compile/interface-inventory.d.ts +10 -0
- package/dist/core/compile/interface-inventory.js +55 -0
- package/dist/core/compile/oracle-alignment.d.ts +14 -0
- package/dist/core/compile/oracle-alignment.js +93 -0
- package/dist/core/compile/reachability.d.ts +17 -0
- package/dist/core/compile/reachability.js +177 -0
- package/dist/core/compile/rubrics.d.ts +55 -0
- package/dist/core/compile/rubrics.js +198 -0
- package/dist/core/compile/scripting-bound.d.ts +5 -0
- package/dist/core/compile/scripting-bound.js +151 -0
- package/dist/core/compile/sensitivity-witness.d.ts +73 -0
- package/dist/core/compile/sensitivity-witness.js +232 -0
- package/dist/core/compile/waivers.d.ts +3 -0
- package/dist/core/compile/waivers.js +21 -0
- package/dist/core/coverage/coverage.d.ts +18 -0
- package/dist/core/coverage/coverage.js +47 -0
- package/dist/core/coverage/relevance.d.ts +75 -0
- package/dist/core/coverage/relevance.js +186 -0
- package/dist/core/coverage/rules.d.ts +7 -0
- package/dist/core/coverage/rules.js +18 -0
- package/dist/core/coverage/satisfaction.d.ts +107 -0
- package/dist/core/coverage/satisfaction.js +415 -0
- package/dist/core/coverage/table.d.ts +26 -0
- package/dist/core/coverage/table.js +222 -0
- package/dist/core/declared-inputs.d.ts +16 -0
- package/dist/core/declared-inputs.js +18 -0
- package/dist/core/evaluate/evidence-resolution.d.ts +54 -0
- package/dist/core/evaluate/evidence-resolution.js +153 -0
- package/dist/core/evaluate/operators.d.ts +87 -0
- package/dist/core/evaluate/operators.js +350 -0
- package/dist/core/evaluate/resolution.d.ts +40 -0
- package/dist/core/evaluate/resolution.js +336 -0
- package/dist/core/evaluate/resolved-value.d.ts +9 -0
- package/dist/core/evaluate/resolved-value.js +6 -0
- package/dist/core/failure-codes.d.ts +18 -0
- package/dist/core/failure-codes.js +50 -0
- package/dist/core/lineage/chain.d.ts +49 -0
- package/dist/core/lineage/chain.js +210 -0
- package/dist/core/lineage/freeze.d.ts +12 -0
- package/dist/core/lineage/freeze.js +35 -0
- package/dist/core/lineage/stage-table.d.ts +43 -0
- package/dist/core/lineage/stage-table.js +106 -0
- package/dist/core/preflight/plan.d.ts +67 -0
- package/dist/core/preflight/plan.js +313 -0
- package/dist/core/preflight/projection.d.ts +40 -0
- package/dist/core/preflight/projection.js +96 -0
- package/dist/core/preflight/reduce.d.ts +8 -0
- package/dist/core/preflight/reduce.js +180 -0
- package/dist/core/preflight/witness-evidence.d.ts +42 -0
- package/dist/core/preflight/witness-evidence.js +88 -0
- package/dist/core/probe/target-policy.d.ts +63 -0
- package/dist/core/probe/target-policy.js +328 -0
- package/dist/core/schemas/artifact-reference.d.ts +19 -0
- package/dist/core/schemas/artifact-reference.js +30 -0
- package/dist/core/schemas/artifact.d.ts +1153 -0
- package/dist/core/schemas/artifact.js +84 -0
- package/dist/core/schemas/constraint-ledger.d.ts +57 -0
- package/dist/core/schemas/constraint-ledger.js +143 -0
- package/dist/core/schemas/eval-contract.d.ts +402 -0
- package/dist/core/schemas/eval-contract.js +147 -0
- package/dist/core/schemas/evaluator-configuration.d.ts +37 -0
- package/dist/core/schemas/evaluator-configuration.js +43 -0
- package/dist/core/schemas/evidence-artifact.d.ts +471 -0
- package/dist/core/schemas/evidence-artifact.js +232 -0
- package/dist/core/schemas/expression.d.ts +197 -0
- package/dist/core/schemas/expression.js +284 -0
- package/dist/core/schemas/faults.d.ts +9 -0
- package/dist/core/schemas/faults.js +32 -0
- package/dist/core/schemas/interface.d.ts +417 -0
- package/dist/core/schemas/interface.js +115 -0
- package/dist/core/schemas/isolation-manifest.d.ts +136 -0
- package/dist/core/schemas/isolation-manifest.js +92 -0
- package/dist/core/schemas/lineage.d.ts +21 -0
- package/dist/core/schemas/lineage.js +28 -0
- package/dist/core/schemas/oracle.d.ts +72 -0
- package/dist/core/schemas/oracle.js +35 -0
- package/dist/core/schemas/plan.d.ts +115 -0
- package/dist/core/schemas/plan.js +58 -0
- package/dist/core/schemas/pointer.d.ts +63 -0
- package/dist/core/schemas/pointer.js +94 -0
- package/dist/core/schemas/port-messages.d.ts +103 -0
- package/dist/core/schemas/port-messages.js +90 -0
- package/dist/core/schemas/preflight-verdict.d.ts +60 -0
- package/dist/core/schemas/preflight-verdict.js +38 -0
- package/dist/core/schemas/primitives.d.ts +78 -0
- package/dist/core/schemas/primitives.js +121 -0
- package/dist/core/schemas/private-artifact-manifest.d.ts +56 -0
- package/dist/core/schemas/private-artifact-manifest.js +46 -0
- package/dist/core/schemas/probe-body.d.ts +25 -0
- package/dist/core/schemas/probe-body.js +23 -0
- package/dist/core/schemas/probe-policy.d.ts +76 -0
- package/dist/core/schemas/probe-policy.js +33 -0
- package/dist/core/schemas/probe.d.ts +189 -0
- package/dist/core/schemas/probe.js +82 -0
- package/dist/core/schemas/publish.d.ts +30 -0
- package/dist/core/schemas/publish.js +135 -0
- package/dist/core/schemas/reference-set.d.ts +18 -0
- package/dist/core/schemas/reference-set.js +27 -0
- package/dist/core/schemas/rubric.d.ts +62 -0
- package/dist/core/schemas/rubric.js +68 -0
- package/dist/core/schemas/scoring-policy.d.ts +28 -0
- package/dist/core/schemas/scoring-policy.js +51 -0
- package/dist/core/schemas/sealed-evaluator-brief.d.ts +80 -0
- package/dist/core/schemas/sealed-evaluator-brief.js +59 -0
- package/dist/core/schemas/sealed-run-record.d.ts +382 -0
- package/dist/core/schemas/sealed-run-record.js +215 -0
- package/dist/core/schemas/sensitivity-witness.d.ts +138 -0
- package/dist/core/schemas/sensitivity-witness.js +86 -0
- package/dist/core/schemas/verdict.d.ts +25 -0
- package/dist/core/schemas/verdict.js +20 -0
- package/dist/core/schemas/waiver.d.ts +17 -0
- package/dist/core/schemas/waiver.js +24 -0
- package/dist/core/seal/derived-reference.d.ts +36 -0
- package/dist/core/seal/derived-reference.js +383 -0
- package/dist/core/seal/direction-prose.d.ts +13 -0
- package/dist/core/seal/direction-prose.js +120 -0
- package/dist/core/seal/plan-index.d.ts +63 -0
- package/dist/core/seal/plan-index.js +155 -0
- package/dist/core/seal/scripting-audit.d.ts +15 -0
- package/dist/core/seal/scripting-audit.js +51 -0
- package/dist/core/seal/seal.d.ts +18 -0
- package/dist/core/seal/seal.js +155 -0
- package/dist/core/stage-contracts.d.ts +30 -0
- package/dist/core/stage-contracts.js +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +22 -0
- package/dist/ports/clock-port.d.ts +13 -0
- package/dist/ports/clock-port.js +7 -0
- package/dist/ports/corpus-port.d.ts +16 -0
- package/dist/ports/corpus-port.js +7 -0
- package/dist/ports/environment-probe-port.d.ts +76 -0
- package/dist/ports/environment-probe-port.js +32 -0
- package/dist/ports/file-system-port.d.ts +27 -0
- package/dist/ports/file-system-port.js +11 -0
- package/dist/ports/port.d.ts +33 -0
- package/dist/ports/port.js +14 -0
- package/dist/testing/conformance.d.ts +88 -0
- package/dist/testing/conformance.js +281 -0
- package/dist/testing/index.d.ts +26 -0
- package/dist/testing/index.js +18 -0
- package/dist/testing/probe-conformance.d.ts +45 -0
- package/dist/testing/probe-conformance.js +186 -0
- package/package.json +130 -0
- package/schemas/artifact-reference.schema.json +64 -0
- package/schemas/eval-contract.schema.json +2145 -0
- package/schemas/evaluator-configuration.schema.json +199 -0
- package/schemas/evidence-artifact.schema.json +1229 -0
- package/schemas/isolation-manifest.schema.json +394 -0
- package/schemas/preflight-verdict.schema.json +114 -0
- package/schemas/private-artifact-manifest.schema.json +103 -0
- package/schemas/probe.schema.json +1151 -0
- package/schemas/rubric.schema.json +148 -0
- package/schemas/scoring-policy.schema.json +90 -0
- package/schemas/sealed-evaluator-brief.schema.json +268 -0
- package/schemas/sealed-run-record.schema.json +875 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ArtifactReference } from './artifact-reference.js';
|
|
2
|
+
import { EvalContract } from './eval-contract.js';
|
|
3
|
+
import { EvaluatorConfiguration } from './evaluator-configuration.js';
|
|
4
|
+
import { EvidenceArtifact } from './evidence-artifact.js';
|
|
5
|
+
import { IsolationManifest } from './isolation-manifest.js';
|
|
6
|
+
import { PreflightVerdict } from './preflight-verdict.js';
|
|
7
|
+
import { PrivateArtifactManifest } from './private-artifact-manifest.js';
|
|
8
|
+
import { Probe } from './probe.js';
|
|
9
|
+
import { Rubric } from './rubric.js';
|
|
10
|
+
import { ScoringPolicy } from './scoring-policy.js';
|
|
11
|
+
import { SealedEvaluatorBrief } from './sealed-evaluator-brief.js';
|
|
12
|
+
import { SealedRunRecord } from './sealed-run-record.js';
|
|
13
|
+
/**
|
|
14
|
+
* The phrase an artifact with no predecessor uses in its own description, per
|
|
15
|
+
* AD-24. Exported so a test checks one string instead of six hard-coded
|
|
16
|
+
* copies.
|
|
17
|
+
*/
|
|
18
|
+
export const NO_PRIOR_ART = 'no prior art';
|
|
19
|
+
/**
|
|
20
|
+
* The Structural Seed's inventory, closed at twelve, held as data: the
|
|
21
|
+
* prior-art test, the constraint ledger's lineage-entry generation, and the
|
|
22
|
+
* published-schema export walk all read it instead of a second hard-coded
|
|
23
|
+
* list.
|
|
24
|
+
*
|
|
25
|
+
* Lineage fields live in `lineage.ts`, not here, because eleven of the twelve
|
|
26
|
+
* schema modules import them (every entry but `artifact-reference`, the one
|
|
27
|
+
* with `carriesLineage: false`); importing this registry back from any of
|
|
28
|
+
* those would close a circular import.
|
|
29
|
+
*/
|
|
30
|
+
export const INTERCHANGE_ARTIFACTS = {
|
|
31
|
+
'eval-contract': {
|
|
32
|
+
schema: EvalContract,
|
|
33
|
+
priorArt: 'eval-contract',
|
|
34
|
+
carriesLineage: true,
|
|
35
|
+
},
|
|
36
|
+
rubric: { schema: Rubric, priorArt: null, carriesLineage: true },
|
|
37
|
+
'sealed-evaluator-brief': {
|
|
38
|
+
schema: SealedEvaluatorBrief,
|
|
39
|
+
priorArt: null,
|
|
40
|
+
carriesLineage: true,
|
|
41
|
+
},
|
|
42
|
+
'sealed-run-record': {
|
|
43
|
+
schema: SealedRunRecord,
|
|
44
|
+
priorArt: 'h0-run-result',
|
|
45
|
+
carriesLineage: true,
|
|
46
|
+
},
|
|
47
|
+
'isolation-manifest': {
|
|
48
|
+
schema: IsolationManifest,
|
|
49
|
+
priorArt: 'isolation-manifest',
|
|
50
|
+
carriesLineage: true,
|
|
51
|
+
},
|
|
52
|
+
'evaluator-configuration': {
|
|
53
|
+
schema: EvaluatorConfiguration,
|
|
54
|
+
priorArt: null,
|
|
55
|
+
carriesLineage: true,
|
|
56
|
+
},
|
|
57
|
+
probe: { schema: Probe, priorArt: 'h0-ground-truth', carriesLineage: true },
|
|
58
|
+
'artifact-reference': {
|
|
59
|
+
schema: ArtifactReference,
|
|
60
|
+
priorArt: 'artifact-ref',
|
|
61
|
+
carriesLineage: false,
|
|
62
|
+
},
|
|
63
|
+
'private-artifact-manifest': {
|
|
64
|
+
schema: PrivateArtifactManifest,
|
|
65
|
+
priorArt: 'private-evidence-manifest',
|
|
66
|
+
carriesLineage: true,
|
|
67
|
+
},
|
|
68
|
+
'preflight-verdict': {
|
|
69
|
+
schema: PreflightVerdict,
|
|
70
|
+
priorArt: null,
|
|
71
|
+
carriesLineage: true,
|
|
72
|
+
},
|
|
73
|
+
'scoring-policy': {
|
|
74
|
+
schema: ScoringPolicy,
|
|
75
|
+
priorArt: null,
|
|
76
|
+
carriesLineage: true,
|
|
77
|
+
},
|
|
78
|
+
'evidence-artifact': {
|
|
79
|
+
schema: EvidenceArtifact,
|
|
80
|
+
priorArt: null,
|
|
81
|
+
carriesLineage: true,
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
export const INTERCHANGE_ARTIFACT_KEYS = Object.keys(INTERCHANGE_ARTIFACTS);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** the constraints the published JSON Schema cannot carry unaided. */
|
|
2
|
+
import { type InterchangeArtifactKey } from './artifact.ts';
|
|
3
|
+
import type { JsonValue } from './primitives.ts';
|
|
4
|
+
/**
|
|
5
|
+
* The JSON Schema dialect an injected keyword belongs to. Named rather than
|
|
6
|
+
* assumed: `items: false` bounds a tuple only beside 2020-12's `prefixItems`,
|
|
7
|
+
* but under draft-7 a tuple exports as `items: [...]`, so the same injection
|
|
8
|
+
* there overwrites the tuple and every operand list rejects everything.
|
|
9
|
+
* `publish.ts` reads this before injecting.
|
|
10
|
+
*/
|
|
11
|
+
export type JsonSchemaDialect = 'draft-2020-12';
|
|
12
|
+
/** No third disposition: an entry with neither is a constraint nobody is accountable for. */
|
|
13
|
+
export type ConstraintDisposition = {
|
|
14
|
+
readonly kind: 'inject';
|
|
15
|
+
readonly dialect: JsonSchemaDialect;
|
|
16
|
+
readonly keywords: Readonly<Record<string, JsonValue>>;
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: 'not-expressible';
|
|
19
|
+
readonly reason: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Where in the exported document the entry applies. Zod inlines the root
|
|
23
|
+
* schema and emits no `$id`, so "the artifact itself" and "a shared
|
|
24
|
+
* definition" are structurally different addresses, not just two names.
|
|
25
|
+
*
|
|
26
|
+
* Every address names its `artifact`: with twelve roots, two artifacts can
|
|
27
|
+
* carry the same rule, so `location.artifact` picks the right one.
|
|
28
|
+
*
|
|
29
|
+
* This module sits downstream of all twelve schema modules; none of them may
|
|
30
|
+
* import it back, which is why `plan.ts` exports `BINDING_CHANNEL_NON_EMPTY`
|
|
31
|
+
* to the ledger rather than the reverse.
|
|
32
|
+
*/
|
|
33
|
+
export type ConstraintLocation = {
|
|
34
|
+
readonly kind: 'root';
|
|
35
|
+
readonly artifact: InterchangeArtifactKey;
|
|
36
|
+
} | {
|
|
37
|
+
readonly kind: 'definition';
|
|
38
|
+
readonly artifact: InterchangeArtifactKey;
|
|
39
|
+
readonly name: string;
|
|
40
|
+
};
|
|
41
|
+
export type ConstraintLedgerEntry = {
|
|
42
|
+
/** stable identifier; callers cite this, never the prose. */
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly location: ConstraintLocation;
|
|
45
|
+
/**
|
|
46
|
+
* Where the shape exports as a discriminated union, the `op` const of the
|
|
47
|
+
* branch this entry addresses. Named by discriminator rather than by index,
|
|
48
|
+
* so reordering the union cannot silently move an entry onto another branch.
|
|
49
|
+
*/
|
|
50
|
+
readonly branch: string | null;
|
|
51
|
+
/** the property within that shape or branch, or null when the shape itself carries it. */
|
|
52
|
+
readonly field: string | null;
|
|
53
|
+
readonly statement: string;
|
|
54
|
+
readonly disposition: ConstraintDisposition;
|
|
55
|
+
};
|
|
56
|
+
export declare const CONSTRAINT_LEDGER: readonly ConstraintLedgerEntry[];
|
|
57
|
+
export declare const constraintLedgerEntry: (id: string) => ConstraintLedgerEntry | undefined;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/** the constraints the published JSON Schema cannot carry unaided. */
|
|
2
|
+
import { INTERCHANGE_ARTIFACTS, } from './artifact.js';
|
|
3
|
+
import { TUPLE_ARITY } from './expression.js';
|
|
4
|
+
import { BINDING_CHANNEL_NON_EMPTY } from './plan.js';
|
|
5
|
+
// Verified on the pin: z.tuple([a, b]) exports `prefixItems` alone (no
|
|
6
|
+
// minItems, maxItems, or items), so the published schema accepts the
|
|
7
|
+
// one-operand and three-operand `equality` that Zod rejects. Arity is the one
|
|
8
|
+
// deliberate exception to the admit-rule, so it is the one place the export
|
|
9
|
+
// must be repaired rather than relaxed.
|
|
10
|
+
// AD-10's manifestation witness put an `Expression` on `Defect`, so the same
|
|
11
|
+
// twelve tuples export into `probe.schema.json` too. `publish.ts` filters
|
|
12
|
+
// injection by `entry.location.artifact`, so an eval-contract-addressed entry
|
|
13
|
+
// repairs nothing there: both artifacts need their own twelve.
|
|
14
|
+
// The eval-contract ids keep their original `operator-arity-<op>` spelling. An
|
|
15
|
+
// entry id is a stable citation (`constraintLedgerEntry` looks one up by it), so
|
|
16
|
+
// renaming twelve of them for symmetry would break every existing reference and
|
|
17
|
+
// buy nothing.
|
|
18
|
+
const ARITY_ARTIFACTS = ['eval-contract', 'probe'];
|
|
19
|
+
const arityEntries = ARITY_ARTIFACTS.flatMap((artifact) => Object.entries(TUPLE_ARITY).map(([op, arity]) => ({
|
|
20
|
+
id: artifact === 'eval-contract'
|
|
21
|
+
? `operator-arity-${op}`
|
|
22
|
+
: `operator-arity-${artifact}-${op}`,
|
|
23
|
+
location: {
|
|
24
|
+
kind: 'definition',
|
|
25
|
+
artifact,
|
|
26
|
+
name: 'Expression',
|
|
27
|
+
},
|
|
28
|
+
branch: op,
|
|
29
|
+
field: 'operands',
|
|
30
|
+
statement: `\`${op}\` takes exactly ${arity} operand${arity === 1 ? '' : 's'}.`,
|
|
31
|
+
disposition: {
|
|
32
|
+
kind: 'inject',
|
|
33
|
+
dialect: 'draft-2020-12',
|
|
34
|
+
keywords: { minItems: arity, items: false },
|
|
35
|
+
},
|
|
36
|
+
})));
|
|
37
|
+
/**
|
|
38
|
+
* AD-4 requires operand types in the published schema. Arity is structural
|
|
39
|
+
* and repaired above; per-position operand types cannot be, since narrowing
|
|
40
|
+
* a position would delete `malformed-operator-expression`'s operand-type
|
|
41
|
+
* limb. The declaration lives instead in each operator's `operands`
|
|
42
|
+
* description; enforcement is the compiler's. Recorded here so the split is a
|
|
43
|
+
* decision, not an omission.
|
|
44
|
+
*/
|
|
45
|
+
const operandTypeEntry = {
|
|
46
|
+
id: 'operator-operand-types',
|
|
47
|
+
location: {
|
|
48
|
+
kind: 'definition',
|
|
49
|
+
artifact: 'eval-contract',
|
|
50
|
+
name: 'Expression',
|
|
51
|
+
},
|
|
52
|
+
branch: null,
|
|
53
|
+
field: null,
|
|
54
|
+
statement: 'Each operator admits only certain operand forms in each position (AD-4). The legality is declared per branch in text and enforced by the compiler.',
|
|
55
|
+
disposition: {
|
|
56
|
+
kind: 'not-expressible',
|
|
57
|
+
reason: "Narrowing a tuple position in the schema would convert AD-26's \"a reference-set operand in any position other than the three named above fails under `malformed-operator-expression`\" into an anonymous schema-parse failure, deleting that code's operand-type limb. AD-4 still requires the types to be *expressed* in the published schema, and a ledger entry is not an expression, so each branch's `operands` carries the legality in its description — the same treatment AD-36's numeric domain gets on JsonValue. Consequence for the compiler: the operand-type limb of `malformed-operator-expression` is entirely its own, with no schema-side partial coverage to rely on.",
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
// One entry per lineage-bearing artifact (eleven, not twelve): the registry's
|
|
61
|
+
// `carriesLineage` flag is the filter, since `ArtifactReference` carries no
|
|
62
|
+
// `parentDigest` to resolve against. Generated from the registry the way
|
|
63
|
+
// arity entries are generated from `TUPLE_ARITY`, so a hand-written count
|
|
64
|
+
// cannot drift.
|
|
65
|
+
//
|
|
66
|
+
// Two of the eleven are union-rooted (`Probe` on `expectedClean`,
|
|
67
|
+
// `EvidenceArtifact` on `mode`): a union root exports no `properties` object,
|
|
68
|
+
// so the lineage fields are spread into every branch to keep the
|
|
69
|
+
// biconditional binding both.
|
|
70
|
+
const lineageEntries = Object.entries(INTERCHANGE_ARTIFACTS)
|
|
71
|
+
.filter(([, entry]) => entry.carriesLineage)
|
|
72
|
+
.map(([key]) => ({
|
|
73
|
+
id: `lineage-${key}`,
|
|
74
|
+
location: { kind: 'root', artifact: key },
|
|
75
|
+
branch: null,
|
|
76
|
+
field: 'parentDigest',
|
|
77
|
+
statement: '`parentDigest` is null if and only if `revisionCount` is 0 (AD-29).',
|
|
78
|
+
disposition: {
|
|
79
|
+
kind: 'not-expressible',
|
|
80
|
+
reason: 'A cross-field rule. Encoding it as a Zod refinement would make it invisible to every non-TypeScript consumer and turn it into a disagreement in the published-schema differential check, so it is stated in the field description instead and left to the reader that validates a presented chain.',
|
|
81
|
+
},
|
|
82
|
+
}));
|
|
83
|
+
// AD-18's prohibition, on the two artifacts it binds hardest. Neither is
|
|
84
|
+
// expressible: both carry opaque caller strings, and no pattern separates an
|
|
85
|
+
// opaque handle from a credential pasted into one.
|
|
86
|
+
const secretsProhibitionEntries = [
|
|
87
|
+
[
|
|
88
|
+
'private-artifact-manifest',
|
|
89
|
+
'A private-artifact manifest never contains a private path, credential, or domain value (AD-18).',
|
|
90
|
+
],
|
|
91
|
+
[
|
|
92
|
+
'evaluator-configuration',
|
|
93
|
+
'An evaluator configuration carries no credential, token, real name, email address, account identifier, or transaction content in its identity, its tool inventory, its permission inventory, or its decoding parameters (AD-18).',
|
|
94
|
+
],
|
|
95
|
+
].map(([artifact, statement]) => ({
|
|
96
|
+
id: `secrets-prohibition-${artifact}`,
|
|
97
|
+
location: { kind: 'root', artifact },
|
|
98
|
+
branch: null,
|
|
99
|
+
field: null,
|
|
100
|
+
statement,
|
|
101
|
+
disposition: {
|
|
102
|
+
kind: 'not-expressible',
|
|
103
|
+
reason: 'The fields this binds are opaque caller strings by AD-8 and AD-24, and no schema over an opaque string distinguishes a resolvable handle from a secret pasted into one. Expressing it would require a pattern that also rejects legitimate opaque references. It is stated in each artifact description and enforced by review and by the AD-18 publication guard, which is a mechanism rather than a schema.',
|
|
104
|
+
},
|
|
105
|
+
}));
|
|
106
|
+
export const CONSTRAINT_LEDGER = [
|
|
107
|
+
...arityEntries,
|
|
108
|
+
{
|
|
109
|
+
id: BINDING_CHANNEL_NON_EMPTY,
|
|
110
|
+
location: {
|
|
111
|
+
kind: 'definition',
|
|
112
|
+
artifact: 'eval-contract',
|
|
113
|
+
name: 'InputBindingChannel',
|
|
114
|
+
},
|
|
115
|
+
branch: null,
|
|
116
|
+
field: null,
|
|
117
|
+
statement: 'A declared input-binding channel names at least one parameter. An unbound channel is `null`, never `{}`. Inject at the definition root: `minProperties` is ignored on a non-object instance, so it constrains the object branch and leaves the null branch alone.',
|
|
118
|
+
disposition: {
|
|
119
|
+
kind: 'inject',
|
|
120
|
+
dialect: 'draft-2020-12',
|
|
121
|
+
keywords: { minProperties: 1 },
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: 'json-value-numeric-domain',
|
|
126
|
+
location: {
|
|
127
|
+
kind: 'definition',
|
|
128
|
+
artifact: 'eval-contract',
|
|
129
|
+
name: 'JsonValue',
|
|
130
|
+
},
|
|
131
|
+
branch: null,
|
|
132
|
+
field: null,
|
|
133
|
+
statement: 'Every number is a finite binary64 value and every integer lies in the safe-integer range (AD-36).',
|
|
134
|
+
disposition: {
|
|
135
|
+
kind: 'not-expressible',
|
|
136
|
+
reason: "JSON Schema cannot express finiteness, and re-walking the value container in Zod would buy nothing an export can carry — the lexical scanner in `core/canonical/scan-json.ts` already rejects 1e999 and unsafe integers before any parse. AD-36 requires the restriction to be *expressed* in the published schema and a ledger entry is not an expression, so the domain statement lives in JsonValue's own description, which lands once on the shared definition. Consequence for the published-schema differential check: it must not generate non-finite or unsafe-integer literals inside JsonValue and call the result a disagreement.",
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
operandTypeEntry,
|
|
140
|
+
...lineageEntries,
|
|
141
|
+
...secretsProhibitionEntries,
|
|
142
|
+
];
|
|
143
|
+
export const constraintLedgerEntry = (id) => CONSTRAINT_LEDGER.find((entry) => entry.id === id);
|