Remove dual code paths in the autoflush system. FlushManager is now the
only code path for auto-flush operations.
Changes:
- Remove legacy globals: isDirty, needsFullExport, flushTimer
- Remove flushToJSONL() wrapper function (was backward-compat shim)
- Simplify markDirtyAndScheduleFlush/FullExport to just call FlushManager
- Update tests to use FlushManager or flushToJSONLWithState directly
FlushManager handles all flush state internally in its run() goroutine,
eliminating the need for global state. Sandbox mode and tests that do
not need flushing get a no-op when FlushManager is nil.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Problem:
- TestFallbackToDirectModeEnablesFlush hung with database deadlock
- TestIdempotentImportNoTimestampChurn and TestImportMultipleUnchangedIssues also hung
- All three tests call flushToJSONL() or autoImportIfNewer() which require rootCtx
Solution:
Applied the same rootCtx initialization pattern from v0.24.1 (commit 822baa0)
to the remaining hanging tests:
- TestFallbackToDirectModeEnablesFlush in direct_mode_test.go
- TestIdempotentImportNoTimestampChurn in import_idempotent_test.go
- TestImportMultipleUnchangedIssues in import_idempotent_test.go
Results:
- Before: Tests hung for 5+ minutes with database deadlock
- After: All tests pass in ~0.1s each
Fixes#355🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>