Files
mksglu__context-mode/tests/truncate-removal.test.ts
Mert Koseoglu a0b53c0f0f feat: zero-truncation architecture + reference-based snapshots
- extract.ts: replace truncate() with safeString() — store FULL event data
  in SessionDB, zero information loss (33 call sites updated)
- snapshot.ts: rewrite to reference-based format — no byte budget, no
  truncateString, each section has runnable ctx_search tool call with
  exact queries for full details on demand
- truncate.ts: delete truncateString function entirely
- All 6 sessionstart hooks: cleanupOldSessions(0) → (7) for consistent
  7-day retention across Cursor, OpenCode, VS Code, Gemini, Codex
- session-directive.mjs: platform-aware tool name via toolNamer parameter
- All sessionstart hooks: pass toolNamer to buildSessionDirective

Zero information loss. Full data stored. Compact snapshot with search
references. LLM calls ctx_search for details — no re-asking the user.

360 tests passing, zero type errors.
2026-04-04 20:48:05 +03:00

48 lines
1.2 KiB
TypeScript

/**
* RED test: truncateString must NOT be exported from src/truncate.ts.
*
* This test verifies the function was fully removed. It reads the source
* file and asserts the symbol is absent. It also verifies escapeXML,
* truncateJSON, and capBytes remain intact.
*/
import { describe, test } from "vitest";
import { strict as assert } from "node:assert";
import { readFileSync } from "node:fs";
import { join } from "node:path";
describe("truncateString removal", () => {
const src = readFileSync(
join(import.meta.dirname, "..", "src", "truncate.ts"),
"utf-8",
);
test("truncateString is not exported from src/truncate.ts", () => {
assert.ok(
!src.includes("truncateString"),
"src/truncate.ts still contains 'truncateString'",
);
});
test("escapeXML is still exported", () => {
assert.ok(
src.includes("export function escapeXML"),
"escapeXML export is missing",
);
});
test("truncateJSON is still exported", () => {
assert.ok(
src.includes("export function truncateJSON"),
"truncateJSON export is missing",
);
});
test("capBytes is still exported", () => {
assert.ok(
src.includes("export function capBytes"),
"capBytes export is missing",
);
});
});