fix: batch — 12 cubic findings from PR #36 #40

Merged
FO
4mo ago
+17-14

Summary

Batch fix for 12 cubic findings from PR #36:

#FileFix
1smart-edit.tsValidate old_string non-empty
2solution-confidence.tsGuard run_tests result with 'failures' in (testResult as object)
3solution-confidence.tsCap score at 1.0 via Math.min(score, 1.0)
4tests/smart-patch.test.tsAdd await before .rejects.toThrow() (line ~80)
5tests/smart-patch.test.tsAdd await before .rejects.toThrow() (line ~92)
6batch-patch.tsUse null sentinel instead of '' for non-existent file snapshots; update rollback check
7research.tsQuery element validation (already present)
8research.tsScope validation (already present)
9smart-patch.tsFix mixed hunk splice: bestMatch + context.length with deletions.length
10tests/file-tree.test.tsAdd await before .rejects.toThrow()
11file-tree.tsEscape regex special chars in glob filter
12file-tree.tsFix .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 .gitignore claim.
    • Tests: add missing await on .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