fix(core): fail-fast on corruption, preserve buffer on transient errors
- Throw from init() when integrity check fails and recovery doesn't help, preventing writes to a known-corrupt database - Only drain buffer on successful flush; requeue valid entries on transient failures (busy/IO) so they aren't silently lost - Add spy on flushAgentLogBuffer in deleteTask test to prove flush-before-delete Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4917,8 +4917,11 @@ Task with acceptance criteria
|
||||
const task = await createTestTask();
|
||||
|
||||
await store.appendAgentLog(task.id, "to be cascaded", "text");
|
||||
// deleteTask should flush first, then cascade-delete the entry
|
||||
// Prove flush happens before delete
|
||||
const flushSpy = vi.spyOn(store as any, "flushAgentLogBuffer");
|
||||
await store.deleteTask(task.id);
|
||||
expect(flushSpy).toHaveBeenCalled();
|
||||
flushSpy.mockRestore();
|
||||
|
||||
const after = (store as any).db.prepare(
|
||||
"SELECT COUNT(*) as count FROM agentLogEntries WHERE taskId = ?",
|
||||
|
||||
Reference in New Issue
Block a user