From 70bcbcc2be0460c45976cab1f36b7ef8d18c1500 Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Sat, 4 Apr 2026 16:52:08 -0600 Subject: [PATCH 1/2] fix: use shared shouldIgnore/isSupportedFile in watcher (#838) The watcher duplicated shouldIgnore and isSupportedFile logic locally, causing the shared exports in constants.ts to be misclassified as test-only. Reuse the shared functions to fix role classification and eliminate duplication. --- src/domain/graph/watcher.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/domain/graph/watcher.ts b/src/domain/graph/watcher.ts index 61508a86..1cc656e5 100644 --- a/src/domain/graph/watcher.ts +++ b/src/domain/graph/watcher.ts @@ -2,20 +2,16 @@ import fs from 'node:fs'; import path from 'node:path'; import { closeDb, getNodeId as getNodeIdQuery, initSchema, openDb } from '../../db/index.js'; import { debug, info } from '../../infrastructure/logger.js'; -import { EXTENSIONS, IGNORE_DIRS, normalizePath } from '../../shared/constants.js'; +import { isSupportedFile, normalizePath, shouldIgnore } from '../../shared/constants.js'; import { DbError } from '../../shared/errors.js'; import { createParseTreeCache, getActiveEngine } from '../parser.js'; import { type IncrementalStmts, rebuildFile } from './builder/incremental.js'; import { appendChangeEvents, buildChangeEvent, diffSymbols } from './change-journal.js'; import { appendJournalEntries } from './journal.js'; -function shouldIgnore(filePath: string): boolean { +function shouldIgnorePath(filePath: string): boolean { const parts = filePath.split(path.sep); - return parts.some((p) => IGNORE_DIRS.has(p)); -} - -function isTrackedExt(filePath: string): boolean { - return EXTENSIONS.has(path.extname(filePath)); + return parts.some((p) => shouldIgnore(p)); } /** Prepare all SQL statements needed by the watcher's incremental rebuild. */ @@ -268,8 +264,8 @@ function startPollingWatcher(ctx: WatcherContext, pollIntervalMs: number): () => function startNativeWatcher(ctx: WatcherContext): () => void { const watcher = fs.watch(ctx.rootDir, { recursive: true }, (_eventType, filename) => { if (!filename) return; - if (shouldIgnore(filename)) return; - if (!isTrackedExt(filename)) return; + if (shouldIgnorePath(filename)) return; + if (!isSupportedFile(filename)) return; ctx.pending.add(path.join(ctx.rootDir, filename)); scheduleDebouncedProcess(ctx); From 90d7ecf9e6ecdc3ca50be0830edbeb8836960f17 Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Sat, 4 Apr 2026 21:06:27 -0600 Subject: [PATCH 2/2] fix: correct missing imports in watcher (#864) Replace raw IGNORE_DIRS/EXTENSIONS references in collectTrackedFiles with the already-imported shouldIgnore/isSupportedFile helpers, fixing the TypeScript compilation error. --- src/domain/graph/watcher.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/domain/graph/watcher.ts b/src/domain/graph/watcher.ts index 1cc656e5..a7b65e4a 100644 --- a/src/domain/graph/watcher.ts +++ b/src/domain/graph/watcher.ts @@ -142,11 +142,11 @@ function collectTrackedFiles(dir: string, result: string[]): void { return; } for (const entry of entries) { - if (IGNORE_DIRS.has(entry.name) || entry.name.startsWith('.')) continue; + if (shouldIgnore(entry.name)) continue; const full = path.join(dir, entry.name); if (entry.isDirectory()) { collectTrackedFiles(full, result); - } else if (EXTENSIONS.has(path.extname(entry.name))) { + } else if (isSupportedFile(entry.name)) { result.push(full); } }