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.
This commit is contained in:
Gergo Magyar 2026-10-31 13:57:04 +00:00
parent c8451b1e69
commit d3acb9ce1d
3 changed files with 6 additions and 1 deletions

View file

@ -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();

View file

@ -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<string[]> {
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;
}

View file

@ -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();
});
});