Skip to content

armgit / Ix

Public Imported from GitHub
0

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

fix(ingest): keep the old extractor after a single-file ingest

KageBinary4a5945bba396
diff --git a/ix-cli/src/cli/__tests__/ingest-files.test.ts b/ix-cli/src/cli/__tests__/ingest-files.test.ts
index 540c7fc9..0e725ee2 100644
--- a/ix-cli/src/cli/__tests__/ingest-files.test.ts
+++ b/ix-cli/src/cli/__tests__/ingest-files.test.ts
@@ -846,6 +846,13 @@ describe("ingestFiles against a fake backend", () => {
writeFileSync(ingestMtimeCachePath(repo), JSON.stringify({ ...stored(), extractor: "tree-sitter/0.1" }));
await ingestFiles(repo, { format: "text", lang: "typescript", suppressOutput: true, printSummary: false });
expect(stored().extractor, "a --lang run must not vouch for the other languages").toBe("tree-sitter/0.1");
+
+ writeFileSync(join(repo, "root.ts"), "export const r = 1;\n", "utf8");
+ execFileSync("git", ["add", "-A"], { cwd: repo, stdio: "ignore" });
+ await incremental();
+ writeFileSync(ingestMtimeCachePath(repo), JSON.stringify({ ...stored(), extractor: "tree-sitter/0.1" }));
+ await ingestFiles(join(repo, "root.ts"), { format: "text", suppressOutput: true, printSummary: false });
+ expect(stored().extractor, "a single-file run must not vouch for the rest").toBe("tree-sitter/0.1");
} finally {
stderr.mockRestore();
}
diff --git a/ix-cli/src/cli/commands/ingest.ts b/ix-cli/src/cli/commands/ingest.ts
index 9cdb5751..93b8c63a 100644
--- a/ix-cli/src/cli/commands/ingest.ts
+++ b/ix-cli/src/cli/commands/ingest.ts
@@ -1944,10 +1944,10 @@ export async function ingestFiles(
);
opts.force = true;
}
- // A --lang run re-extracts only its own files, so it must not record the
- // new extractor for the rest; keep the old one and the next full run
- // still re-ingests them.
- const baselineExtractor = opts.lang ? previousBaseline?.extractor : currentExtractor;
+ // A --lang or single-file run re-extracts only its own files, so it must
+ // not record the new extractor for the rest; keep the old one and the next
+ // full run still re-ingests them.
+ const baselineExtractor = (opts.lang || stat.isFile()) ? previousBaseline?.extractor : currentExtractor;
const previousMtimes = previousBaseline?.files ?? new Map<string, number>();
const {
previousDeletedFiles,