import { test } from "node:test"; import assert from "node:assert/strict"; import { MCP_POLICY, VIEWER_POLICY } from "./policy"; import { truncate } from "./window"; // These four numbers are a wire contract with the bench: the MCP scanner's // structural read/byte counters are unchanged by the one-pipeline move ONLY // because the caps travel as data rather than being re-derived. If one of them // moves, the bench's page counts move with it, so pin them. test("MCP_POLICY carries the MCP scanner's four caps verbatim", () => { assert.equal(MCP_POLICY.maxPages, 400); assert.equal(MCP_POLICY.hardVideoCap, 2000); assert.equal(MCP_POLICY.windowLineCap, 200); assert.equal(MCP_POLICY.snippetChars, 240); }); test("VIEWER_POLICY is uncapped, and Infinity behaves as the identity", () => { assert.equal(VIEWER_POLICY.maxPages, Number.POSITIVE_INFINITY); assert.equal(VIEWER_POLICY.hardVideoCap, Number.POSITIVE_INFINITY); assert.equal(VIEWER_POLICY.windowLineCap, Number.POSITIVE_INFINITY); // The load-bearing consequence: a viewer excerpt is never clipped. const long = "x".repeat(5000); assert.equal(truncate(long, VIEWER_POLICY.snippetChars), long); // …and 0 pages scanned is never "at the cap". assert.equal(0 >= VIEWER_POLICY.maxPages, false); });