refactor: remove legacy autoflush code paths (bd-xsl9)

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>
This commit is contained in:
Steve Yegge
2025-12-23 01:56:04 -08:00
parent da15363e2b
commit 92e6f4c079
7 changed files with 48 additions and 199 deletions

View File

@@ -375,7 +375,7 @@ NOTE: Import requires direct database access and does not work with daemon mode.
// Without this, daemon FileWatcher won't detect the import for up to 30s
// Only flush if there were actual changes to avoid unnecessary I/O
if result.Created > 0 || result.Updated > 0 || len(result.IDMapping) > 0 {
flushToJSONL()
flushToJSONLWithState(flushState{forceDirty: true})
}
// Update jsonl_content_hash metadata to enable content-based staleness detection (bd-khnb fix)