Skip to content

Commit 13ad9cb

Browse files
committed
Remove unused codeBlocks from scanner interface and implementation
- Remove codeBlocks property from IDirectoryScanner interface - Update scanner implementation to not return codeBlocks - Update tests to remove codeBlocks assertions - This completes the memory optimization by eliminating the unused return value The scanner now only returns stats and totalBlockCount, which are the only values actually used by the orchestrator. This further reduces memory usage and simplifies the interface.
1 parent 66f84f6 commit 13ad9cb

File tree

3 files changed

+2
-7
lines changed

3 files changed

+2
-7
lines changed

src/services/code-index/interfaces/file-processor.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export interface IDirectoryScanner {
3838
onBlocksIndexed?: (indexedCount: number) => void,
3939
onFileParsed?: (fileBlockCount: number) => void,
4040
): Promise<{
41-
codeBlocks: CodeBlock[]
4241
stats: {
4342
processed: number
4443
skipped: number

src/services/code-index/processors/__tests__/scanner.spec.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ describe("DirectoryScanner", () => {
195195
;(mockCodeParser.parseFile as any).mockResolvedValue(mockBlocks)
196196

197197
const result = await scannerNoEmbeddings.scanDirectory("/test")
198-
expect(result.codeBlocks).toEqual([]) // Now returns empty array for memory optimization
199198
expect(result.stats.processed).toBe(1)
200199
})
201200

@@ -332,9 +331,7 @@ describe("DirectoryScanner", () => {
332331
expect(mockCodeParser.parseFile).toHaveBeenCalledWith("test/app.js", expect.any(Object))
333332
expect(mockCodeParser.parseFile).toHaveBeenCalledWith("docs/guide.markdown", expect.any(Object))
334333

335-
// Verify codeBlocks is empty (memory optimization) but processing still works
336-
expect(result.codeBlocks).toEqual([])
337-
334+
// Verify processing still works without codeBlocks accumulation
338335
expect(result.stats.processed).toBe(3)
339336
})
340337

src/services/code-index/processors/scanner.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class DirectoryScanner implements IDirectoryScanner {
5151
onError?: (error: Error) => void,
5252
onBlocksIndexed?: (indexedCount: number) => void,
5353
onFileParsed?: (fileBlockCount: number) => void,
54-
): Promise<{ codeBlocks: CodeBlock[]; stats: { processed: number; skipped: number }; totalBlockCount: number }> {
54+
): Promise<{ stats: { processed: number; skipped: number }; totalBlockCount: number }> {
5555
const directoryPath = directory
5656
// Capture workspace context at scan start
5757
const scanWorkspace = getWorkspacePathForContext(directoryPath)
@@ -279,7 +279,6 @@ export class DirectoryScanner implements IDirectoryScanner {
279279
}
280280

281281
return {
282-
codeBlocks: [], // Return empty array to prevent memory accumulation
283282
stats: {
284283
processed: processedCount,
285284
skipped: skippedCount,

0 commit comments

Comments
 (0)