fix(session-persistence): invalidate stale preparations

This commit is contained in:
imccyu
2026-08-06 04:11:58 +08:00
parent 5e317371e5
commit ede74b1926
25 files changed
+353 -101

No files matched your search

@@ -576,6 +576,19 @@ describe('SessionPersistenceSqlite: durability and crash semantics', () => {
await b.dispose()
})
it('binds a full stored prefix to the same revision as a lightweight read', async () => {
const b = await backend()
const m = meta('stored-prefix-revision')
await b.ctx.sessionPersistence.create(m)
await b.ctx.sessionPersistence.append(m.id, oneTurnLog())
const persistence = b.ctx.sessionPersistence as SessionPersistenceSqlite
const stored = await persistence.loadStored(m.id)
expect(stored?.revision).toBe(await persistence.readStoredRevision(m.id))
expect(await persistence.readStoredRevision(SessionId('missing-revision'))).toBeUndefined()
await b.dispose()
})
it('changes revisions when a deleted session id is materialized again in the same database', async () => {
const path = await freshDbPath()
const m = meta('recreated-revision')