fix(session-persistence): invalidate stale preparations

This commit is contained in:
imccyu
2026-08-06 03:45:22 +08:00
parent 5e317371e5
commit ede74b1926
25 changed files with 353 additions and 101 deletions
@@ -255,6 +255,17 @@ describe('SessionPersistenceJsonl: durability and crash semantics', () => {
await otherCtx.fiber.dispose()
})
it('binds a full stored prefix to the same revision as a lightweight read', async () => {
const m = meta('stored-prefix-revision')
await ctx.sessionPersistence.create(m)
await ctx.sessionPersistence.append(m.id, oneTurnLog())
const persistence = ctx.sessionPersistence as SessionPersistenceJsonl
const stored = await persistence.loadStored(m.id)
expect(stored?.revision).toBe(await persistence.readStoredRevision(m.id))
expect(await persistence.readStoredRevision(SessionId('missing-revision'))).toBeUndefined()
})
it('omits a snapshot artifact removed after discovery', async () => {
const m = meta('vanishing-snapshot')
await ctx.sessionPersistence.create(m)