fix: batch — 12 cubic findings from PR #36 #40
Merged
FO
4mo ago+17+17+01234567890123456789-14-14-01234567890123456789
Summary
Batch fix for 12 cubic findings from PR #36:
| # | File | Fix |
|---|---|---|
| 1 | smart-edit.ts | Validate old_string non-empty |
| 2 | solution-confidence.ts | Guard run_tests result with 'failures' in (testResult as object) |
| 3 | solution-confidence.ts | Cap score at 1.0 via Math.min(score, 1.0) |
| 4 | tests/smart-patch.test.ts | Add await before .rejects.toThrow() (line ~80) |
| 5 | tests/smart-patch.test.ts | Add await before .rejects.toThrow() (line ~92) |
| 6 | batch-patch.ts | Use null sentinel instead of '' for non-existent file snapshots; update rollback check |
| 7 | research.ts | Query element validation (already present) |
| 8 | research.ts | Scope validation (already present) |
| 9 | smart-patch.ts | Fix mixed hunk splice: bestMatch + context.length with deletions.length |
| 10 | tests/file-tree.test.ts | Add await before .rejects.toThrow() |
| 11 | file-tree.ts | Escape regex special chars in glob filter |
| 12 | file-tree.ts | Fix .gitignore claim in description |
Checklist
- Tests pass (
bun test— 105 pass, 1 pre-existing LSP timeout failure) - Lint clean (
bun run lint) - Typecheck clean (
bun run typecheck) - Build succeeds (
bun run build) - Version bumped:
0.4.2→0.4.3
Summary by cubic
Batch fixes for 12 issues to improve patch reliability, file tree filtering, test stability, and confidence scoring. Adds safer atomic rollbacks and input validation.
- Bug Fixes
- Atomic batch patches: snapshot non-existent files as null and delete them on rollback.
- Smart patch: replace only deletions at best match (preserve context) for mixed hunks.
- Smart edit: require non-empty
old_string. - Solution confidence: guard test results access and cap score at 1.0.
- File tree filter: escape regex metacharacters; update description to remove
.gitignoreclaim. - Tests: add missing
awaiton.rejects.toThrow()in smart-patch and file-tree tests.
Summary by CodeRabbit
Release Notes v0.4.3
-
Bug Fixes
- Fixed glob pattern filtering with special characters
- Improved patch hunk application to preserve context lines
- Enhanced parameter validation for edit operations
- Fixed snapshot handling for deleted files
- Capped confidence scores to 100% maximum
-
Tests
- Fixed async test assertions
-
Chores
- Version bump to 0.4.3