fix(time-context): close request-boundary gaps

This commit is contained in:
pku-xht
2026-08-07 21:55:18 +08:00
committed by Tianyi Cui
parent d8a85dcafd
commit 331b29d779
9 changed files with 78 additions and 5 deletions

View File

@@ -102,6 +102,18 @@ describe('time-context invariants', () => {
}).not.toThrow()
})
it('rejects a reading appended after request execution starts', async () => {
const ctx = await setup()
const session = preparing(1, 1)
session.append('request/header', {
header: { config: { provider: 'mock', model: 'mock' } },
reason: 'initial',
})
expect(() => {
ctx.emit('session/event', session, event(reading()))
}).toThrow(/must precede request\/header/)
})
it('derives Session and client zones from their original durable owners', async () => {
const ctx = await setup()
const id = SessionId('time-invariant-zones')