refactor: Delete 7 redundant tests from main_test.go (3x speedup)

Problem: main_test.go was testing deprecated legacy path after FlushManager
refactoring (bd-52), duplicating coverage from flush_manager_test.go.

Solution: Delete redundant tests, keep only unique integration tests.

Changes:
- Deleted 7 tests (407 lines) covered by flush_manager_test.go:
  * TestAutoFlushDirtyMarking → TestFlushManagerMarkDirtyTriggersFlush
  * TestAutoFlushDisabled → TestFlushManagerDisabledDoesNotFlush
  * TestAutoFlushDebounce (already skipped, obsolete)
  * TestAutoFlushClearState (tested implicitly in export/sync)
  * TestAutoFlushConcurrency → TestFlushManagerConcurrentMarkDirty
  * TestAutoFlushStoreInactive → TestPerformFlushStoreInactive
  * TestAutoFlushErrorHandling → TestPerformFlushErrorHandling

- Kept 2 unique integration tests:
  * TestAutoFlushOnExit (tests PersistentPostRun)
  * TestAutoFlushJSONLContent (tests actual JSONL output)

- Updated clearAutoFlushState() to no-op when FlushManager exists

Results:
- Before: 18 tests, 1079 lines, ~15-20s
- After: 11 tests, 672 lines, ~5-7s
- Speedup: ~3x faster
- All tests passing 

Files:
- cmd/bd/main_test.go: Deleted 7 tests, removed unused imports
- cmd/bd/autoflush.go: Updated clearAutoFlushState()
- docs/MAIN_TEST_REFACTOR_NOTES.md: Documented solution
- docs/MAIN_TEST_CLEANUP_PLAN.md: Created detailed plan

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-11-21 21:23:28 -05:00
parent 76ebb2a7b9
commit fa727c7d73
4 changed files with 193 additions and 409 deletions

View File

@@ -314,6 +314,14 @@ func markDirtyAndScheduleFullExport() {
// clearAutoFlushState cancels pending flush and marks DB as clean (after manual export)
func clearAutoFlushState() {
// With FlushManager, clearing state is unnecessary (new path)
// If a flush is pending and fires after manual export, flushToJSONLWithState()
// will detect nothing is dirty and skip the flush. This is harmless.
if flushManager != nil {
return
}
// Legacy path for backward compatibility with tests
flushMutex.Lock()
defer flushMutex.Unlock()