Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

test(ingest): fill the missing-behaviour matrix (QA-07) (#848)

Ian Hock473dadbe0890
diff --git a/core-ingestion/src/__tests__/parseFile.binary.test.ts b/core-ingestion/src/__tests__/parseFile.binary.test.ts
new file mode 100644
index 00000000..713697af
--- /dev/null
+++ b/core-ingestion/src/__tests__/parseFile.binary.test.ts
@@ -0,0 +1,58 @@
+// Copyright 2026 Ix Infrastructure Inc.
+
+import { describe, expect, it } from 'vitest';
+
+import { parseFile } from '../index.js';
+
+// QA-07. Ingest decodes every file with `bytes.toString('utf-8')` and has no
+// binary or NUL check, so a stray NUL byte or invalid UTF-8 in a `.ts` file
+// reaches `parseFile` as an ordinary string. The only guard is the catch at
+// the end of `parseFile`, which turns a throw into `null` plus `onFailure`.
+//
+// Inputs are built from escapes: this source holds no raw NUL byte.
+//
+// Measured when written: tree-sitter does NOT truncate at a NUL. Both
+// functions either side are extracted, and the tree is flagged
+// `hasParseErrors`. No input tried makes `parseFile` throw, so the catch has
+// nothing here to guard: these are pins on current behaviour, and the red
+// check is a truncation of the source at the first NUL (see the PR).
+
+function names(result: ReturnType<typeof parseFile>): string[] {
+ return (result?.entities ?? []).map((entity) => entity.name);
+}
+
+describe('parseFile on binary-looking input (QA-07)', () => {
+ it('extracts the functions either side of NUL bytes without throwing', () => {
+ const source = 'export function before() {}\n' + '\u0000\u0000' + '\nexport function after() {}\n';
+ const failures: unknown[] = [];
+
+ let result: ReturnType<typeof parseFile> = null;
+ expect(() => {
+ result = parseFile('nul.ts', source, { onFailure: (failure) => failures.push(failure) });
+ }).not.toThrow();
+
+ expect(failures).toEqual([]);
+ expect(result).not.toBeNull();
+ expect(names(result)).toEqual(expect.arrayContaining(['before', 'after']));
+ });
+
+ it('extracts the functions either side of invalid UTF-8, decoded as ingest decodes it', () => {
+ const bytes = Buffer.concat([
+ Buffer.from('export function a() {}\n'),
+ Buffer.from([0xff, 0xfe, 0xc3]),
+ Buffer.from('\nexport function b() {}\n'),
+ ]);
+ const source = bytes.toString('utf-8');
+ expect(source).toContain('�');
+ const failures: unknown[] = [];
+
+ let result: ReturnType<typeof parseFile> = null;
+ expect(() => {
+ result = parseFile('bad-utf8.ts', source, { onFailure: (failure) => failures.push(failure) });
+ }).not.toThrow();
+
+ expect(failures).toEqual([]);
+ expect(result).not.toBeNull();
+ expect(names(result)).toEqual(expect.arrayContaining(['a', 'b']));
+ });
+});
diff --git a/ix-cli/package.json b/ix-cli/package.json
index bfa78b02..e32e21b4 100644
--- a/ix-cli/package.json
+++ b/ix-cli/package.json
@@ -19,6 +19,7 @@
"build": "node scripts/build-core-ingestion.mjs && node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json && node -e \"require('fs').copyFileSync('../docker-compose.standalone.yml','dist/docker-compose.standalone.yml')\"",
"test": "node scripts/build-core-ingestion.mjs && vitest run && node test/parser.smoke.mjs",
"test:unit": "vitest run",
+ "test:slow": "vitest run --config vitest.slow.config.ts",
"test:coverage": "vitest run --coverage",
"test:e2e": "npm run build && vitest run --config vitest.e2e.config.ts",
"e2e:up": "node test/e2e/stack.mjs up",
diff --git a/ix-cli/src/cli/__tests__/helpers/fake-backend.ts b/ix-cli/src/cli/__tests__/helpers/fake-backend.ts
index 73f7dc2b..4dc28531 100644
--- a/ix-cli/src/cli/__tests__/helpers/fake-backend.ts
+++ b/ix-cli/src/cli/__tests__/helpers/fake-backend.ts
@@ -30,6 +30,8 @@ export class FakeBackend {
readonly sourceWorkspaceIds: Array<string | undefined> = [];
/** The ops of the last patch sent for each `source.uri`. */
readonly lastOps = new Map<string, Array<Record<string, unknown>>>();
+ /** The `patchId` of the last patch sent for each `source.uri`. */
+ readonly lastPatchIds = new Map<string, string>();
/** Paths this fake does not implement. Asserted empty after every test. */
readonly unknownPaths: string[] = [];
@@ -400,11 +402,12 @@ export class FakeBackend {
/* a body we cannot read is still a request */
}
this.requests.push({ path, patches: patches.length });
- for (const { source, ops } of patches) {
+ for (const { source, ops, patchId } of patches) {
if (!source?.uri) continue;
this.sourceUris.push(source.uri);
this.sourceWorkspaceIds.push(source.workspaceId);
this.lastOps.set(source.uri, ops ?? []);
+ if (patchId !== undefined) this.lastPatchIds.set(source.uri, patchId);
}
if (this.abortAfterCommits !== undefined && this.commitCount >= this.abortAfterCommits) {
this.aborter.abort();
diff --git a/ix-cli/src/cli/__tests__/ingest-discovery.test.ts b/ix-cli/src/cli/__tests__/ingest-discovery.test.ts
index 411a1398..5441a66b 100644
--- a/ix-cli/src/cli/__tests__/ingest-discovery.test.ts
+++ b/ix-cli/src/cli/__tests__/ingest-discovery.test.ts
@@ -14,6 +14,7 @@ import {
isWithinDiscoveryRoot,
tryGitLsFiles,
} from '../commands/ingest.js';
+import { discoverSourceFiles, emptyDiscoveryCounts, walkFiles } from '../file-discovery.js';
describe('dedupeDiscoveredFilePaths', () => {
it('collapses alternate discovered paths that point at the same canonical file', () => {
@@ -227,4 +228,75 @@ describe('discovery symlink containment', () => {
expect(kept).toContain(join(repo, 'shared', 'util.ts'));
},
);
+
+ // QA-07. A directory symlink to its parent is a loop. Guards: the Dirent
+ // checks in walkFiles (a link is neither isDirectory() nor isFile(), so the
+ // walk never descends), and the statSync(...).isFile() in tryGitLsFiles.
+ it.skipIf(process.platform === 'win32')(
+ 'walkFiles does not follow a directory symlink to its parent',
+ () => {
+ const repo = scratchDir('ix-loop-');
+ mkdirSync(join(repo, 'src'), { recursive: true });
+ writeFileSync(join(repo, 'src', 'a.ts'), 'export const a = 1;\n');
+ writeFileSync(join(repo, 'src', 'b.ts'), 'export const b = 1;\n');
+ try {
+ symlinkSync('..', join(repo, 'src', 'up'), 'dir');
+ } catch {
+ return; // no permission to symlink — nothing to assert
+ }
+
+ const walked = [...walkFiles(repo, true)].map((p) => p.slice(repo.length + 1)).sort();
+
+ expect(walked).toEqual(['src/a.ts', 'src/b.ts']);
+ expect(walked.some((p) => p.includes('/up/'))).toBe(false);
+ },
+ );
+
+ // QA-07. The walk's other Dirent check: only a real file (entry.isFile())
+ // is yielded, so a file symlink with a source extension that points out of
+ // the repository is never read on the no-git path.
+ it.skipIf(process.platform === 'win32')(
+ 'walkFiles does not yield a file symlink that leaves the repository',
+ () => {
+ const repo = scratchDir('ix-walk-leak-');
+ const outside = scratchDir('ix-walk-outside-');
+ const secret = join(outside, 'secret.ts');
+ writeFileSync(secret, 'export const token = "leaked";\n');
+ mkdirSync(join(repo, 'src'), { recursive: true });
+ writeFileSync(join(repo, 'src', 'a.ts'), 'export const a = 1;\n');
+ try {
+ symlinkSync(secret, join(repo, 'src', 'notes.ts'));
+ } catch {
+ return; // no permission to symlink — nothing to assert
+ }
+
+ const walked = [...walkFiles(repo, true)].map((p) => p.slice(repo.length + 1)).sort();
+
+ expect(walked).toEqual(['src/a.ts']);
+ },
+ );
+
+ it.skipIf(process.platform === 'win32')(
+ 'a git-tracked directory symlink is not discovered as a file',
+ () => {
+ const repo = scratchDir('ix-loop-git-');
+ mkdirSync(join(repo, 'src'), { recursive: true });
+ writeFileSync(join(repo, 'src', 'a.ts'), 'export const a = 1;\n');
+ writeFileSync(join(repo, 'src', 'b.ts'), 'export const b = 1;\n');
+ try {
+ // Named like a source file, so only the stat check can drop it.
+ symlinkSync('..', join(repo, 'src', 'up.ts'), 'dir');
+ execFileSync('git', ['init', '-q'], { cwd: repo });
+ execFileSync('git', ['add', '-A'], { cwd: repo });
+ } catch {
+ return; // no git, or no permission to symlink — nothing to assert
+ }
+
+ const counts = emptyDiscoveryCounts();
+ const files = discoverSourceFiles(repo, { counts });
+
+ expect(files.map((p) => p.slice(repo.length + 1)).sort()).toEqual(['src/a.ts', 'src/b.ts']);
+ expect(counts.unreadable).toBe(0);
+ },
+ );
});
diff --git a/ix-cli/src/cli/__tests__/ingest-files.test.ts b/ix-cli/src/cli/__tests__/ingest-files.test.ts
index 7efca015..af6f4e09 100644
--- a/ix-cli/src/cli/__tests__/ingest-files.test.ts
+++ b/ix-cli/src/cli/__tests__/ingest-files.test.ts
@@ -1692,4 +1692,145 @@ describe("ingestFiles against a fake backend", () => {
expect(sent()).toEqual([{ uri: "alpha/alpha.ts", workspaceId: alphaId }]);
expect(registered().map(w => w.root)).toEqual([repo]);
});
+ describe("QA-07: behaviours the matrix was missing", () => {
+ const incremental = () =>
+ ingestFiles(repo, { format: "json", suppressOutput: true, printSummary: false });
+ const git = (...args: string[]) => execFileSync("git", args, { cwd: repo, stdio: "ignore" });
+
+ // Guard: ingest.ts `deletedPatches.push(...)` for a path that left the tree.
+ it("a file renamed between runs sends a tombstone for the old path and a patch for the new", async () => {
+ backend.semantics = "head";
+ backend.releaseVersion = "1.0.32";
+ mkdirSync(join(repo, "src"), { recursive: true });
+ writeFileSync(join(repo, "src", "a.ts"), "export function fa(): number { return 1; }\n", "utf8");
+ writeFileSync(join(repo, "src", "b.ts"), "export function fb(): number { return 2; }\n", "utf8");
+ git("init", "-q");
+ git("add", "-A");
+ await incremental();
+ expect(backend.graphSignature().nodes.some(n => n.includes("a.ts"))).toBe(true);
+
+ git("mv", "src/a.ts", "src/c.ts");
+ backend.resetRequests();
+ backend.sourceUris.length = 0;
+ await incremental();
+
+ expect(backend.sourceUris.filter(u => u === "src/a.ts"), "one patch for the old path").toHaveLength(1);
+ expect(backend.sourceUris.filter(u => u === "src/c.ts"), "one patch for the new path").toHaveLength(1);
+ expect(backend.sourceUris, "an untouched file is not re-sent").not.toContain("src/b.ts");
+
+ const oldOps = backend.lastOps.get("src/a.ts")!;
+ expect(oldOps.length).toBeGreaterThan(0);
+ expect(oldOps.every(op => op.type === "DeleteNode" || op.type === "DeleteEdge"), "the tombstone only deletes").toBe(true);
+ expect(oldOps.some(op => op.type === "DeleteNode"), "and removes nodes").toBe(true);
+ expect(backend.lastOps.get("src/c.ts")!.some(op => op.type === "UpsertNode")).toBe(true);
+
+ const names = backend.graphSignature().nodes.join("\n");
+ expect(names).not.toContain("a.ts");
+ expect(names).toContain("c.ts");
+
+ // Head semantics: the incremental graph is the one a fresh map builds.
+ const incrementalGraph = backend.graphSignature();
+ const fresh = new FakeBackend({ semantics: "head" });
+ const endpoint = process.env.IX_ENDPOINT;
+ process.env.IX_ENDPOINT = await fresh.start();
+ try {
+ await ingestFiles(repo, { format: "json", force: true, suppressOutput: true, printSummary: false });
+ expect(incrementalGraph).toEqual(fresh.graphSignature());
+ } finally {
+ process.env.IX_ENDPOINT = endpoint;
+ await fresh.stop();
+ }
+ });
+
+ // The failing-capable proof for the walk is the walkFiles case in
+ // ingest-discovery.test.ts: discoverSourceFiles' canonical dedupe hides a
+ // walk that follows the link at this level. This is the end-to-end run.
+ for (const mode of ["git", "no-git"] as const) {
+ it(`a directory symlink to its parent ends the run with each file sent once (${mode})`, async () => {
+ fixture(3);
+ try {
+ symlinkSync("..", join(repo, "src", "up"), "dir");
+ } catch {
+ return; // no permission to symlink — nothing to assert
+ }
+ if (mode === "no-git") rmSync(join(repo, ".git"), { recursive: true, force: true });
+ else git("add", "-A");
+
+ await incremental();
+
+ for (const n of ["m000", "m001", "m002"]) {
+ expect(backend.sourceUris.filter(u => u === `src/${n}.ts`), n).toHaveLength(1);
+ }
+ expect(backend.sourceUris.some(u => u.includes("up/"))).toBe(false);
+ });
+ }
+
+ it("a .ts file with NUL bytes and invalid UTF-8 does not stop the ingest", async () => {
+ fixture(3);
+ // Escapes only: no raw NUL in this source.
+ writeFileSync(
+ join(repo, "src", "bin.ts"),
+ Buffer.concat([
+ Buffer.from("export function before(): number { return 1; }\n"),
+ Buffer.from([0x00, 0x00, 0xff, 0xfe, 0xc3, 0x28]),
+ Buffer.from("\nexport function after(): number { return 2; }\n"),
+ ]),
+ );
+ git("add", "-A");
+
+ const summary = await incremental();
+
+ for (const n of ["m000", "m001", "m002"]) {
+ expect(backend.sourceUris, n).toContain(`src/${n}.ts`);
+ }
+ // Observed today: it lands AND is counted in filesWithParseErrors. Either
+ // alone is acceptable; neither is a silent drop.
+ const landed = backend.sourceUris.includes("src/bin.ts");
+ const counted = summary.parseErrors + summary.filesWithParseErrors > 0;
+ expect(landed || counted, "bin.ts landed or was counted as a parse error").toBe(true);
+ });
+
+ // Guards the id inputs: a run-varying value in workspaceIdForPath
+ // (system.ts) or computePatchId (core-ingestion patch-builder.ts) turns it
+ // red. It cannot see a dropped .sort(): both runs discover the same files
+ // in the same order, so an unsorted list is still the same list twice.
+ it("two fresh ingests of one tree send byte-identical patch ids and ops", async () => {
+ fixture(30);
+ for (let i = 0; i < 30; i += 3) {
+ const target = (i + 1) % 30;
+ writeFileSync(
+ join(repo, "src", `m${String(i).padStart(3, "0")}.ts`),
+ `import { f${target} } from "./m${String(target).padStart(3, "0")}.js";\n` +
+ `export function f${i}(): number { return f${target}() + ${i}; }\n`,
+ "utf8",
+ );
+ }
+ git("add", "-A");
+ const snapshot = (b: FakeBackend) =>
+ [...b.lastOps.keys()].sort().map(uri => [uri, b.lastPatchIds.get(uri), JSON.stringify(b.lastOps.get(uri))]);
+
+ await incremental();
+ const first = snapshot(backend);
+ expect(first).toHaveLength(30);
+ expect(first.every(([, id]) => typeof id === "string" && id.length > 0)).toBe(true);
+
+ const second = new FakeBackend();
+ const homeB = realpathSync.native(mkdtempSync(join(tmpdir(), "ix-ingest-home-b-")));
+ const keep = { HOME: process.env.HOME, USERPROFILE: process.env.USERPROFILE, IX_ENDPOINT: process.env.IX_ENDPOINT, IX_LOCK_DIR: process.env.IX_LOCK_DIR };
+ try {
+ process.env.IX_ENDPOINT = await second.start();
+ process.env.HOME = homeB;
+ process.env.USERPROFILE = homeB;
+ process.env.IX_LOCK_DIR = join(homeB, "locks");
+ await incremental();
+ expect(snapshot(second)).toEqual(first);
+ } finally {
+ for (const [k, v] of Object.entries(keep)) {
+ if (v === undefined) delete process.env[k]; else process.env[k] = v;
+ }
+ await second.stop();
+ removeTree(homeB);
+ }
+ });
+ });
});
diff --git a/ix-cli/src/cli/__tests__/ingest-scale.slow.test.ts b/ix-cli/src/cli/__tests__/ingest-scale.slow.test.ts
new file mode 100644
index 00000000..40412a49
--- /dev/null
+++ b/ix-cli/src/cli/__tests__/ingest-scale.slow.test.ts
@@ -0,0 +1,136 @@
+// Copyright 2026 Ix Infrastructure Inc.
+
+import { afterEach, beforeEach, describe, expect, it } from "vitest";
+import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { execFileSync } from "node:child_process";
+
+import { ingestFiles } from "../commands/ingest.js";
+import { FakeBackend } from "./helpers/fake-backend.js";
+
+/**
+ * QA-07: a 5,000-file tree through one real `ingestFiles` run, with wall-time,
+ * peak-RSS and request-count bounds.
+ *
+ * Slow on purpose: it runs under `npm run test:slow` (vitest.slow.config.ts)
+ * and is excluded from `npm run test:unit` and coverage. It is not wired into
+ * CI.
+ *
+ * The bounds are about 3x the value measured on the machine that wrote this
+ * (see the constants), so they catch an order-of-magnitude regression -- a
+ * per-file commit, a leak that holds every parse result -- without flaking on
+ * a slower runner. RSS includes the parse pool's worker threads.
+ */
+
+const FILES = 5_000;
+const DIRS = 50;
+// Measured locally: wall 2.7 s, peak RSS growth 521 MB, 10 bulk requests. RSS
+// and bulks are bounded at about 3x; wall is looser (30 s) because a CI runner
+// is slower and the point is catching minutes, not seconds.
+const MAX_WALL_MS = 30_000;
+const MAX_RSS_GROWTH_BYTES = 1_500_000_000;
+// The size and op caps split 5,000 files into 10 bulks. A per-file commit
+// would be 5,000.
+const MAX_BULKS = 30;
+
+describe("ingestFiles at 5,000 files (QA-07)", () => {
+ let home = "";
+ let repo = "";
+ let backend: FakeBackend | undefined;
+ const saved: Record<string, string | undefined> = {};
+
+ beforeEach(async () => {
+ backend = new FakeBackend();
+ home = realpathSync.native(mkdtempSync(join(tmpdir(), "ix-scale-home-")));
+ repo = realpathSync.native(mkdtempSync(join(tmpdir(), "ix-scale-repo-")));
+ const endpoint = await backend.start();
+ for (const k of [
+ "HOME", "USERPROFILE", "IX_ENDPOINT", "IX_LOCK_DIR", "IX_COMMIT_FAILURE_LIMIT",
+ "IX_COMMIT_HTTP_MAX_FILES", "IX_COMMIT_MAX_OPS", "IX_COMMIT_CONCURRENCY",
+ "IX_PARSE_WORKERS", "IX_DEBUG", "IX_STITCH_COOLDOWN_MS", "IX_STITCH_WAIT_MS",
+ "IX_MAP_DEADLINE_MS",
+ ]) {
+ // Cleared so an ambient value cannot move the bulk count or RSS under
+ // test. It also means `IX_COMMIT_HTTP_MAX_FILES=1 npm run test:slow` does
+ // not reach the run: to see the bulk bound fail, change the default in
+ // ingest.ts (`parsePositiveIntEnv('IX_COMMIT_HTTP_MAX_FILES', 1000)`).
+ saved[k] = process.env[k];
+ delete process.env[k];
+ }
+ process.env.HOME = home;
+ process.env.USERPROFILE = home;
+ process.env.IX_ENDPOINT = endpoint;
+ process.env.IX_LOCK_DIR = join(home, "locks");
+ });
+
+ afterEach(async () => {
+ try {
+ if (backend) expect(backend.unknownPaths, "endpoints the fake does not implement").toEqual([]);
+ } finally {
+ for (const [k, v] of Object.entries(saved)) {
+ if (v === undefined) delete process.env[k];
+ else process.env[k] = v;
+ }
+ try {
+ await backend?.stop();
+ } finally {
+ for (const dir of [home, repo]) {
+ if (!dir) continue;
+ try {
+ rmSync(dir, { recursive: true, force: true });
+ } catch (err) {
+ process.stderr.write(`ingest-scale teardown: could not remove ${dir}: ${String(err)}\n`);
+ }
+ }
+ home = "";
+ repo = "";
+ }
+ }
+ });
+
+ it("finishes inside the wall-time and memory bounds, in a bounded number of requests", async () => {
+ const dirOf = (i: number) => `pkg${String(i % DIRS).padStart(2, "0")}`;
+ const nameOf = (i: number) => `f${String(i).padStart(4, "0")}`;
+ for (let d = 0; d < DIRS; d++) mkdirSync(join(repo, `pkg${String(d).padStart(2, "0")}`), { recursive: true });
+ for (let i = 0; i < FILES; i++) {
+ // Every tenth file imports the one before it, so there are edges to resolve.
+ const dep = i % 10 === 0 && i > 0 ? i - 1 : -1;
+ const imp = dep >= 0 ? `import { ${nameOf(dep)} } from "../${dirOf(dep)}/${nameOf(dep)}.js";\n` : "";
+ const call = dep >= 0 ? `${nameOf(dep)}() + ` : "";
+ writeFileSync(
+ join(repo, dirOf(i), `${nameOf(i)}.ts`),
+ `${imp}export function ${nameOf(i)}(): number { return ${call}${i}; }\n`,
+ "utf8",
+ );
+ }
+ execFileSync("git", ["init", "-q"], { cwd: repo, stdio: "ignore" });
+ execFileSync("git", ["add", "-A"], { cwd: repo, stdio: "ignore" });
+
+ const baseRss = process.memoryUsage().rss;
+ let peakRss = baseRss;
+ const sampler = setInterval(() => {
+ peakRss = Math.max(peakRss, process.memoryUsage().rss);
+ }, 100);
+ const started = Date.now();
+ try {
+ await ingestFiles(repo, { format: "json", suppressOutput: true, printSummary: false });
+ } finally {
+ clearInterval(sampler);
+ }
+ const wallMs = Date.now() - started;
+ peakRss = Math.max(peakRss, process.memoryUsage().rss);
+ process.stderr.write(`ingest-scale: wall=${wallMs}ms peakRssGrowth=${peakRss - baseRss}B bulks=${backend!.bulkCount}\n`);
+
+ expect(wallMs, "wall time").toBeLessThan(MAX_WALL_MS);
+ expect(peakRss - baseRss, "peak RSS growth").toBeLessThan(MAX_RSS_GROWTH_BYTES);
+ expect(backend!.bulkCount, "bulk requests").toBeLessThanOrEqual(MAX_BULKS);
+ expect(backend!.singleCount, "no per-file fallback").toBe(0);
+ expect(backend!.unknownPaths).toEqual([]);
+
+ const sent = new Map<string, number>();
+ for (const uri of backend!.sourceUris) sent.set(uri, (sent.get(uri) ?? 0) + 1);
+ expect(sent.size).toBe(FILES);
+ expect([...sent.values()].filter(n => n !== 1)).toEqual([]);
+ });
+});
diff --git a/ix-cli/vitest.config.ts b/ix-cli/vitest.config.ts
index e9be862c..7ced0f94 100644
--- a/ix-cli/vitest.config.ts
+++ b/ix-cli/vitest.config.ts
@@ -11,7 +11,7 @@ export default defineConfig({
// collected and fail (they read sibling `.ts` sources that only exist under
// `src/`). Re-exclude it. parser.test.ts is run separately via
// `test/parser.smoke.mjs`, so keep it out of the default `vitest run`.
- exclude: [...configDefaults.exclude, "dist/**", "test/parser.test.ts"],
+ exclude: [...configDefaults.exclude, "dist/**", "test/parser.test.ts", "**/*.slow.test.ts"],
// Sized for what this suite actually DOES, not for unit tests.
//
// Vitest defaults to 5s per test and 10s per hook, which suits pure
diff --git a/ix-cli/vitest.slow.config.ts b/ix-cli/vitest.slow.config.ts
new file mode 100644
index 00000000..8ee65820
--- /dev/null
+++ b/ix-cli/vitest.slow.config.ts
@@ -0,0 +1,19 @@
+// Copyright 2026 Ix Infrastructure Inc.
+
+import { defineConfig } from "vitest/config";
+
+// Slow tests (`*.slow.test.ts`): scale runs (today one 5k-file ingest that
+// takes seconds) kept out of the default config (`npm run test:unit`,
+// coverage) by its exclude list and run with `npm run test:slow`. Not wired
+// into CI. Files run one at a time so their wall-time and RSS readings are
+// not each other's noise; the timeout leaves room for slow machines.
+export default defineConfig({
+ test: {
+ setupFiles: ["./vitest.setup.ts"],
+ include: ["src/**/*.slow.test.ts"],
+ fileParallelism: false,
+ sequence: { concurrent: false },
+ testTimeout: 120_000,
+ hookTimeout: 60_000,
+ },
+});