@inventarch/compliance 2.0.0 → 3.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.
Files changed (69) hide show
  1. package/README.md +4 -2
  2. package/SPEC.md +20 -1
  3. package/dist/conformance/bind.d.ts +42 -0
  4. package/dist/conformance/bind.d.ts.map +1 -0
  5. package/dist/conformance/bind.js +129 -0
  6. package/dist/conformance/bind.js.map +1 -0
  7. package/dist/conformance/corpus.d.ts +13 -0
  8. package/dist/conformance/corpus.d.ts.map +1 -0
  9. package/dist/conformance/corpus.js +43 -0
  10. package/dist/conformance/corpus.js.map +1 -0
  11. package/dist/conformance/evidence-fixtures.d.ts +5 -0
  12. package/dist/conformance/evidence-fixtures.d.ts.map +1 -0
  13. package/dist/conformance/evidence-fixtures.js +257 -0
  14. package/dist/conformance/evidence-fixtures.js.map +1 -0
  15. package/dist/conformance/evidence.d.ts +52 -0
  16. package/dist/conformance/evidence.d.ts.map +1 -0
  17. package/dist/conformance/evidence.js +96 -0
  18. package/dist/conformance/evidence.js.map +1 -0
  19. package/dist/conformance/inventory.d.ts +36 -0
  20. package/dist/conformance/inventory.d.ts.map +1 -0
  21. package/dist/conformance/inventory.generated.d.ts +4 -0
  22. package/dist/conformance/inventory.generated.d.ts.map +1 -0
  23. package/dist/conformance/inventory.generated.js +2230 -0
  24. package/dist/conformance/inventory.generated.js.map +1 -0
  25. package/dist/conformance/inventory.js +15 -0
  26. package/dist/conformance/inventory.js.map +1 -0
  27. package/dist/conformance/refusals.d.ts +5 -0
  28. package/dist/conformance/refusals.d.ts.map +1 -0
  29. package/dist/conformance/refusals.js +372 -0
  30. package/dist/conformance/refusals.js.map +1 -0
  31. package/dist/conformance/verify-kernel.d.ts +9 -0
  32. package/dist/conformance/verify-kernel.d.ts.map +1 -0
  33. package/dist/conformance/verify-kernel.js +49 -0
  34. package/dist/conformance/verify-kernel.js.map +1 -0
  35. package/dist/conformance/verify.d.ts +15 -0
  36. package/dist/conformance/verify.d.ts.map +1 -0
  37. package/dist/conformance/verify.js +170 -0
  38. package/dist/conformance/verify.js.map +1 -0
  39. package/dist/graph-checks.d.ts +8 -0
  40. package/dist/graph-checks.d.ts.map +1 -1
  41. package/dist/graph-checks.js +17 -0
  42. package/dist/graph-checks.js.map +1 -1
  43. package/dist/host-plugin.d.ts +2 -2
  44. package/dist/host-plugin.d.ts.map +1 -1
  45. package/dist/host-plugin.js +1 -1
  46. package/dist/index.d.ts +6 -1
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +2 -1
  49. package/dist/index.js.map +1 -1
  50. package/dist/kernel.d.ts +25 -0
  51. package/dist/kernel.d.ts.map +1 -0
  52. package/dist/kernel.js +290 -0
  53. package/dist/kernel.js.map +1 -0
  54. package/dist/report.d.ts +12 -0
  55. package/dist/report.d.ts.map +1 -1
  56. package/dist/report.js +30 -9
  57. package/dist/report.js.map +1 -1
  58. package/dist/schema.d.ts.map +1 -1
  59. package/dist/schema.js +17 -1
  60. package/dist/schema.js.map +1 -1
  61. package/dist/types.d.ts +5 -0
  62. package/dist/types.d.ts.map +1 -1
  63. package/dist/types.js.map +1 -1
  64. package/dist/values.d.ts.map +1 -1
  65. package/dist/values.js +6 -15
  66. package/dist/values.js.map +1 -1
  67. package/fixtures/loop/.ia/src/systems/workspace-system/schemas/distribution.schema.ia +11 -0
  68. package/fixtures/refusals.ts +2 -453
  69. package/package.json +3 -3
package/README.md CHANGED
@@ -2,8 +2,10 @@
2
2
 
3
3
  Pure checks over compiled IA records and graph views. validateSchema supports bootstrap; validateGraphSchema uses admitted active graph relationships. Schema/system admission, fragments, declared coverage, selectors, exact variant ambiguity, check declarations and structural adoption feed evaluate(graph, options), which returns a stable immutable revision report.
4
4
 
5
- Supply source diagnostics, discovered system folders and matching-revision kernel/fixture evidence explicitly. Missing observations or adoption clause evaluators produce not-evaluated. Case declarations establish coverage, not execution. Only supplied clause evaluators can establish adoption results. No filesystem I/O, model loop or capability execution occurs here.
5
+ Supply source diagnostics, discovered system folders and matching-revision kernel/fixture evidence explicitly. Missing observations or adoption clause evaluators produce not-evaluated. Case declarations establish coverage, not execution. Only supplied clause evaluators can establish adoption results. Apart from the conformance producers below, which read this package's own files, no filesystem I/O, model loop or capability execution occurs here.
6
6
 
7
7
  An optional trusted evaluator catalog (createEvaluatorCatalog, SPEC C25–C29) lets a host register namespaced evaluators for a check's evaluator id (check.implementation, else check.runs), resolve adopted obligations (including the strict-typing-v1 profile), validate evidence receipts and decide whether a transition may be admitted. These are pure functions. The host supplies implementations, codecs, predicates, facts, receipts, the minimum receipt trust, a service-receipt verifier and the current time. It owns execution, scheduling and persistence. Calls without a catalog behave exactly as before. The exported Finding code union now also includes EVIDENCE_CODES; those codes are outside the repository fixture gate (SPEC C29).
8
8
 
9
- [SPEC.md](SPEC.md) owns interfaces, refusal codes and delivery evidence. The package depends on @inventarch/language and @inventarch/graph. Run pnpm compliance:check at the workspace root to verify the real native corpus, kernel, conformance pairs and refusal-code boundaries. --json emits the report; the command prints unavailable checks and exits unsuccessfully on failed checks.
9
+ Native conformance evidence (SPEC C31) is opt-in. verifyKernel() regenerates the kernel and compares it with the running language; verifyFixtures() runs the package-v1 profile of the shipped language, refusal and evidence fixtures and lists the hook, runtime, execution and publication suites it does not run. evaluate(graph, {conformance: {inputs, kernel, fixtures}}) binds that evidence to the graph whose revision inputs it is given. Evidence about another graph, floor or toolchain stays not-evaluated, and unbranded or copied evidence is refused. Verified results carry basis 'verified' and add Report.conformance for the verified checks, a fixture result with the suites it did not run; results from the caller-asserted evidence map carry basis 'caller-asserted' and keep only their check, scope, outcome and findings. The evidence verifies the installed package against itself, so pin kernelDigest and inventoryDigest and rely on npm integrity for the package.
10
+
11
+ [SPEC.md](SPEC.md) owns interfaces, refusal codes and delivery evidence. The package depends on @inventarch/language and @inventarch/graph. Run pnpm compliance:check at the workspace root to verify the real native corpus, kernel, conformance pairs, refusal-code boundaries and the package-v1 inventory. --json emits the report; the command prints unavailable checks and exits unsuccessfully on failed checks.
package/SPEC.md CHANGED
@@ -18,7 +18,7 @@ C04b. Under `closed`, a declared body section admits only the keys the schema de
18
18
 
