From d3acb9ce1dcc5d020cc163ea97c751af9da7f7f3 Mon Sep 17 00:00:00 2001 From: Gergo Magyar Date: Sat, 31 Oct 2026 13:57:04 +0000 Subject: [PATCH] fix(lbug): clear analysis memory budget Restore the normal reader budget after indexing. The leaked adaptive hint exhausted the 0.22.0 pool during query and rename operations. Assert the budget is restored after real analyses, and give integrity cases unique CI audit identities. --- gitnexus/src/core/run-analyze.ts | 2 ++ gitnexus/test/integration/objective-c-provider.test.ts | 3 +++ gitnexus/test/unit/symbol-filepath-integrity.test.ts | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gitnexus/src/core/run-analyze.ts b/gitnexus/src/core/run-analyze.ts index 4e6dd278f..bec58c4b6 100644 --- a/gitnexus/src/core/run-analyze.ts +++ b/gitnexus/src/core/run-analyze.ts @@ -1556,6 +1556,8 @@ export async function runFullAnalysis( else if (options.shareWith) await setShareOptOut(repoPath, false); return result; } finally { + // Readers opened after analyze must not inherit its smaller write budget. + setBufferPoolSizeHint(undefined); await removeColdParseRebuildDir(parseRun.storagePath, true); discardScopedEmbeddingSpills(); lock.release(); diff --git a/gitnexus/test/integration/objective-c-provider.test.ts b/gitnexus/test/integration/objective-c-provider.test.ts index b060636fb..cde7a3f95 100644 --- a/gitnexus/test/integration/objective-c-provider.test.ts +++ b/gitnexus/test/integration/objective-c-provider.test.ts @@ -7,6 +7,7 @@ import { fileURLToPath } from 'url'; import type { GraphNode, RelationshipType } from 'gitnexus-shared'; import { runPipelineFromRepo } from '../../src/core/ingestion/pipeline.js'; import { runFullAnalysis } from '../../src/core/run-analyze.js'; +import { getEffectiveBufferPoolSize } from '../../src/core/lbug/lbug-config.js'; import { LocalBackend } from '../../src/mcp/local/local-backend.js'; import { classifyObjectiveCFileContent } from '../../src/core/ingestion/languages/objective-c.js'; import type { PipelineResult } from '../../src/types/pipeline.js'; @@ -213,6 +214,7 @@ async function analyzeObjectiveCRepo( options: { force?: boolean } = {}, ): Promise { const logs: string[] = []; + const readerBudget = getEffectiveBufferPoolSize(); await runFullAnalysis( repoRoot, { @@ -226,6 +228,7 @@ async function analyzeObjectiveCRepo( onLog: (message) => logs.push(message), }, ); + expect(getEffectiveBufferPoolSize()).toBe(readerBudget); return logs; } diff --git a/gitnexus/test/unit/symbol-filepath-integrity.test.ts b/gitnexus/test/unit/symbol-filepath-integrity.test.ts index 5e427c0a1..ca75730eb 100644 --- a/gitnexus/test/unit/symbol-filepath-integrity.test.ts +++ b/gitnexus/test/unit/symbol-filepath-integrity.test.ts @@ -38,7 +38,7 @@ describe('source UID/path consistency (#3527)', () => { ['Method:checks/test_batch.py:Batch.test_run#0', undefined], ['Method:checks/test_batch.py:Batch.test_run#0', null], ['Method:checks/test_batch.py:Batch.test_run#0', ''], - ])('preserves valid paths and legacy/synthetic identities: %s', (id, filePath) => { + ])('preserves valid paths and legacy/synthetic identities: %s / %j', (id, filePath) => { expect(() => assertSymbolFilePath(id, filePath)).not.toThrow(); }); });