Skip to content

Commit 83de2b6

Browse files
sjsyrekclaude
andcommitted
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/security.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Security Audit
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
schedule:
9+
# Run security audit daily at 2 AM UTC
10+
- cron: '0 2 * * *'
11+
12+
jobs:
13+
security:
14+
name: Security Checks
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '18'
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Run npm audit
31+
run: npm audit --audit-level=moderate
32+
continue-on-error: false
33+
34+
- name: Type check
35+
run: npm run type-check
36+
37+
- name: Lint
38+
run: npm run lint
39+
40+
- name: Run tests
41+
run: npm test
42+
43+
- name: Security summary
44+
if: success()
45+
run: |
46+
echo "✅ All security checks passed"
47+
echo "- npm audit: PASS"
48+
echo "- TypeScript: PASS"
49+
echo "- ESLint: PASS"
50+
echo "- Tests: PASS"

0 commit comments

Comments
 (0)