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
fix(client): map and ingest reads are not cut off by the read deadline (CL-15)
KageBinary59584f6effad
diff --git a/ix-cli/src/cli/__tests__/ingest-files.test.ts b/ix-cli/src/cli/__tests__/ingest-files.test.tsindex 831d103d..27cbe0fd 100644--- a/ix-cli/src/cli/__tests__/ingest-files.test.ts+++ b/ix-cli/src/cli/__tests__/ingest-files.test.ts@@ -483,6 +483,28 @@ describe("ingestFiles against a fake backend", () => {}});+ it("an ingest's reads are not cut off by the read deadline (CL-15)", async () => {+ // `ix ingest` passes no deadline, and an incremental run reads each changed+ // file's previous patch (GET /v1/patches/:id) only after discovery and the+ // parse, which on a real repo take minutes. A read deadline counted from+ // the client's creation would fail every one of those reads.+ const graph = new FakeBackend({ semantics: "head" });+ process.env.IX_ENDPOINT = await graph.start();+ try {+ fixture(5);+ await ingestFiles(repo, { format: "json", suppressOutput: true, printSummary: false });+ writeFileSync(join(repo, "src", "m000.ts"), "export function g0(): number { return 0; }\n", "utf8");+ graph.resetRequests();+ process.env.IX_READ_DEADLINE_MS = "1";+ const summary = await ingestFiles(repo, { format: "json", suppressOutput: true, printSummary: false });+ expect(summary.patchesApplied).toBe(1);+ expect(graph.unknownPaths).toEqual([]);+ } finally {+ delete process.env.IX_READ_DEADLINE_MS;+ await graph.stop();+ }+ });+it("blames the clock for the clock's losses, not the backend", async () => {// The cutoff and the run deadline both abandon patches, and three separate// review rounds found them attributed to each other -- the run telling thediff --git a/ix-cli/src/cli/commands/ingest.ts b/ix-cli/src/cli/commands/ingest.tsindex b7c7e070..e0f7c334 100644--- a/ix-cli/src/cli/commands/ingest.ts+++ b/ix-cli/src/cli/commands/ingest.ts@@ -1731,7 +1731,10 @@ export async function ingestFiles(process.stderr.write(`[multi-repo] system "${detectedSystem!.name}" (${systemId}) members=${detectedSystem!.members.join(', ')} packages=${Object.keys(packageRegistry).length} declaredDeps=${depCount}\n`);}- const client = createClient({ deadlineSignal: opts.deadlineSignal });+ // Long-running: `ix ingest` passes no deadline, and the reads it makes per+ // changed file (GET /v1/patches/:id) come after a parse that can take+ // minutes, past any read deadline counted from here.+ const client = createClient({ deadlineSignal: opts.deadlineSignal, longRunning: true });// Schema-version check forces a clean re-ingest when the backend's graph// format has changed in a way that invalidates existing node IDs (e.g. thediff --git a/ix-cli/src/cli/commands/map.ts b/ix-cli/src/cli/commands/map.tsindex bd2914b6..5059e5f0 100644--- a/ix-cli/src/cli/commands/map.ts+++ b/ix-cli/src/cli/commands/map.ts@@ -962,7 +962,9 @@ async function runMapCommand(pathArg: string | undefined, opts: { format: string}const ingestMs = Math.round(performance.now() - ingestStart);- const client = createClient({ deadlineSignal });+ // Long-running: with IX_MAP_DEADLINE_MS=0 there is no deadline, and a read+ // deadline would then cut off a map whose reads come minutes in.+ const client = createClient({ deadlineSignal, longRunning: true });const mapBarWidth = 25;const mapStart = performance.now();diff --git a/ix-cli/src/client/factory.ts b/ix-cli/src/client/factory.tsindex d8c7a01e..9898f339 100644--- a/ix-cli/src/client/factory.ts+++ b/ix-cli/src/client/factory.ts@@ -17,9 +17,11 @@ export interface CreateClientOptions {query?: boolean;/*** No read deadline: the command's reads may rightly take longer (`stats` on- * a large graph), or the client is not one command's (`@ix/pro`'s). A caller- * that passes its own `deadlineSignal` (`map`, `ingest`) gets none either:- * it has already chosen its bound.+ * a large graph, `map` and `ingest`, whose reads can come minutes in), or+ * the client is not one command's (`@ix/pro`'s). A caller that passes its+ * own `deadlineSignal` gets none either: it has already chosen its bound.+ * `map` and `ingest` say so explicitly, because their deadline can be off+ * (`IX_MAP_DEADLINE_MS=0`, and `ix ingest` passes none).*/longRunning?: boolean;}