Commit 83de2b6
fix: resolve code quality issues - pattern matching, cache logging, undefined handling
Fixed 3 code quality issues from CODE_QUALITY_REVIEW_2025.md following TDD methodology:
**Issue #6 (MEDIUM-HIGH): Watch service pattern matching**
- Problem: Only handled *.ext patterns, other glob patterns broken
- Fix: Replaced simple string matching with minimatch for proper glob support
- Tests: +4 comprehensive tests for exact filenames, prefix wildcards, complex patterns
- Location: src/services/watch.ts:93-108
- Dependencies: Added minimatch@^9.0.5
**Issue #11 (MEDIUM): Silent cache error recovery**
- Problem: Cache corruption silently deleted entries without logging
- Fix: Added console.warn() logging with key and error message
- Tests: +1 test for cache corruption detection and logging
- Location: src/storage/cache.ts:138-141
- Impact: Improves observability and debugging of cache issues
**Issue #10 (LOW): Fragile undefined handling**
- Problem: Used magic string '__UNDEFINED__' for undefined values
- Fix: Don't cache undefined values at all (cleaner approach)
- Tests: Updated 1 test to expect new behavior (return null for cache miss)
- Location: src/storage/cache.ts:157-162
- Impact: Eliminates code smell and simplifies caching logic
**Test Results:**
- Total tests: 1170 (up from 1165, +5 new tests)
- Test pass rate: 100%
- No regressions
**Remaining Issues (require significant refactoring):**
- Issue #8 (MEDIUM): Redundant file system calls
- Issue #9 (MEDIUM): Cache eviction efficiency
All fixes follow TDD approach: RED → GREEN → REFACTOR
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 00d2c08 commit 83de2b6
8 files changed
Lines changed: 972 additions & 21 deletions
File tree
- .github/workflows
- src
- services
- storage
- tests/unit
- services
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
0 commit comments