Turbocharge Claude Code, Cursor, Codex, Gemini & every coding agent: faster, cheaper, with contextual understanding specific to your codebase.
TypeScript ai-agentsanthropicclaude-codeclicode-graphcodexcontext-engineeringcursordeveloper-toolsgeminiknowledge-graphllmmcpmcp-serveropen-sourceopenaitree-sitter
test(skills): hold part 3's tests on Linux and Windows CI
Shrish Dwivedie36c47ee629a
diff --git a/test/lesson-index-1b.test.ts b/test/lesson-index-1b.test.tsindex 41e1a22e..b58b52e8 100644--- a/test/lesson-index-1b.test.ts+++ b/test/lesson-index-1b.test.ts@@ -11,6 +11,7 @@ import { wallLessons, writeLesson } from '../src/skills/lessons.js';import { everyRepoDir } from '../src/notes/every-repo.js';import { lessonIndexPath, refreshLessonIndex } from '../src/notes/lesson-index.js';import { tmpRepo } from './helpers.js';+import { slowness } from './machine-speed.js';const SHOP = 'github.com/acme/shop';const made: string[] = [];@@ -57,7 +58,10 @@ test('D117 (4): with the index warm, a wall hit reads 1,000 every-repo learningsconst warm: number[] = [];for (let i = 0; i < 7; i++) warm.push(cpuMs(() => assert.equal(wallLessons('docker-rootless', SHOP, env).length, 5)));const median = [...warm].sort((a, b) => a - b)[3]!;- assert.ok(median < 30, `warm median ${median.toFixed(1)} ms of CPU (cold ${cold.toFixed(1)} ms)`);+ // 30 ms where the bar was set, scaled to this machine, and never under 50: Windows counts CPU time in ~15.6 ms+ // steps, so a 5 ms read can show as 31. A lost index (warm as slow as cold) still fails the line after.+ const bar = Math.max(30 * slowness(), 50);+ assert.ok(median < bar, `warm median ${median.toFixed(1)} ms of CPU, over ${bar.toFixed(1)} ms (cold ${cold.toFixed(1)} ms)`);assert.ok(median * 3 < cold, `the index pays: warm ${median.toFixed(1)} ms, cold ${cold.toFixed(1)} ms`);});diff --git a/test/skills-anchors.test.ts b/test/skills-anchors.test.tsindex 755eba29..33965d12 100644--- a/test/skills-anchors.test.ts+++ b/test/skills-anchors.test.ts@@ -201,7 +201,8 @@ test("goneAnchors: a program not on PATH is gone; one in a fixed or version-manaassert.deepEqual(goneAnchors(nvm, b.checkout, b.env), [], "$HOME/.nvm/versions/node/*/bin");const notExec = join(b.bin, "plainfile");writeFileSync(notExec, "");- assert.deepEqual(kinds(goneAnchors(skill(["plainfile run"]), b.checkout, b.env)), ["program:plainfile#1"], "a file that can't run is not a program");+ // Windows has no exec bit: any file of the name is taken as there (guard-fast.ts programFiles), so no false warning.+ assert.deepEqual(kinds(goneAnchors(skill(["plainfile run"]), b.checkout, b.env)), process.platform === "win32" ? [] : ["program:plainfile#1"], "a file that can't run is not a program");exe(b.bin, "acme2");assert.deepEqual(goneAnchors(skill(["acme2 x"]), b.checkout, b.env), [], "on the hook's PATH");assert.deepEqual(goneAnchors(s, b.checkout, { ...b.env, PATH: "" }), [], "no PATH: no program check");diff --git a/test/skills-risk-escapes.test.ts b/test/skills-risk-escapes.test.tsindex 7205bbda..2cd8b68c 100644--- a/test/skills-risk-escapes.test.ts+++ b/test/skills-risk-escapes.test.ts@@ -164,8 +164,9 @@ test("never save: an alias or a function defined in the call can't smuggle a com});test("never save: a helper copied into the skill is read whole, not only line by line", () => {- // Not under the macOS tmpdir: its random folder name reads as a secret about one time in four (notes/secrets.ts).- const dir = join(mkdtempSync(process.platform === "darwin" ? "/tmp/g2-esc-" : join(tmpdir(), "g2-esc-")), "scratchpad");+ // Not under the macOS tmpdir or the run's own temp folder: their random names read as a secret about one time in+ // four on macOS and one in ten on Linux (notes/secrets.ts). Windows splits the path on '\', so its tmpdir is fine.+ const dir = join(mkdtempSync(process.platform === "win32" ? join(tmpdir(), "g2-esc-") : "/tmp/g2-esc-"), "scratchpad");mkdirSync(dir, { recursive: true });const helper = join(dir, "go.sh");try {