feat(session): persist optional time zones

This commit is contained in:
pku-xht
2026-08-06 05:06:57 +08:00
committed by Tianyi Cui
parent d61059364e
commit a667ec55d6
25 changed files with 516 additions and 70 deletions
@@ -786,6 +786,15 @@ describe('SessionPersistenceJsonl: scanLog unit', () => {
expect(() => scanLog(Buffer.from(log))).toThrow(/session header/)
})
it('round-trips an optional timeZone and rejects a non-string stored value', () => {
const zoned = meta('zoned-header', '/work', 'Asia/Shanghai')
const scanned = scanLog(Buffer.from(`${JSON.stringify(toHeaderLine(zoned))}\n`))
expect(scanned.meta).toEqual({ ...zoned, delegationDepth: 0 })
const invalid = { ...toHeaderLine(zoned), timeZone: 8 }
expect(() => scanLog(Buffer.from(`${JSON.stringify(invalid)}\n`))).toThrow(/session header/)
})
it.each([
['missing', undefined],
['a string', '1'],