fix: use shared shouldIgnore/isSupportedFile in watcher#864
Conversation
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.
|
Claude finished @carlos-alm's task —— View job PR Review Complete ❌Conducting comprehensive review of PR #864: "fix: use shared shouldIgnore/isSupportedFile in watcher" Review Checklist
Root Cause AnalysisProblem Being Solved: Why This Approach: The approach of reusing shared functions is correct in principle. Risk Assessment: CRITICAL - Implementation is incomplete and broken Critical Issues Found🚨 MAJOR BUG: Incomplete ImplementationThe PR claims to "use shared shouldIgnore/isSupportedFile in watcher" but fails to complete the refactor: Lines 145 & 149 in // Line 145: Still uses IGNORE_DIRS directly
if (IGNORE_DIRS.has(entry.name) || entry.name.startsWith('.')) continue;
// Line 149: Still uses EXTENSIONS directly
} else if (EXTENSIONS.has(path.extname(entry.name))) {Problem: These constants are NOT IMPORTED (line 5 only imports
🚨 Compilation ErrorThis code cannot possibly compile successfully. The fact that this passed any CI suggests either:
Configuration Changes✅ No high-risk configuration changes detected. Test Integrity
Code Quality Issues
Backlog Compliance
Final AssessmentRequired Changes:
|
Greptile SummaryRemoves duplicated Confidence Score: 5/5Safe to merge — clean deduplication with no behavioral regressions All changes remove duplication and replace local logic with identical shared implementations. The only behavioral delta (dotfile directory skipping in the native watcher path via shouldIgnorePath) is intentional and desirable, matching the builder. No new code paths or edge cases introduced. No files require special attention Important Files Changed
Sequence DiagramsequenceDiagram
participant FS as fs.watch / poll
participant W as watcher.ts
participant C as shared/constants.ts
participant DB as SQLite DB
FS->>W: file change event (filename)
W->>C: shouldIgnorePath(filename) calls shouldIgnore(part)
C-->>W: true/false (IGNORE_DIRS.has or startsWith('.'))
W->>C: isSupportedFile(filename)
C-->>W: true/false (SUPPORTED_EXTENSIONS.has)
W->>DB: rebuildFile(filePath)
DB-->>W: RebuildResult
W->>W: writeJournalAndChangeEvents
Reviews (2): Last reviewed commit: "fix: correct missing imports in watcher ..." | Re-trigger Greptile |
Replace raw IGNORE_DIRS/EXTENSIONS references in collectTrackedFiles with the already-imported shouldIgnore/isSupportedFile helpers, fixing the TypeScript compilation error.
|
Fixed in 90d7ecf — replaced raw |
Codegraph Impact Analysis6 functions changed → 5 callers affected across 2 files
|
Summary
shouldIgnoreandisSupportedFileinsrc/shared/constants.tswere misclassified as test-only because their only consumers were in test fileswatcher.tsduplicated the logic locally instead of importing the shared functions — replaced localshouldIgnore/isTrackedExtwith imports fromshared/constants.tsshouldIgnore'sdirName.startsWith('.')check), matching the builder'sshouldSkipEntrybehaviorTest plan
tests/unit/constants.test.ts— all 12 tests passcodegraph where shouldIgnorethat both functions are now classified as core (was test-only)