/** * Differential harness — three-way parity gate. * * IR fixture * | * +------------+------------+ * | | | * ReferenceRunner TS emitter Python emitter * | | | * Trace_R Trace_TS Trace_PY * | | | * +------------+------------+ * | * verdict: R == TS == PY ? * * Phase 1 (PR-1) ships the harness skeleton with two stub legs — `runTsEmitter` * and `runPythonEmitter` throw until PR-3 wires them. The reference leg works * but has no contracts to dispatch to until PR-2. */ import { type NodeFixture, type SemanticEnv } from './index.js'; import { type Trace } from './trace.js'; export type Verdict = 'pass' | 'reference-mismatch' | 'ts-divergence' | 'python-divergence' | 'three-way-divergence' | 'leg-error'; export interface DifferentialResult { fixture: NodeFixture; verdict: Verdict; reference?: Trace; ts?: Trace; python?: Trace; /** Populated when verdict is `leg-error` — which leg threw and why. */ legError?: { leg: 'reference' | 'ts' | 'python'; message: string; }; } export interface DifferentialOptions { /** * Skip the Python leg. Useful during PR-3a when the Python leg isn't * provided. PR-3b ships the leg via the `pythonLeg` callback below. */ skipPython?: boolean; /** * Skip the TS leg. Symmetric with skipPython; rarely used. */ skipTs?: boolean; /** * PR-3b — Python leg runner injected from `@kernlang/python` (the core * package can't depend on fastapi without a circular import, so the * Python leg lives in fastapi and is passed in here). When omitted AND * `skipPython !== true`, the harness falls back to throwing "not wired", * which the harness records as `leg-error`. */ pythonLeg?: (fixture: NodeFixture, env: SemanticEnv) => Promise; } /** * Run one fixture through up to three legs and compare against `fixture.expected`. * * Decision order: * 1. If reference != expected → `reference-mismatch` (contract or fixture bug). * 2. If TS != reference and Python != reference → `three-way-divergence`. * 3. If only TS diverges → `ts-divergence`. Only Python → `python-divergence`. * 4. Any leg throws → `leg-error` with the offending leg recorded. */ export declare function runDifferential(fixture: NodeFixture, opts?: DifferentialOptions): Promise; /** Run every fixture from every registered contract. */ export declare function runAllContracts(opts?: DifferentialOptions): Promise;