Understand any codebase instantly. System intelligence for codebases, built for humans and AI.
TypeScript aiai-memoryclaude-codeclicode-analysiscode-mappingcode-memorycodebase-understandingcodexdeveloper-toolsllmopenclawpersistent-memoryprogram-analysissoftware-architecturesystem-intelligencesystem-mapping
Merge origin/main into fix/ingest-bulk-size-bounded
KageBinary661a121b3aa1
diff --cc ix-cli/src/cli/__tests__/ingest-files.test.tsindex 76521c92,46db0dfb..6769f8bd--- a/ix-cli/src/cli/__tests__/ingest-files.test.ts+++ b/ix-cli/src/cli/__tests__/ingest-files.test.ts@@@ -1193,57 -1204,41 +1204,90 @@@ describe("ingestFiles against a fake baexpect(backend.lastOps.get("src/a.ts")?.some(op => op.type === "DeleteNode"), "the patch deletes").toBe(true);expect(perFile()).toBe(1);});++ it("goes to /v1/patch on its own on a release before the one that applies bulk deletes", async () => {+ backend.releaseVersion = "1.0.31";+ await removeAFunction();+ expect(perFile()).toBe(1);+ });++ // An external package node is keyed by the workspace, not the file, so+ // every caller writes the same one. One caller dropping its call deleted+ // the node and every other caller's edge to it, though their files had+ // not changed.+ it("a file that stops calling a package function leaves the other callers' edges", async () => {+ backend.semantics = "head";+ backend.releaseVersion = "1.0.32";+ mkdirSync(join(repo, "R"), { recursive: true });+ const calls = (fn: string) => `${fn} <- function(x) {\n dplyr::filter(x)\n}\n`;+ writeFileSync(join(repo, "R", "a.R"), calls("fa"), "utf8");+ writeFileSync(join(repo, "R", "b.R"), calls("fb"), "utf8");+ execFileSync("git", ["init", "-q"], { cwd: repo, stdio: "ignore" });+ execFileSync("git", ["add", "-A"], { cwd: repo, stdio: "ignore" });+ await incremental();+ const edgeNames = () => backend.graphSignature().edges+ .map(line => line.split(" "))+ .filter(([, , , predicate]) => predicate === "CALLS")+ .map(([, src, dst]) => `${backend.nodeName(src!)} -> ${backend.nodeName(dst!)}`)+ .sort();+ expect(edgeNames()).toEqual(["fa[function] -> filter[function]", "fb[function] -> filter[function]"]);++ writeFileSync(join(repo, "R", "a.R"), "fa <- function(x) {\n x\n}\n", "utf8");+ await incremental();++ expect(edgeNames()).toEqual(["fb[function] -> filter[function]"]);+ });});+ describe("bulk requests bounded by size (IN-05)", () => {+ // 1,100 files: three parse batches, so what the first batch learns has two+ // more batches to hold for. The backend refuses a bulk over 300 ops.+ const tooLarge = () => backend.requests.filter(r => r.path === "/v1/patches/bulk" && r.code === 413).length;+ const saved = process.env.IX_COMMIT_MAX_OPS;+ afterEach(() => {+ if (saved === undefined) delete process.env.IX_COMMIT_MAX_OPS;+ else process.env.IX_COMMIT_MAX_OPS = saved;+ });++ it("learns the size from the first 413 that suggests one, and is refused no more that run", async () => {+ fixture(1100);+ backend.maxBulkOps = 300;+ backend.suggestMaxPatches = true;++ const summary = await run();++ expect(tooLarge()).toBe(1);+ expect(summary.commitErrors).toBe(0);+ expect(summary.patchesApplied).toBe(1100);+ expect(backend.singleCount, "no per-file fallback").toBe(0);+ });++ it("halves by ops on a 413 that suggests nothing, and later batches start at the learned size", async () => {+ fixture(1100);+ backend.maxBulkOps = 300;++ const summary = await run();++ // A few halvings in the first batch only; bisecting each batch afresh+ // was three times as many.+ expect(tooLarge()).toBeGreaterThan(0);+ expect(tooLarge()).toBeLessThanOrEqual(4);+ expect(summary.commitErrors).toBe(0);+ expect(summary.patchesApplied).toBe(1100);+ });++ it("is never refused when IX_COMMIT_MAX_OPS keeps every request under the cap", async () => {+ fixture(1100);+ backend.maxBulkOps = 300;+ process.env.IX_COMMIT_MAX_OPS = "300";++ const summary = await run();++ expect(tooLarge()).toBe(0);+ expect(summary.patchesApplied).toBe(1100);+ });+ });+// ── Which workspace a path belongs to ─────────────────────────────────//// `ix ingest <path>` used to treat the path as its own workspace root: `ix