Loop Detector.Test

loom-sprint-scaffoldtesttypescript
Path: loom-sprint-scaffold/loom/tests/execution/loop-detector.test.tsRelative: loom/tests/execution/loop-detector.test.tsSubproject: loom-sprint-scaffoldCategory: tests
Lines: 152Bytes: 5,256Imports: 2Exports: 0has tests

Content Preview

  1. /**
  2. * Tests for loop-detector (H3.2).
  3. *
  4. * Proves:
  5. * - the identical action halts at exactly the 3rd occurrence (not 2nd, not 4th)
  6. * - window eviction: after W=10 actions, old entries fall off
  7. * - reset clears the buffer
  8. * - makeHaltLoopEvent has correct shape
  9. */
  10. import { describe, expect, test } from "bun:test";
  11. import { LoopDetector, makeHaltLoopEvent } from "../../src/execution/loop-detector";
  12. describe("LoopDetector", () => {
  13. test("returns halted=false for first unique action", asyn