Tests

65 files

pi-cybernetictest

Test Gate Governance

#!/usr/bin/env python3 """test_gate_governance.py — N10 discipline applied to the governance system. Every enforcement …

PY238 lines11,790 bytes
loom-sprint-scaffoldtest

Retry.Test

import { describe, expect, test } from "bun:test"; import { withRetry } from "../src/lib/retry"; import { RetryExhausted…

TS66 lines2,287 bytes
loom-sprint-scaffoldtest

Tsconfig

{ "extends": "../tsconfig.json", "compilerOptions": { "types": ["bun-types", "@cloudflare/workers-types"], "…

{}14 lines508 bytes
loom-sprint-scaffoldtest

Ids.Test

import { describe, expect, test } from "bun:test"; import { actionHash, canonicalJSON, dispatchId, newEventId, newGoalId…

TS47 lines1,923 bytes
loom-sprint-scaffoldtest

Contracts.Test

import { describe, expect, test } from "bun:test"; import { parseContract, checkContract, isContractName } from "../src/…

TS81 lines3,573 bytes
loom-sprint-scaffoldtest

Budget Governor.Test

/** * Tests for budget-governor (H3.6). * * Proves: * - all 3 hard cap types (calls, tokens, wallclock) are enforced…

TS190 lines6,388 bytes
loom-sprint-scaffoldtest

Reinjector.Test

/** * Tests for reinjector (H3.4). * * Proves: * - normalizeObservation truncates content exceeding obs_cap_tokens …

TS167 lines5,612 bytes
loom-sprint-scaffoldtest

Model Client.Test

/** * Tests for model-client (H3.0). * * Proves: * - createAnthropicModelCaller returns a callable ModelCaller * - …

TS349 lines10,934 bytes
loom-sprint-scaffoldtest

Reversibility Gate.Test

/** * Tests for reversibility-gate (H3.3). * * Proves: * - allowlist lookup accepts allowed tools and denies unknown…

TS203 lines6,855 bytes
loom-sprint-scaffoldtest

Conf Monitor.Test

/** * Tests for conf-monitor (H3.5). * * Proves: * - extractConf finds trailing JSON line `{"conf": 0.8}` in assista…

TS159 lines5,452 bytes
loom-sprint-scaffoldtest

Harness.Test

/** * Integration tests for harness (runStage). * * Proves every StageTermination kind is reachable: * DONE | GATE_R…

TS612 lines20,705 bytes
loom-sprint-scaffoldtest

Preflight.Test

/** * Tests for preflight (H3.7). * * Proves: * - clean files (no markers) pass * - every marker (TODO, FIXME, <<<<…

TS133 lines4,732 bytes
loom-sprint-scaffoldtest

Ack Gate.Test

/** * Tests for ack-gate (H3.1). * * Proves: * - wrapResult produces deterministic hex hash from tool result * - ch…

TS162 lines5,577 bytes
loom-sprint-scaffoldtest

Loop Detector.Test

/** * Tests for loop-detector (H3.2). * * Proves: * - the identical action halts at exactly the 3rd occurrence (not …

TS152 lines5,256 bytes
loom-sprint-scaffoldtest

Dataset Emitter.Test

/** * Tests for H5.6 — Dataset Emitter. * * Proves: * - extractDatasetTuples extracts (failure_pattern, root_cause…

TS245 lines8,772 bytes
loom-sprint-scaffoldtest

Fixtures

/** * Synthetic trace corpus for Loop 5 synthesis tests. * ~50 enriched trace events covering failures, successes, rep…

TS264 lines11,826 bytes
loom-sprint-scaffoldtest

Failure Clusterer.Test

/** * Tests for H5.1 — Failure Clusterer. * * Proves: * - normalizeErrorSignature strips ids, paths, numbers deter…

TS200 lines7,278 bytes
loom-sprint-scaffoldtest

Skill Proposer.Test

/** * Tests for H5.2 — Skill Proposer. * * Proves: * - extractSuccessfulSequences groups tool calls by dispatch *…

TS206 lines7,692 bytes
loom-sprint-scaffoldtest

Registry Updater.Test

/** * Tests for H5.3 — Registry Updater. * * Proves: * - computeModeStats groups correctly by (model, harnessProfi…

TS208 lines7,132 bytes
loom-sprint-scaffoldtest

Report.Test

/** * Integration test for the full synthesis report pipeline. * * Proves: * - Synthetic trace corpus → determinis…

TS184 lines6,142 bytes
loom-sprint-scaffoldtest

Entropy Monitors.Test

/** * Tests for H5.4 — Entropy Monitors. * * Proves: * - Shannon entropy computed correctly with natural log (hand…

TS191 lines6,905 bytes
loom-sprint-scaffoldtest

Isolation.Test

/** * Isolation test for src/synthesis/. * * Enforces at the grep level: * 1. No import from src/orchestrator/, sr…

TS132 lines4,331 bytes
loom-sprint-scaffoldtest

Revision Governor.Test

/** * Tests for H5.5 — Revision Governor. * * Proves: * - Caps proposals at maxSkillProposals (default 5) * - N…

TS170 lines5,880 bytes
loom-sprint-scaffoldtest

Mode Registry.Test

/** * Tests for ModeRegistry (H2.1). * * Proves: * - unknown variety_class → highest-capability mode + variety_defic…

TS198 lines6,916 bytes
loom-sprint-scaffoldtest

Envelope Compiler.Test

/** * Tests for EnvelopeCompiler (H2.2 + H2.3). * * Proves: * - compiled envelope validates against dispatch-envelop…

TS262 lines10,508 bytes
loom-sprint-scaffoldtest

Probe Planner.Test

/** * Tests for ProbePlanner (H2.5). * * Proves: * - api_integration + no behavior model → probe prepended (recovera…

TS197 lines7,246 bytes
loom-sprint-scaffoldtest

Dlq Escalator.Test

/** * Tests for DlqEscalator (H2.4). * * Proves: * - DLQ letter → escalation POST with correct payload (goal_id, sta…

TS151 lines5,483 bytes
loom-sprint-scaffoldtest

Context Assembler.Test

/** * ContextAssembler tests (H4.1). * * Proves: * - Budget NEVER exceeded: table-driven over budgets {0, tiny, ex…

TS245 lines8,542 bytes
loom-sprint-scaffoldtest

Compactor.Test

/** * Compactor tests (H4.5). * * Proves: * - Compactor output records all validate against memory-record.schema.j…

TS178 lines6,156 bytes
loom-sprint-scaffoldtest

Scope Wall.Test

/** * ScopeWall tests (H4.3). * * Proves: * - Same-scope read works (constructor requires scope) * - Cross-scop…

TS266 lines8,984 bytes
loom-sprint-scaffoldtest

Helpers

/** * Test helpers for memory module tests. * * Provides: * - FakeD1: in-memory SQLite (bun:sqlite) implementing D…

TS324 lines10,577 bytes
loom-sprint-scaffoldtest

Pointer Hierarchy.Test

/** * PointerHierarchy tests (H4.4). * * Proves: * - memory_expand round-trips: put full text in fake BlobStore → …

TS188 lines6,753 bytes
loom-sprint-scaffoldtest

Promotion Engine.Test

/** * PromotionEngine tests (H4.2). * * Proves: * - Promotion fires at EXACTLY m_promote distinct traces (not m-1;…

TS212 lines9,720 bytes
loom-sprint-scaffoldtest

Semantic Index.Test

/** * SemanticIndex contract test suite. * * Shared tests run against BOTH Fts5Index (with fake D1/SQLite) and * Vec…

TS238 lines9,598 bytes
loom-sprint-scaffoldtest

No Silent Failure.Test

/** * No-Silent-Failure Invariant Walk. * * For EVERY terminated (non-DONE) stage across all golden runs + chaos runs…

TS249 lines9,793 bytes
loom-sprint-scaffoldtest

Chaos.Test

/** * Chaos Tests — fault injection, one scenario per test. * * Five scenarios: * 1. dropped-tool-result — ack gat…

TS253 lines10,016 bytes
loom-sprint-scaffoldtest

Golden.Test

/** * E2E Golden Goal Tests. * * Runs all three golden goals end-to-end through all LOOM loops. * Each asserts: * …

TS50 lines2,037 bytes
loom-sprint-scaffoldtest

Chaos Scenarios

/** * Shared chaos scenario runners used by both chaos.test.ts and * no-silent-failure.test.ts. Lives outside *.test.t…

TS76 lines2,999 bytes
loom-sprint-scaffoldtest

Golden Runner

/** * E2E Golden Runner — in-process composition root for LOOM integration tests. * * Wires Loop 1 (CheckpointEngine,…

TS423 lines15,811 bytes
loom-sprint-scaffoldtest

Index

/** Barrel for golden goal scripts. */ export { script as codegenScript, assert as assertCodegen } from "./codegen"; ex…

TS6 lines299 bytes
loom-sprint-scaffoldtest

Research

/** * Golden goal: research — mid-goal failing stage drives fail_streak to m=3 → REFORMULATE → recovers → completes. *…

TS152 lines5,484 bytes
loom-sprint-scaffoldtest

Codegen

/** * Golden goal: codegen — multi-stage code-generation goal. * * All stages pass done-criteria; the goal completes …

TS82 lines2,789 bytes
loom-sprint-scaffoldtest

Data Pipeline

/** * Golden goal: data_pipeline — destructive step requires approval token (mint → verify path). * * Stages: * 1.…

TS138 lines4,961 bytes
loom-sprint-scaffoldtest

Fakes

/** * Shared fake implementations for LOOM E2E tests. * * Consolidates patterns from: * tests/orchestrator/checkpo…

TS384 lines13,629 bytes
loom-sprint-scaffoldtest

Dispatch Envelope

{ "dispatch_id": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8", "stage_id": "stg_a1b2c3d4e5f6",…

{}17 lines895 bytes
loom-sprint-scaffoldtest

Goal State

{ "goal_id": "goal_a1b2c3d4e5f6", "original_spec": "Rebuild oregonsmbdirectory.com category pages with JSON-LD on As…

{}20 lines869 bytes
loom-sprint-scaffoldtest

Execution Trace

{ "event_id": "evt_a1b2c3d4e5f6", "dispatch_id": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",…

{}23 lines689 bytes
loom-sprint-scaffoldtest

Memory Record

{ "record_id": "mem_a1b2c3d4e5f6", "scope": "execution", "level": "semantic", "topic": "astro-jsonld-phantom-bug…

{}19 lines661 bytes
loom-sprint-scaffoldtest

Stage Spec

{ "stage_id": "stg_a1b2c3d4e5f6", "goal_id": "goal_a1b2c3d4e5f6", "objective": "Generate JSON-LD LocalBusiness sch…

{}18 lines784 bytes
loom-sprint-scaffoldtest

Dispatch Envelope.Bad Reversibility

{ "dispatch_id": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8", "stage_id": "stg_a1b2c3d4e5f6",…

{}12 lines434 bytes
loom-sprint-scaffoldtest

Memory Record.Bad Scope

{ "record_id": "mem_a1b2c3d4e5f6", "scope": "global", "level": "semantic", "topic": "t", "summary": "s", "cr…

{}9 lines156 bytes
loom-sprint-scaffoldtest

Goal State.Bad Status

{ "goal_id": "goal_a1b2c3d4e5f6", "original_spec": "x", "spec_hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b…

{}11 lines429 bytes
loom-sprint-scaffoldtest

Stage Spec.Bad Predicate Kind

{ "stage_id": "stg_a1b2c3d4e5f6", "goal_id": "goal_a1b2c3d4e5f6", "objective": "Done criterion uses a non-machine-…

{}13 lines413 bytes
loom-sprint-scaffoldtest

Goal State.Bad Id

{ "goal_id": "goal_TOOSHORT", "original_spec": "x", "spec_hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822c…

{}11 lines425 bytes
loom-sprint-scaffoldtest

Dispatch Envelope.Bad Dispatch Id

{ "dispatch_id": "not-a-sha256", "stage_id": "stg_a1b2c3d4e5f6", "goal_id": "goal_a1b2c3d4e5f6", "attempt": 1, …

{}12 lines336 bytes
loom-sprint-scaffoldtest

Memory Record.Extra Prop

{ "record_id": "mem_a1b2c3d4e5f6", "scope": "execution", "level": "semantic", "topic": "t", "summary": "s", …

{}10 lines184 bytes
loom-sprint-scaffoldtest

Stage Spec.Empty Done

{ "stage_id": "stg_a1b2c3d4e5f6", "goal_id": "goal_a1b2c3d4e5f6", "objective": "Stage with no verifiable completio…

{}11 lines351 bytes
loom-sprint-scaffoldtest

Execution Trace.Bad Kind

{ "event_id": "evt_a1b2c3d4e5f6", "dispatch_id": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",…

{}8 lines189 bytes
loom-sprint-scaffoldtest

Execution Trace.Bad Conf

{ "event_id": "evt_a1b2c3d4e5f6", "dispatch_id": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",…

{}9 lines205 bytes
loom-sprint-scaffoldtest

Escalation Ledger.Test

/** * Tests for EscalationLedger (H1.4). * * Proves: * - fail_streak increment/reset * - escalation records append-…

TS110 lines3,728 bytes
loom-sprint-scaffoldtest

Drift Sentinel.Test

/** * Tests for DriftSentinel (H1.6). * * Proves: * - single spike does NOT raise sustained drift * - sustained div…

TS146 lines4,522 bytes
loom-sprint-scaffoldtest

Predicates.Test

/** * Tests for predicate evaluators (H1.1). * All six kinds: pass + fail cases each. * Injects a scripted PredicateR…

TS120 lines5,367 bytes
loom-sprint-scaffoldtest

Checkpoint.Test

/** * Tests for CheckpointEngine (H1.1 + H1.4). * * Proves: * - scripted fake stage results drive fail_streak to EXA…

TS386 lines13,178 bytes
loom-sprint-scaffoldtest

Decomposer.Test

/** * Tests for decomposer (H1.3). * * Proves: * - rejects non-machine-evaluable done_criteria with the specific vio…

TS182 lines6,299 bytes
loom-sprint-scaffoldtest

Token Mint.Test

/** * Tests for TokenMint (H1.5). * * Proves: * - mint → Loop 3 verify passes (round-trip) * - expired tokens fail …

TS180 lines5,795 bytes