Tests
65 files
Test Gate Governance
#!/usr/bin/env python3 """test_gate_governance.py — N10 discipline applied to the governance system. Every enforcement …
Retry.Test
import { describe, expect, test } from "bun:test"; import { withRetry } from "../src/lib/retry"; import { RetryExhausted…
Tsconfig
{ "extends": "../tsconfig.json", "compilerOptions": { "types": ["bun-types", "@cloudflare/workers-types"], "…
Ids.Test
import { describe, expect, test } from "bun:test"; import { actionHash, canonicalJSON, dispatchId, newEventId, newGoalId…
Contracts.Test
import { describe, expect, test } from "bun:test"; import { parseContract, checkContract, isContractName } from "../src/…
Budget Governor.Test
/** * Tests for budget-governor (H3.6). * * Proves: * - all 3 hard cap types (calls, tokens, wallclock) are enforced…
Reinjector.Test
/** * Tests for reinjector (H3.4). * * Proves: * - normalizeObservation truncates content exceeding obs_cap_tokens …
Model Client.Test
/** * Tests for model-client (H3.0). * * Proves: * - createAnthropicModelCaller returns a callable ModelCaller * - …
Reversibility Gate.Test
/** * Tests for reversibility-gate (H3.3). * * Proves: * - allowlist lookup accepts allowed tools and denies unknown…
Conf Monitor.Test
/** * Tests for conf-monitor (H3.5). * * Proves: * - extractConf finds trailing JSON line `{"conf": 0.8}` in assista…
Harness.Test
/** * Integration tests for harness (runStage). * * Proves every StageTermination kind is reachable: * DONE | GATE_R…
Preflight.Test
/** * Tests for preflight (H3.7). * * Proves: * - clean files (no markers) pass * - every marker (TODO, FIXME, <<<<…
Ack Gate.Test
/** * Tests for ack-gate (H3.1). * * Proves: * - wrapResult produces deterministic hex hash from tool result * - ch…
Loop Detector.Test
/** * Tests for loop-detector (H3.2). * * Proves: * - the identical action halts at exactly the 3rd occurrence (not …
Dataset Emitter.Test
/** * Tests for H5.6 — Dataset Emitter. * * Proves: * - extractDatasetTuples extracts (failure_pattern, root_cause…
Fixtures
/** * Synthetic trace corpus for Loop 5 synthesis tests. * ~50 enriched trace events covering failures, successes, rep…
Failure Clusterer.Test
/** * Tests for H5.1 — Failure Clusterer. * * Proves: * - normalizeErrorSignature strips ids, paths, numbers deter…
Skill Proposer.Test
/** * Tests for H5.2 — Skill Proposer. * * Proves: * - extractSuccessfulSequences groups tool calls by dispatch *…
Registry Updater.Test
/** * Tests for H5.3 — Registry Updater. * * Proves: * - computeModeStats groups correctly by (model, harnessProfi…
Report.Test
/** * Integration test for the full synthesis report pipeline. * * Proves: * - Synthetic trace corpus → determinis…
Entropy Monitors.Test
/** * Tests for H5.4 — Entropy Monitors. * * Proves: * - Shannon entropy computed correctly with natural log (hand…
Isolation.Test
/** * Isolation test for src/synthesis/. * * Enforces at the grep level: * 1. No import from src/orchestrator/, sr…
Revision Governor.Test
/** * Tests for H5.5 — Revision Governor. * * Proves: * - Caps proposals at maxSkillProposals (default 5) * - N…
Mode Registry.Test
/** * Tests for ModeRegistry (H2.1). * * Proves: * - unknown variety_class → highest-capability mode + variety_defic…
Envelope Compiler.Test
/** * Tests for EnvelopeCompiler (H2.2 + H2.3). * * Proves: * - compiled envelope validates against dispatch-envelop…
Probe Planner.Test
/** * Tests for ProbePlanner (H2.5). * * Proves: * - api_integration + no behavior model → probe prepended (recovera…
Dlq Escalator.Test
/** * Tests for DlqEscalator (H2.4). * * Proves: * - DLQ letter → escalation POST with correct payload (goal_id, sta…
Context Assembler.Test
/** * ContextAssembler tests (H4.1). * * Proves: * - Budget NEVER exceeded: table-driven over budgets {0, tiny, ex…
Compactor.Test
/** * Compactor tests (H4.5). * * Proves: * - Compactor output records all validate against memory-record.schema.j…
Scope Wall.Test
/** * ScopeWall tests (H4.3). * * Proves: * - Same-scope read works (constructor requires scope) * - Cross-scop…