Skip to content

Commit 690b922

Browse files
authored
Fix: Debounce baseline saves to reduce I/O and improve git operation detection (#2)
* Fix: Ignore git operations (pull/merge/checkout) from AI detection When performing git operations like pull, merge, checkout, or rebase, files are updated on disk but should not be flagged as AI-generated code. Changes: - Add `isGitOperation` flag to track git-originated changes - Add `recentTextChanges` map for deduplication logic - When file is tracked AND has no diff vs HEAD, detect as git operation - Skip AI detection for git operations (only update baseline) - Process external changes to open files (with deduplication to prevent double counting) Fixes issues where: 1. Git pull triggered false AI detection leading to automatic version bump 2. Git checkout/merge on open files were missed entirely 3. AI agents modifying open files externally were missed The fix handles all cases: - Git operations (pull, merge, checkout, rebase, commit) → Skip AI - AI agents modifying files (with uncommitted changes) → Detect AI - New untracked files → Detect AI - Non-git repos → Use baseline tracking * Disable auto-release workflow to stop automatic version bumps The workflow was automatically bumping the patch version on every push to main, which was causing unintended version increases even for non-release changes like bug fixes. This removes the automatic version bumping. Future releases will need to be done manually. * Fix: Debounce baseline saves to reduce I/O and improve git operation detection - Add debounced saving for persisted baselines (1 second delay) to reduce unnecessary disk I/O during rapid file changes - Improve git operation detection by checking FETCH_HEAD and MERGE_HEAD file modification times to detect recent pull/merge/checkout operations - Remove unnecessary debug logging and comments for cleaner code - Re-enable logging in BaseTracker for production debugging This prevents false AI detection when git operations trigger text change events as VS Code reloads files, and reduces disk I/O from excessive baseline saving. * Bump version to 0.1.4 * Fix: Update tests for git operation detection and debounce logic - Fix BaseTracker test to expect logging output (logging is now enabled) - Add proper timeout handling for git operation detection tests - Fix execSync mock to handle encoding parameter correctly - Add debounce wait periods for tests that call file change handler multiple times All tests now pass (1396 passed, 18 skipped). * Fix: SnoozeManager test timing issue - add buffer to ensure hour format The test was failing because exactly 1 hour (3600000ms) could become 59 minutes during test execution due to timing. Added 1 minute buffer (3660000ms total) to ensure the status always shows 'hour'.
1 parent f73781e commit 690b922

11 files changed

Lines changed: 4605 additions & 137 deletions

.github/workflows/release.yml

Lines changed: 0 additions & 114 deletions
This file was deleted.

0 commit comments

Comments
 (0)