fix: batch — 12 cubic findings from PR #36 + file-tree hardening #40
Merged
FO
5mo ago+73+73+01234567890123456789-11-11-01234567890123456789
Summary
Post-merge batch fix for 12 cubic-dev-ai findings from PR #36, plus additional file-tree tool hardening.
Fixed (12 cubic findings)
| # | Finding | Status |
|---|---|---|
| 1 | batch-patch.ts: '' sentinel deletes valid empty files on rollback | ✅ Fixed |
| 2 | smart-patch.ts: mixed hunks lose context lines on splice | ✅ Fixed |
| 3 | smart-edit.ts: old_string not validated as non-empty | ✅ Fixed |
| 4 | solution-confidence.ts: run_tests result parsing missing guard | ✅ Fixed |
| 5 | solution-confidence.ts: score can exceed 1.0 via redistribution | ✅ Fixed |
| 6 | research.ts: query elements not validated as strings | ✅ Already validated |
| 7 | research.ts: scope not validated | ✅ Already validated |
| 8 | file-tree.ts: glob regex doesn't escape special chars | ✅ Fixed |
| 9 | tests/smart-patch.test.ts: 2x missing await | ✅ Fixed |
| 10 | tests/file-tree.test.ts: missing await | ✅ Fixed |
| 11 | file-tree.ts: .gitignore claim in description | ✅ Fixed (removed claim) |
Additional file-tree hardening
- Removed
.gitignoredead-code special-casing - Unified metadata shape: single files now return
metadata.tree(notmetadata.entries) - Added symlink cycle protection (use
lstatSync, skip symlinks) - Made
SKIP_DIRSunconditional (.gitnever shown, even withinclude_hidden: true) - Added 5 new tests: filter, depth, hidden files, symlinks, single-file metadata
Test results
- 110/111 tests pass (1 pre-existing lsp-hover timeout, unrelated)
- Lint clean on all changed files
Closes #40
Summary by cubic
Batch fixes for 12 findings from PR #36 and hardens the file-tree tool for safer, more consistent output. Addresses #40.
-
Bug Fixes
- batch-patch: atomic rollback no longer deletes valid empty files (tracks non-existent files as null).
- smart-patch: preserve context lines; replace only deletions when applying hunks.
- smart-edit: require non-empty
old_string. - solution-confidence: guard test result parsing; cap redistributed score at 1.0.
- file-tree: escape glob patterns; use
lstatand skip symlinks; always skip.git,node_modules,vendor; remove.gitignorespecial-casing; single-file metadata now usesmetadata.tree. - tests: add cases for filter, depth, hidden files (default off, opt-in via
include_hidden), symlinks, and single-file metadata.
-
Migration
- If you read single-file results, switch from
metadata.entriestometadata.tree. .gitis always skipped, even withinclude_hidden: true; symlinked dirs are ignored.
- If you read single-file results, switch from
Summary by CodeRabbit
-
Bug Fixes
- Symbolic links are now properly skipped during directory traversal to prevent cycles
- Glob pattern filtering now correctly handles special characters in filter expressions
-
Improvements
- Consistent hidden file handling: dot-prefixed entries are uniformly excluded when hidden files are not requested
- Enhanced support for directory depth limiting