19
19
  C04a. A field whose schema row carries a W0 narrowing (language L19a) is checked further once its value matches its type, each narrowing yielding at most one finding per field occurrence, list items included: `values` (from `id in [...]`) requires every scalar or quoted text to be a member, compared exactly, else FIELD-VALUE; `target` (from `ref to <word>`) requires every reference's discriminator to equal the word, else FIELD-REF-TARGET, and otherwise, when the caller supplied a reference lookup, warns FIELD-REF-MISSING for a reference no admitted record declares; `form` (from `text form <form>`) requires every text to match the form, else FIELD-FORM. `validateSchema` looks references up in its pool (the subject included) through `resolveTarget` over the candidates sharing the reference's word and name; `validateGraphSchema` looks them up in the admitted graph. An ambiguous target is not missing: identity ties are graph-owned. A narrowed field with no matching value, an absent optional section, or a value that already failed its type raises no narrowing finding.
20
20
 
21
- C05. Value semantics (`matchesType`) and text forms (`matchesForm`, C04a): `iso-date` admits exactly `YYYY-MM-DD` where the month is 01–12 and the day exists in that month, leap years by the Gregorian rule; no time, zone or single-digit part. Text admits scalar, string or prose (including empty quoted text); id admits scalar/string matching an ASCII letter followed by letters/digits/hyphens; qname admits scalar/string with exactly four nonempty canonical identity slots (lowercase system/kind/facet/name, closed kind); number admits a finite decimal scalar/string with optional sign, fraction and exponent, no empty/hex/Infinity; ref admits only typed sigil references; flag admits none (a bare key) or scalar true/false. Block is not a flag. `list of T` requires a list and validates every item against T; an empty list is valid because the dialect has no nonempty-list constraint. Type recognition is over compiled values, not lexical matching of IA source.
21
+ C05. Value semantics (`matchesType`) and text forms (`matchesForm`, C04a): `iso-date` admits exactly `YYYY-MM-DD` where the month is 01–12 and the day exists in that month, leap years by the Gregorian rule; no time, zone or single-digit part. Text admits scalar, string or prose (including empty quoted text); id admits scalar/string matching an ASCII letter followed by letters/digits/hyphens; qname admits scalar/string with exactly four nonempty canonical identity slots (lowercase system/kind/facet/name, closed kind); number admits a finite decimal scalar/string with optional sign, fraction and exponent, no empty/hex/Infinity; ref admits only typed sigil references; flag admits none (a bare key) or scalar true/false. Block is not a flag. `list of T` requires a list and validates every item against T; an empty list is valid because the dialect has no nonempty-list constraint, with one exception (2026-10-12, milestone generation-binding lane D, operator ruling): a stated empty `authority.moves` on a record whose word is `mandate` (the word agent-system registers, which the runtime's mandate resolver reads by the same test), when its schema declares that key as agent-system's does, is FIELD-VALUE, an error at that field, each such occurrence on its own, whose message says `authority.moves` must name at least one kernel move when stated. The agent-system design reads a stated move list as one or more kernel moves and the runtime's mandate reader refuses an empty one, so admitting it let every mandate-gated command refuse with an unreadable profile; the dialect cannot say "one or more", so the check is keyed to the `mandate` word in schema field validation, as COMP-STEWARD keys a system's steward to agent-system's `agent` word (`src/systems.ts`, `validateSystems`), and db admission (`validateGraphSchema`) and the bootstrap `validateSchema` (`native:check`) both apply it. An absent `authority.moves` stays valid and restricts no move, and every other empty list, `authority.excluded-words []` and `authority.covers []` included, stays valid. The refusal fixtures observe it (boundary `IA-COMP-FIELD-VALUE/mandate-moves-empty`). Type recognition is over compiled values, not lexical matching of IA source.
22
22
 
23
23
  C06. Edge obligations use logical active predicates in the direction the rule's spelling carries: an `out` rule counts the record's active edges by their target endpoint, an `in` rule the active edges whose target is the record by their source endpoint. Either relation may be asserted on the record or, in the reciprocal spelling, on another admitted record. Count distinct (endpoint identity, fragment) pairs, where a fragment joins the pair only when it addresses the counted endpoint: an assertion on the record contributes its fragment, and a reciprocal assertion's fragment addresses the record and is dropped. Equivalent reciprocal assertions do not inflate cardinality. Match the counted endpoint by closed kind or discriminator. Required one/one-or-more means at least one; one and optional cap at one even for a may row. A required field with type flag is present when its bare key occurs. A must optional row has zero minimum (optional explicitly permits absence). A may one-or-more row permits absence but has no maximum. Unconditional edges can establish a static obligation. Conditioned edges or unresolved/ambiguous targets that could change its answer produce EDGE-UNRESOLVED and not-evaluated unless an independently certain failure already establishes fail. A dangling edge cannot be counted as a pass. This checker does not select a coordinate or execute contracts.
24
24
 
@@ -62,6 +62,8 @@ C18 repository consumer: [tools/compliance](../../tools/compliance/SPEC.md#found
62
62
 
63
63
  C19. COMP-KERNEL and COMP-FIXTURES require caller-supplied matching-revision assessments from actual verification. No supplied result or a stale result produces NOT-EVALUATED. A pure language-fixture runner can consume source and expected products/diagnostics/format companions without reading files; tools discover fixtures and record observed results. Every named refusal must have a tested failing case; unavailable fixture coverage stays explicit. General prose scenario execution remains outside this stage.
64
64
 
65
+ C19 note: C31 is the package producer of these assessments. `verifyKernel` and `verifyFixtures` run the verification in-process, and `evaluate`'s `conformance` option binds their evidence to the graph. The caller-asserted `evidence` map remains, and results taken from it are labelled `caller-asserted`.
66
+
65
67
  C20. Public checks use IA-COMP-FRAGMENT-MISSING, COVERAGE-MISSING, COVERAGE-KIND, SELECTOR-INVALID, CHECK-UNKNOWN, CHECK-CONFLICT, VARIANT-AMBIGUOUS, ADOPTION-FAILED, NOT-EVALUATED and FIXTURE-MISMATCH in addition to C07/C11. NOT-EVALUATED is warning evidence that changes the outcome; warning consent-empty/shadow evidence does not fail an otherwise completed check. Source parse/graph codes remain namespaced by their owners. Every implementation delivery records full-suite, negative/native and built-consumer evidence here.
66
68
 
67
69
  Stage C Task1 delivered: graph schema/fragment/coverage, selector/check-id/source/consent/identity checks and immutable assessments. Native 153-node closure passes these checks. Thirteen graph-check tests cover removed cases, conditional coverage, missing targets/fragments, inverse cell fragments, late resolution, source-code preservation, malformed selectors/runners and consent-refusal diagnostic consumption. Full suite: 1453 tests/48files; typecheck/build/kernel/dependency pass. Exact variant ambiguity, adoption and assembled revision reports remain next.
@@ -117,8 +119,25 @@ Resolver not-applicable with evidence does not block. An optional obligation nev
117
119
 
118
120
  C29 (evaluation profiles, OBL-02; facilitator decision D6). `EVALUATION_PROFILES['strict-typing-v1']` is the consumer contract id mapping to three requirements: `configuration`, `included-file-coverage` and `compiler-run`. `profileOccurrences('strict-typing-v1', binding)` expands one selected law or contract occurrence into three required occurrences with requirements `strict-typing-v1/<name>`, each discharged by a host catalog evaluator named in the binding. A built-in id, a non-catalog id, an unknown profile or a missing or extra mapping is a TypeError. The profile is not a native word. Declarations, native cases and check records never become results by presence: the three obligations are admitted only with valid passed receipts, so a real compiler run requires an installed evaluator and its receipt.
119
121
 
122
+ C30 (structural COMP-CHECK; milestone generation-binding, plan amendments C15 and C21). `validateCheckStructure(node)` is COMP-CHECK as a structural admission reads it: CHECK-CONFLICT for two different evaluators and CHECK-UNKNOWN ("the check names no evaluator") for none, as C16 has them, and a pass for any one named evaluator, built in or not, because which implementation serves it is decided when the check is bound against a host catalog. `evaluate(graph, {checks})` takes `strict` (the default, C16 or C26 with `catalog`) or `structural`. `validateCheck` stays the strict admission every existing reader uses.
123
+
120
124
  Facilitator decisions recorded for LK-04 repair (2026-09-28): D1 package metadata never weakens a root-adopted obligation (C27); D2 admission is bound to a verified resolver-issued resolution (C27, C28); D3 service trust needs a host verifier, `minimumTrust` is required and trust is recorded (C28); D4 only CHECK_IDS are built in, `options.builtins` only reserves ids (C25, C26); D5 COMP-CHECK treats revoked as an error and unavailable as not-evaluated (C26); D6 the strict-typing-v1 producer mapping belongs to this package (C29).
121
125
 
122
126
  Public type note: `Finding['code']` now also admits `EvidenceCode`, an additive widening of the exported union; consumers that switch exhaustively over `Finding['code']` must handle the new codes. C25–C29 codes are exported as `EVIDENCE_CODES`, separate from COMP_CODES. The repository fixture gate now requires successful producer observations for both inventories. `tools/compliance/evidence-fixtures.ts` executes 28 catalog, binding, obligation, receipt and admission refusals through the actual pure APIs, after valid catalog/receipt/admission positive controls. Removing or failing the sole observation for any evidence code fails COMP-FIXTURES. Direct package tests remain in tests/evaluator-catalog.test.ts. Synthetic local unsigned receipts establish no live host, writer, reviewer or service authorization.
123
127
 
124
128
  LK-04 delivered (2026-09-28): C25–C28 with 23 tests. LK-04 repair (2026-09-28) added D1–D6, the M2/M3 fixes and C29, bringing tests/evaluator-catalog.test.ts to 35 tests. They cover EVAL-Q01, Q02, Q07, Q08, the producer side of Q03, OBL-01..03 and each catalog, binding, resolution, receipt and admission refusal, plus a byte-identical report regression without a catalog. The pre-change report digests on the native corpus (with and without supplied observations) were unchanged after the original change and after the repair.
129
+
130
+ ## Native conformance evidence (package-v1)
131
+
132
+ C31 (native conformance evidence). The package produces COMP-KERNEL and COMP-FIXTURES evidence itself, and `evaluate(graph, {conformance: {inputs, kernel, fixtures}})` binds it to the graph. It is opt-in: without `conformance`, nothing runs.
133
+ - `verifyKernel(floor = KERNEL_SOURCES)` regenerates the kernel from `floor` in-process against the closed contract. The pure generator lives in `src/kernel.ts`; `tools/kernel` keeps the reader, the drift check and `kernel:check`. It compares every regenerated constant, `KERNEL_DIGEST` and `KERNEL_SOURCES` included, with the running `@inventarch/language`'s public exports. `PRESENT_PHRASES` is not exported, so it is compared through what it determines: `VERB_PHRASES` and each phrase's `verbOf`. Only the public entry is read, so neither the generator nor `kernel:check` needs built output. A floor that does not regenerate, or regenerates to anything else, fails, so a floor with one byte changed fails. `floorDigest` is the digest of that floor, computed as `KERNEL_DIGEST` is.
134
+ - `verifyFixtures()` runs the `package-v1` profile: the language fixtures this package ships, checked against `src/conformance/inventory.generated.ts`, and the refusal and evidence boundary suites over the conformance corpus the inventory embeds. It reads only the package's own files and writes nothing. It fails on any of these: a missing, extra or changed fixture file; a companion its clause and mode do not admit; a fixture listed under another clause or mode; a duplicate inventory path; an inventory that differs from `INVENTORY_DIGEST`; required codes that differ from the running LANG, GRAPH, COMP and EVIDENCE codes; a boundary case the inventory does not list or that no longer runs; and any required code that no passing failing case observes. A fixture directory that cannot be read leaves the profile not-evaluated. So does a listed file that cannot be read: it is not evaluated and suspends the coverage judgement, while other failures still fail.
135
+ - Out of profile. Every fixture evidence object lists the suites the profile does not run, each with its reason and the codes only it observes: HOOK, RUNTIME, escalation, EXEC and PUBLICATION. A `package-v1` pass says nothing about hooks, the runtime, execution or publication on that host; `tools/compliance` still runs those suites. The mandate fixtures are pure, but they need `@inventarch/runtime` and observe RUNTIME codes, so they stay out of profile.
136
+ - Evidence objects are deeply frozen and recorded by kind in module-private WeakSets. `isConformanceEvidence(value, subject?)` accepts only an object that `verifyKernel` or `verifyFixtures` returned in the same module instance. Each object carries `subject`, `profile`, `toolchain {languageVersion, kernelDigest, compliance, node}` and `assessment`. Kernel evidence adds `floorDigest`; fixture evidence adds `inventoryDigest`, `observedCodes` and `outOfProfile`. The words are C28's; none of C28's catalog, trust or admission machinery applies.
137
+ - Binding. `inputs` are the graph's `RevisionInputs`. `evaluate` reads them once, by index and without Array methods (so no `Symbol.species` constructor is consulted), into frozen plain data of exactly `{languageVersion, kernelDigest, sources: [{path, text, location: {placement: {kind, band, reach}, provenance}}]}`, and every rule below uses that copy, so a getter cannot show the revision one value and a later rule another. Both checks are NOT-EVALUATED when `revisionOf(graph.registry, inputs)` is not `graph.revision`, or when `inputs.languageVersion` or `inputs.kernelDigest` is not the running language's. Each check is also NOT-EVALUATED when its own evidence's toolchain is not the running one, so one stale object leaves the other bound. COMP-KERNEL is also NOT-EVALUATED when an input source has a `.ia/src/floor/` path or floor placement but not both, or when the digest of the sources that have both is not `kernel.floorDigest`. Otherwise each check takes its evidence's assessment. A COMP-KERNEL failure therefore needs verification that ran on the graph's own floor and failed.
138
+ - Refusals (TypeError): an unbranded, cloned, copied or hand-built object; a kernel object and a fixture object in each other's slots; `inputs` that are not an object with a sources array; a path, text, placement kind, reach, provenance, language version or kernel digest that is not a string, or a band that is not a number; and `evidence` together with `conformance`.
139
+ - Labels. A bound result's verdict carries `basis: 'verified'` only when its evidence was evaluated, that is, passed or failed. Bound evidence that is itself not-evaluated stays not-evaluated, with no basis. `Report.conformance` is present when at least one result is verified. It carries the profile and the running toolchain, plus `kernel {floorDigest}` when COMP-KERNEL is verified and `fixtures {inventoryDigest, observedCodes, outOfProfile}` when COMP-FIXTURES is, so a verified fixture result always names the suites it did not run. A result taken from the caller-asserted `evidence` map carries `basis: 'caller-asserted'`, with its outcome unchanged. The assembler rebuilds that result from its check, scope, outcome and findings, so any other key a caller put on the verdict no longer reaches the report. Only the assembler sets `basis`. Reports that pass neither option keep their outcome and digest.
140
+ - Self-verification limit. The evidence is produced by the code it verifies, so a tampered package can change code and expectations together and still pass. The trust root stays npm integrity plus the consumer's pinned `kernelDigest` and `inventoryDigest`. The binding also trusts the caller's `Graph`, `graph.revision` included: a copy of a graph with a forged revision, passed with inputs that recompute it, binds. Branding graphs is out of scope. The contract only makes a stale or mismatched toolchain, floor or graph visible.
141
+ - The inventory gate is `tools/compliance/inventory.ts --check|--write`, and `compliance:check` runs it. Any fixture, companion, corpus or boundary change fails until the inventory is regenerated.
142
+
143
+ C31 delivered: tests/report.test.ts pins the refusals, the binding rules (including three getter attacks on the inputs and one stale object at a time), the labels, the per-check summary and the profile's tamper cases; tools/compliance/check.test.ts pins the inventory gate. Each of 28 spot-checked mutants, each removing one of these rules, was red. No test can fail a check that the evidence's inventory digest is the running one, because branding admits only the producing module instance, so the binding has no such rule. `kernel:check`, `public-language:check` and `vocabulary:check` pass on a fresh copy with no built output. Measured on the built package (Node 22.22.2, Windows), one process: verifyKernel about 30 ms cold and verifyFixtures about 440 ms cold, with about 70 MB heap. Both pass under Node's permission model with read access to the packages only and no write grant.
@@ -0,0 +1,42 @@
1
+ import type { Graph, RevisionInputs } from '@inventarch/graph';
2
+ import type { Assessment } from '../types.js';
3
+ import type { ConformanceProfile, ConformanceToolchain, FixtureEvidence, KernelEvidence } from './evidence.js';
4
+ import type { OutOfProfileSuite } from './inventory.js';
5
+ /** `ReportOptions.conformance`: the graph's own revision inputs and the evidence verifyKernel and verifyFixtures returned. */
6
+ export interface ConformanceOptions {
7
+ readonly inputs: RevisionInputs;
8
+ readonly kernel: KernelEvidence;
9
+ readonly fixtures: FixtureEvidence;
10
+ }
11
+ /** `Report.conformance`: present when at least one check is verified evidence bound to the graph. */
12
+ export interface ConformanceSummary {
13
+ readonly profile: ConformanceProfile;
14
+ readonly toolchain: ConformanceToolchain;
15
+ /** Present when COMP-KERNEL is verified: the floor it verified. */
16
+ readonly kernel?: {
17
+ readonly floorDigest: string;
18
+ };
19
+ /** Present when COMP-FIXTURES is verified: what the profile ran, observed and did not run. */
20
+ readonly fixtures?: {
21
+ readonly inventoryDigest: string;
22
+ readonly observedCodes: readonly string[];
23
+ readonly outOfProfile: readonly OutOfProfileSuite[];
24
+ };
25
+ }
26
+ export interface BoundConformance {
27
+ /** The assessment for each check; `verified` only where the evidence bound and was evaluated. */
28
+ readonly results: readonly {
29
+ readonly assessment: Assessment;
30
+ readonly verified: boolean;
31
+ }[];
32
+ readonly summary?: ConformanceSummary;
33
+ }
34
+ /**
35
+ * Binds conformance evidence to `graph` (C31). Unbranded, copied or swapped evidence and inputs that are not revision
36
+ * inputs are a TypeError. The inputs are read once. Evidence counts only for the graph whose revision the inputs
37
+ * recompute, loaded for the running language version and kernel digest, and only when the running toolchain produced
38
+ * it; COMP-KERNEL also needs the inputs' floor (the sources under `.ia/src/floor/` at floor placement) to be the floor
39
+ * it verified. Anything else, including a source with only one of that path and that placement, is NOT-EVALUATED.
40
+ */
41
+ export declare function bindConformance(graph: Graph, conformance: ConformanceOptions): BoundConformance;
42
+ //# sourceMappingURL=bind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../../src/conformance/bind.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAkB,MAAM,mBAAmB,CAAC;AAG/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/G,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,8HAA8H;AAC9H,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;CACpC;AACD,qGAAqG;AACrG,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,oBAAoB,CAAC;IACzC,mEAAmE;IACnE,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,8FAA8F;IAC9F,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAClB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;QACjC,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;QAC1C,QAAQ,CAAC,YAAY,EAAE,SAAS,iBAAiB,EAAE,CAAC;KACrD,CAAC;CACH;AACD,MAAM,WAAW,gBAAgB;IAC/B,iGAAiG;IACjG,QAAQ,CAAC,OAAO,EAAE,SAAS;QAAE,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAC7F,QAAQ,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC;CACvC;AAsDD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,GAAG,gBAAgB,CAkE/F"}
@@ -0,0 +1,129 @@
1
+ import { KERNEL_DIGEST, LANGUAGE_VERSION, canonicalPath } from '@inventarch/language';
2
+ import { revisionOf, stableSerialize } from '@inventarch/graph';
3
+ import { kernelDigest } from '../kernel.js';
4
+ import { assess } from '../types.js';
5
+ import { isConformanceEvidence, runningToolchain } from './evidence.js';
6
+ const notEvaluated = (check, reason) => assess(check, 'graph', [
7
+ { code: 'IA-COMP-NOT-EVALUATED', severity: 'warning', path: '', line: 1, message: `${check}: ${reason}` },
8
+ ]);
9
+ const record = (value, label) => {
10
+ if (typeof value !== 'object' || value === null)
11
+ throw new TypeError(`${label} must be an object`);
12
+ return value;
13
+ };
14
+ const text = (value, label) => {
15
+ if (typeof value !== 'string')
16
+ throw new TypeError(`${label} must be a string`);
17
+ return value;
18
+ };
19
+ /**
20
+ * The caller's inputs read once into frozen plain data, so every rule below sees what `revisionOf` hashed: a getter
21
+ * cannot show the revision one value and the version or floor checks another.
22
+ */
23
+ function snapshot(inputs) {
24
+ const { sources, languageVersion, kernelDigest: digest } = record(inputs, 'conformance.inputs');
25
+ if (!Array.isArray(sources))
26
+ throw new TypeError('conformance.inputs.sources must be an array');
27
+ // An index loop into a fresh array literal, reading the length once: Array methods would build their results through
28
+ // the caller's constructor[Symbol.species], which can define other objects in place of the copies validated here.
29
+ const length = sources.length;
30
+ if (typeof length !== 'number' || !Number.isSafeInteger(length) || length < 0)
31
+ throw new TypeError('conformance.inputs.sources must be an array');
32
+ const copied = [];
33
+ for (let index = 0; index < length; index++) {
34
+ const at = `conformance.inputs.sources[${index}]`;
35
+ const { path, text: body, location } = record(sources[index], at);
36
+ const { placement, provenance } = record(location, `${at}.location`);
37
+ const { kind, band, reach } = record(placement, `${at}.location.placement`);
38
+ if (typeof band !== 'number')
39
+ throw new TypeError(`${at}.location.placement.band must be a number`);
40
+ copied.push(Object.freeze({
41
+ path: text(path, `${at}.path`),
42
+ text: text(body, `${at}.text`),
43
+ location: Object.freeze({
44
+ placement: Object.freeze({
45
+ kind: text(kind, `${at}.location.placement.kind`),
46
+ band,
47
+ reach: text(reach, `${at}.location.placement.reach`),
48
+ }),
49
+ provenance: text(provenance, `${at}.location.provenance`),
50
+ }),
51
+ }));
52
+ }
53
+ return Object.freeze({
54
+ languageVersion: text(languageVersion, 'conformance.inputs.languageVersion'),
55
+ kernelDigest: text(digest, 'conformance.inputs.kernelDigest'),
56
+ sources: Object.freeze(copied),
57
+ });
58
+ }
59
+ /**
60
+ * Binds conformance evidence to `graph` (C31). Unbranded, copied or swapped evidence and inputs that are not revision
61
+ * inputs are a TypeError. The inputs are read once. Evidence counts only for the graph whose revision the inputs
62
+ * recompute, loaded for the running language version and kernel digest, and only when the running toolchain produced
63
+ * it; COMP-KERNEL also needs the inputs' floor (the sources under `.ia/src/floor/` at floor placement) to be the floor
64
+ * it verified. Anything else, including a source with only one of that path and that placement, is NOT-EVALUATED.
65
+ */
66
+ export function bindConformance(graph, conformance) {
67
+ const { inputs: given, kernel, fixtures } = record(conformance, 'conformance');
68
+ if (!isConformanceEvidence(kernel, 'COMP-KERNEL'))
69
+ throw new TypeError('conformance.kernel must be evidence verifyKernel returned');
70
+ if (!isConformanceEvidence(fixtures, 'COMP-FIXTURES'))
71
+ throw new TypeError('conformance.fixtures must be evidence verifyFixtures returned');
72
+ const inputs = snapshot(given), toolchain = runningToolchain();
73
+ const graphReason = revisionOf(graph.registry, inputs) !== graph.revision
74
+ ? "the conformance inputs do not recompute this graph's revision"
75
+ : inputs.languageVersion !== LANGUAGE_VERSION || inputs.kernelDigest !== KERNEL_DIGEST
76
+ ? 'the graph was loaded for another language version or kernel digest than the running one'
77
+ : undefined;
78
+ // Each object is checked against the running toolchain on its own, so one stale object leaves the other bound.
79
+ const staleness = (evidence) => stableSerialize(evidence.toolchain) === stableSerialize(toolchain)
80
+ ? undefined
81
+ : 'the evidence was produced by another toolchain';
82
+ let kernelReason = graphReason ?? staleness(kernel);
83
+ if (kernelReason === undefined) {
84
+ const floor = [], ambiguous = [];
85
+ for (const source of inputs.sources) {
86
+ const path = canonicalPath(source.path), atPath = path.startsWith('.ia/src/floor/'), atPlacement = source.location.placement.kind === 'floor';
87
+ if (atPath && atPlacement)
88
+ floor.push({ path, text: source.text });
89
+ else if (atPath || atPlacement)
90
+ ambiguous.push(path);
91
+ }
92
+ kernelReason =
93
+ ambiguous.length > 0
94
+ ? `floor source ${ambiguous.sort()[0]} has a floor path or a floor placement, not both`
95
+ : kernelDigest(floor) !== kernel.floorDigest
96
+ ? 'the kernel evidence verified another floor'
97
+ : undefined;
98
+ }
99
+ const fixturesReason = graphReason ?? staleness(fixtures);
100
+ // Bound evidence whose own assessment is not-evaluated stays as it is: not verified, and not summarised.
101
+ const result = (check, reason, assessment) => reason === undefined
102
+ ? { assessment, verified: assessment.outcome !== 'not-evaluated' }
103
+ : { assessment: notEvaluated(check, reason), verified: false };
104
+ const [kernelResult, fixturesResult] = [
105
+ result('COMP-KERNEL', kernelReason, kernel.assessment),
106
+ result('COMP-FIXTURES', fixturesReason, fixtures.assessment),
107
+ ];
108
+ const results = [kernelResult, fixturesResult];
109
+ if (!kernelResult.verified && !fixturesResult.verified)
110
+ return { results };
111
+ return {
112
+ results,
113
+ summary: Object.freeze({
114
+ profile: kernel.profile,
115
+ toolchain,
116
+ ...(kernelResult.verified ? { kernel: Object.freeze({ floorDigest: kernel.floorDigest }) } : {}),
117
+ ...(fixturesResult.verified
118
+ ? {
119
+ fixtures: Object.freeze({
120
+ inventoryDigest: fixtures.inventoryDigest,
121
+ observedCodes: fixtures.observedCodes,
122
+ outOfProfile: fixtures.outOfProfile,
123
+ }),
124
+ }
125
+ : {}),
126
+ }),
127
+ };
128
+ }
129
+ //# sourceMappingURL=bind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bind.js","sourceRoot":"","sources":["../../src/conformance/bind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEtF,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AA4BxE,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,MAAc,EAAc,EAAE,CACjE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE;IACrB,EAAE,IAAI,EAAE,uBAAuB,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,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AE,cAAc,CAAC,CAAC;IAC/C,IAAI,CAAC,YAAY,CAAC,QAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ;QAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IAC3E,OAAO;QACL,OAAO;QACP,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;YACrB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,SAAS;YACT,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAChG,GAAG,CAAC,cAAc,CAAC,QAAQ;gBACzB,CAAC,CAAC;oBACE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC;wBACtB,eAAe,EAAE,QAAQ,CAAC,eAAe;wBACzC,aAAa,EAAE,QAAQ,CAAC,aAAa;wBACrC,YAAY,EAAE,QAAQ,CAAC,YAAY;qBACpC,CAAC;iBACH;gBACH,CAAC,CAAC,EAAE,CAAC;SACR,CAAC;KACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Graph, RevisionSource } from '@inventarch/graph';
2
+ import type { SystemFolder } from '../systems.js';
3
+ export interface Corpus {
4
+ readonly graph: Graph;
5
+ readonly inputs: readonly RevisionSource[];
6
+ readonly folders: readonly SystemFolder[];
7
+ }
8
+ /** Compiles and loads the conformance corpus the boundary suites run over. Throws on any diagnostic. */
9
+ export declare function loadCorpus(corpus: readonly {
10
+ readonly path: string;
11
+ readonly text: string;
12
+ }[], folderNames: readonly string[]): Corpus;
13
+ //# sourceMappingURL=corpus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"corpus.d.ts","sourceRoot":"","sources":["../../src/conformance/corpus.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3C,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;CAC3C;AAKD,wGAAwG;AACxG,wBAAgB,UAAU,CACxB,MAAM,EAAE,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,EACnE,WAAW,EAAE,SAAS,MAAM,EAAE,GAC7B,MAAM,CAwCR"}
@@ -0,0 +1,43 @@
1
+ import { KERNEL_DIGEST, LANGUAGE_VERSION, buildRegistry, compile, parse } from '@inventarch/language';
2
+ import { load } from '@inventarch/graph';
3
+ const floor = { placement: { kind: 'floor', band: 10, reach: '' }, provenance: 'bootstrap' };
4
+ const authored = { placement: { kind: 'authored', band: 100, reach: '' }, provenance: 'workspace' };
5
+ const compare = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
6
+ /** Compiles and loads the conformance corpus the boundary suites run over. Throws on any diagnostic. */
7
+ export function loadCorpus(corpus, folderNames) {
8
+ const inputs = [...corpus]
9
+ .sort((a, b) => compare(a.path, b.path))
10
+ .map(({ path, text }) => ({
11
+ path,
12
+ text,
13
+ location: path.startsWith('.ia/src/floor/') ? floor : authored,
14
+ }));
15
+ const sources = inputs.map((input) => ({ ...parse(input.text, input.path), location: input.location }));
16
+ const registered = buildRegistry(sources);
17
+ if (registered.diagnostics.length > 0)
18
+ throw new Error(JSON.stringify(registered.diagnostics));
19
+ const first = sources.flatMap((s) => compile(s.ast, registered.registry, s.location, []).records);
20
+ const records = sources.flatMap((s) => {
21
+ const result = compile(s.ast, registered.registry, s.location, first.filter((r) => r.source.path !== s.ast.path));
22
+ if (result.diagnostics.length > 0)
23
+ throw new Error(JSON.stringify(result.diagnostics));
24
+ return result.records;
25
+ });
26
+ const graph = load(records, registered.registry, {
27
+ sources: inputs,
28
+ languageVersion: LANGUAGE_VERSION,
29
+ kernelDigest: KERNEL_DIGEST,
30
+ location: '',
31
+ });
32
+ const folders = folderNames.map((name) => {
33
+ const path = `.ia/src/systems/${name}`;
34
+ return {
35
+ name,
36
+ path,
37
+ sources: sources.filter((s) => s.ast.path.startsWith(path + '/')),
38
+ records: records.filter((r) => r.source.path.startsWith(path + '/')),
39
+ };
40
+ });
41
+ return { graph, inputs, folders };
42
+ }
43
+ //# sourceMappingURL=corpus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"corpus.js","sourceRoot":"","sources":["../../src/conformance/corpus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEtG,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AASzC,MAAM,KAAK,GAAa,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;AACvG,MAAM,QAAQ,GAAa,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;AAC9G,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E,wGAAwG;AACxG,MAAM,UAAU,UAAU,CACxB,MAAmE,EACnE,WAA8B;IAE9B,M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CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAClD,CAAC;QACF,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;QACvF,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,QAAQ,EAAE;QAC/C,OAAO,EAAE,MAAM;QACf,eAAe,EAAE,gBAAgB;QACjC,YAAY,EAAE,aAAa;QAC3B,QAAQ,EAAE,EAAE;KACb,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACvC,MAAM,IAAI,GAAG,mBAAmB,IAAI,EAAE,CAAC;QACvC,OAAO;YACL,IAAI;YACJ,IAAI;YACJ,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;YACjE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;SACrE,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AACpC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** C25-C29 producer-boundary observations. Synthetic local receipts qualify the pure APIs, not a live writer or service. */
2
+ import type { Graph } from '@inventarch/graph';
3
+ import type { FixtureResult } from '../fixtures.js';
4
+ export declare function runEvidenceFixtures(graph: Graph): readonly FixtureResult[];
5
+ //# sourceMappingURL=evidence-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence-fixtures.d.ts","sourceRoot":"","sources":["../../src/conformance/evidence-fixtures.ts"],"names":[],"mappings":"AAAA,4HAA4H;AAC5H,OAAO,KAAK,EAAE,KAAK,EAAQ,MAAM,mBAAmB,CAAC;AAWrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAmDpD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,aAAa,EAAE,CAuO1E"}
@@ -0,0 +1,257 @@
1
+ import { EVALUATOR_CATALOG_FORMAT, bindEvaluators, createEvaluatorCatalog } from '../catalog.js';
2
+ import { EVIDENCE_RECEIPT_FORMAT, acceptEvaluatorOutput, admitTransition, evidenceDigest, validateReceipt, } from '../evidence.js';
3
+ import { validateCheck } from '../graph-checks.js';
4
+ import { resolveObligations } from '../obligations.js';
5
+ import { assess } from '../types.js';
6
+ const hex = (value) => `sha256:${value.repeat(64)}`;
7
+ const codecs = [
8
+ { id: 'fixture-input@1', validate: () => true },
9
+ {
10
+ id: 'fixture-output@1',
11
+ validate: (value) => typeof value === 'object' && value !== null && typeof value.files === 'number',
12
+ },
13
+ ];
14
+ const entry = {
15
+ id: 'fixture-read',
16
+ contractVersion: '1.0.0',
17
+ implementationVersion: '1.0.0',
18
+ implementationDigest: hex('a'),
19
+ inputSchemaId: 'fixture-input@1',
20
+ outputSchemaId: 'fixture-output@1',
21
+ supportedScopes: ['package'],
22
+ effects: ['read'],
23
+ environmentProfile: { id: 'node-offline', credentials: 'none' },
24
+ limits: { timeoutMs: 1000, memoryBytes: 1048576, outputBytes: 1024, concurrency: 1 },
25
+ evidencePolicy: { kind: 'reusable', maxAgeMs: 3600000, environmentSensitive: true },
26
+ availability: { status: 'supported' },
27
+ };
28
+ const fresh = {
29
+ ...entry,
30
+ id: 'fixture-fresh',
31
+ implementationDigest: hex('b'),
32
+ evidencePolicy: { kind: 'fresh-run' },
33
+ };
34
+ const revoked = {
35
+ ...entry,
36
+ id: 'fixture-revoked',
37
+ implementationDigest: hex('c'),
38
+ availability: { status: 'revoked', reason: 'Fixture revocation' },
39
+ };
40
+ const unavailable = {
41
+ ...entry,
42
+ id: 'fixture-unavailable',
43
+ implementationDigest: hex('d'),
44
+ availability: { status: 'unavailable', reason: 'Fixture host has no implementation' },
45
+ };
46
+ const build = (entries, format = EVALUATOR_CATALOG_FORMAT) => createEvaluatorCatalog({ format, entries }, { codecs });
47
+ export function runEvidenceFixtures(graph) {
48
+ const built = build([entry, fresh, revoked, unavailable]);
49
+ if (!built.ok)
50
+ throw new Error('Evidence fixture catalog failed its positive control');
51
+ const catalog = built.catalog;
52
+ const input = {
53
+ subject: 'fixture/package',
54
+ policyRevision: 'fixture-policy-1',
55
+ catalog,
56
+ catalogDigest: catalog.digest,
57
+ facts: {},
58
+ adoptions: [{ identity: 'fixture-adoption', source: 'root', mandatory: true }],
59
+ occurrences: [
60
+ {
61
+ identity: 'fixture-contract',
62
+ word: 'contract',
63
+ adoption: 'fixture-adoption',
64
+ requirement: 'REQ-READ',
65
+ runs: entry.id,
66
+ provenance: { path: 'fixture.ia', line: 1 },
67
+ input: {},
68
+ },
69
+ ],
70
+ };
71
+ const resolution = resolveObligations(input), obligation = resolution.obligations[0];
72
+ const freshResolution = resolveObligations({
73
+ ...input,
74
+ occurrences: input.occurrences.map((row) => ({ ...row, runs: fresh.id })),
75
+ });
76
+ const freshObligation = freshResolution.obligations[0];
77
+ const context = {
78
+ catalog,
79
+ attemptId: 'fixture-attempt-2',
80
+ policyRevision: input.policyRevision,
81
+ digests: { candidate: hex('1'), native: hex('2'), code: hex('3'), policy: hex('4'), dependency: hex('5') },
82
+ environment: { id: 'node-offline', toolchain: 'fixture-toolchain' },
83
+ minimumTrust: 'local-unsigned',
84
+ };
85
+ const now = '2026-09-28T10:30:00Z';
86
+ const receipt = (selected = obligation, overrides = {}) => ({
87
+ format: EVIDENCE_RECEIPT_FORMAT,
88
+ receiptId: 'fixture-receipt',
89
+ attemptId: context.attemptId,
90
+ obligationId: selected.obligationId,
91
+ subject: selected.subject,
92
+ inputDigest: selected.inputDigest,
93
+ digests: context.digests,
94
+ environment: context.environment,
95
+ evaluator: {
96
+ id: selected.evaluator.id,
97
+ implementationVersion: selected.evaluator.implementationVersion,
98
+ implementationDigest: selected.evaluator.implementationDigest,
99
+ },
100
+ catalogDigest: catalog.digest,
101
+ policyRevision: context.policyRevision,
102
+ observedAt: '2026-09-28T10:00:00Z',
103
+ completedAt: '2026-09-28T10:01:00Z',
104
+ result: 'passed',
105
+ evidenceDigest: evidenceDigest({ files: 1 }),
106
+ issuer: 'fixture-local-host',
107
+ trust: 'local-unsigned',
108
+ ...overrides,
109
+ });
110
+ if (!validateReceipt(receipt(), { ...context, obligation }, now).valid ||
111
+ !admitTransition(resolution, [receipt()], context, now).admitted)
112
+ throw new Error('Evidence fixture receipt/admission failed its positive control');
113
+ const check = [...graph.nodes.values()].find((node) => node.discriminator === 'check');
114
+ if (!check)
115
+ throw new Error('Evidence fixtures need an admitted check in the supplied corpus');
116
+ const runs = (id) => ({
117
+ ...check,
118
+ sections: check.sections.map((section) => section.name !== 'check'
119
+ ? section
120
+ : {
121
+ ...section,
122
+ fields: section.fields.map((field) => 'key' in field && field.key === 'runs'
123
+ ? { ...field, value: { kind: 'scalar', text: id } }
124
+ : field),
125
+ }),
126
+ });
127
+ const checked = (overrides, time = now) => validateReceipt(receipt(obligation, overrides), { ...context, obligation }, time).findings;
128
+ const fixtures = [
129
+ ['IA-COMP-CATALOG-VERSION', () => build([entry], 'ia-evaluator-catalog/2.0').assessment.findings],
130
+ ['IA-COMP-CATALOG-ENTRY-INVALID', () => build([{ ...entry, command: 'unregistered' }]).assessment.findings],
131
+ [
132
+ 'IA-COMP-CATALOG-LIMITS',
133
+ () => build([{ ...entry, limits: { ...entry.limits, timeoutMs: 0 } }]).assessment.findings,
134
+ ],
135
+ ['IA-COMP-CATALOG-DUPLICATE', () => build([entry, entry]).assessment.findings],
136
+ [
137
+ 'IA-COMP-CATALOG-DIGEST-CONFLICT',
138
+ () => build([entry, { ...entry, implementationDigest: hex('e') }]).assessment.findings,
139
+ ],
140
+ ['IA-COMP-CATALOG-BUILTIN-OVERRIDE', () => build([{ ...entry, id: 'COMP-CHECK' }]).assessment.findings],
141
+ [
142
+ 'IA-COMP-CATALOG-CODEC-UNKNOWN',
143
+ () => build([{ ...entry, inputSchemaId: 'unknown-codec@1' }]).assessment.findings,
144
+ ],
145
+ ['IA-COMP-EVALUATOR-UNAVAILABLE', () => validateCheck(runs(unavailable.id), catalog).findings],
146
+ ['IA-COMP-EVALUATOR-REVOKED', () => validateCheck(runs(revoked.id), catalog).findings],
147
+ [
148
+ 'IA-COMP-EVALUATOR-SUBSTITUTED',
149
+ () => bindEvaluators(catalog, new Map([[`${entry.id}@${hex('f')}`, () => null]])).assessment.findings,
150
+ ],
151
+ [
152
+ 'IA-COMP-EVALUATOR-OUTPUT-INVALID',
153
+ () => acceptEvaluatorOutput(catalog, obligation, {
154
+ kind: 'completed',
155
+ byteLength: entry.limits.outputBytes + 1,
156
+ output: { result: 'passed', evidence: { files: 1 } },
157
+ }).findings,
158
+ ],
159
+ [
160
+ 'IA-COMP-OBLIGATION-UNRESOLVED',
161
+ () => resolveObligations({
162
+ ...input,
163
+ occurrences: input.occurrences.map((row) => ({ ...row, runs: 'fixture-unknown' })),
164
+ }).assessment.findings,
165
+ ],
166
+ [
167
+ 'IA-COMP-OBLIGATION-CONFLICT',
168
+ () => resolveObligations({ ...input, catalogDigest: hex('e') }).assessment.findings,
169
+ ],
170
+ [
171
+ 'IA-COMP-OBLIGATION-UNDETERMINED',
172
+ () => resolveObligations({
173
+ ...input,
174
+ occurrences: input.occurrences.map((row) => ({ ...row, applicability: 'missing-predicate@1' })),
175
+ }).assessment.findings,
176
+ ],
177
+ [
178
+ 'IA-COMP-OBLIGATION-WEAKENED',
179
+ () => resolveObligations({
180
+ ...input,
181
+ packageMetadata: [
182
+ {
183
+ occurrence: obligation.occurrence,
184
+ requirement: obligation.requirement,
185
+ action: 'disable',
186
+ source: 'package.json',
187
+ },
188
+ ],
189
+ }).assessment.findings,
190
+ ],
191
+ [
192
+ 'IA-COMP-OBLIGATION-FAILED',
193
+ () => admitTransition(resolution, [receipt(obligation, { result: 'failed' })], context, now).assessment.findings,
194
+ ],
195
+ ['IA-COMP-OBLIGATION-BLOCKED', () => admitTransition(resolution, [], context, now).assessment.findings],
196
+ [
197
+ 'IA-COMP-OBLIGATION-UNVERIFIED',
198
+ () => admitTransition({ ...resolution }, [receipt()], context, now).assessment.findings,
199
+ ],
200
+ [
201
+ 'IA-COMP-RECEIPT-INVALID',
202
+ () => validateReceipt({ ...receipt(), extra: true }, { ...context, obligation }, now).findings,
203
+ ],
204
+ ['IA-COMP-RECEIPT-SUBJECT', () => checked({ subject: 'fixture/other-package' })],
205
+ ['IA-COMP-RECEIPT-STALE', () => checked({ inputDigest: hex('e') })],
206
+ ['IA-COMP-RECEIPT-CODE', () => checked({ digests: { ...context.digests, code: hex('e') } })],
207
+ [
208
+ 'IA-COMP-RECEIPT-TOOLCHAIN',
209
+ () => checked({ environment: { ...context.environment, toolchain: 'other-toolchain' } }),
210
+ ],
211
+ [
212
+ 'IA-COMP-RECEIPT-EVALUATOR',
213
+ () => checked({ evaluator: { ...receipt().evaluator, implementationDigest: hex('e') } }),
214
+ ],
215
+ [
216
+ 'IA-COMP-RECEIPT-REVOKED',
217
+ () => checked({
218
+ evaluator: {
219
+ id: revoked.id,
220
+ implementationVersion: revoked.implementationVersion,
221
+ implementationDigest: revoked.implementationDigest,
222
+ },
223
+ }),
224
+ ],
225
+ ['IA-COMP-RECEIPT-EXPIRED', () => checked({}, '2026-09-28T11:01:01Z')],
226
+ [
227
+ 'IA-COMP-RECEIPT-FRESH-RUN',
228
+ () => validateReceipt(receipt(freshObligation, { attemptId: 'fixture-attempt-1' }), { ...context, obligation: freshObligation }, now).findings,
229
+ ],
230
+ ['IA-COMP-RECEIPT-UNTRUSTED', () => checked({ trust: 'service-associated', issuer: 'claimed-service' })],
231
+ ];
232
+ return Object.freeze(fixtures.map(([code, run]) => {
233
+ let observed = [], failure;
234
+ try {
235
+ observed = run();
236
+ }
237
+ catch (error) {
238
+ failure = `Fixture threw ${error instanceof Error ? error.name : 'an unknown exception'}`;
239
+ }
240
+ const matches = failure === undefined && observed.some((finding) => finding.code === code);
241
+ return Object.freeze({
242
+ assessment: assess('COMP-FIXTURES', `evidence-boundary/${code}`, matches
243
+ ? []
244
+ : [
245
+ {
246
+ code: 'IA-COMP-FIXTURE-MISMATCH',
247
+ severity: 'error',
248
+ path: '',
249
+ line: 1,
250
+ message: `${code}: ${failure ?? `observed ${observed.map((finding) => finding.code).join(', ') || 'no findings'}`}`,
251
+ },
252
+ ]),
253
+ observedCodes: Object.freeze([...new Set(observed.map((finding) => finding.code))].sort()),
254
+ });
255
+ }));
256
+ }
257
+ //# sourceMappingURL=evidence-fixtures.js.map