|
|
@@ -539,6 +539,7 @@ describe('JsonlSessionPersistence: default Zstandard encoding', () => {
|
|
|
const root = await freshRoot()
|
|
|
const ctx = await mount(root)
|
|
|
const header = meta('recover-torn', '/proj')
|
|
|
+ const warn = vi.spyOn(ctx.logger, 'warn').mockImplementation(() => undefined)
|
|
|
await ctx.sessionPersistence.create(header)
|
|
|
await ctx.sessionPersistence.append(header.id, oneTurnLog())
|
|
|
const path = logPath(root, header.cwd, header.id, 'zstd')
|
|
|
@@ -562,6 +563,7 @@ describe('JsonlSessionPersistence: default Zstandard encoding', () => {
|
|
|
expect(loaded.events.some(event => event.type === 'assistant/chunk' && event.seq === 8)).toBe(false)
|
|
|
expect(loaded.events[8]?.type).toBe('step/end')
|
|
|
expect(loaded.events[9]?.type).toBe('turn/end')
|
|
|
+ expect(warn).toHaveBeenCalledWith('session-persistence-jsonl: session "recover-torn" recovered from a torn tail; incomplete tail bytes were discarded')
|
|
|
|
|
|
const repaired = await readFile(path)
|
|
|
expect(repaired.subarray(0, committed.length)).toEqual(committed)
|