docs/dev-notes/MAIN_TEST_CLEANUP_PLAN.md
main_test.go has 18 tests using deprecated global state (isDirty, flushTimer, flushMutex). These tests are slow (14 newTestStore() calls) and redundant with flush_manager_test.go.
TestAutoFlushDirtyMarking (line 22)
TestAutoFlushDisabled (line 59)
TestAutoFlushDebounce (line 90)
TestAutoFlushClearState (line 184)
TestAutoFlushConcurrency (line 355)
TestAutoFlushStoreInactive (line 403)
TestAutoFlushErrorHandling (line 582)
TestAutoFlushOnExit (line 219)
TestAutoFlushJSONLContent (line 446)
Auto-import tests (9 tests, lines 701-1412)
After deleting redundant tests:
MarkClean() method to FlushManagerclearAutoFlushState() to use flushManager.MarkClean()markDirtyAndScheduleFlush()markDirtyAndScheduleFullExport()After removing legacy path:
Remove global variables:
isDirty (line 72 in main.go)flushTimer (line 75 in main.go)flushMutex (line 74 in main.go)Update test cleanup code:
cmd/bd/main_test.go - Delete 7 tests, refactor 2 testscmd/bd/flush_manager.go - Add MarkClean() methodcmd/bd/autoflush.go - Remove legacy pathscmd/bd/main.go - Remove global variables (Phase 3)docs/MAIN_TEST_REFACTOR_NOTES.md - Update with new approachdocs/MAIN_TEST_REFACTOR_NOTES.mdcmd/bd/flush_manager.gocmd/bd/flush_manager_test.go