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

View File

@@ -63,7 +63,9 @@ function inherited(session: Session): readonly SessionEvent[] {
describe('SessionStore.fork', () => {
it('forks an empty live session as an empty child with lineage metadata', async () => {
const { ctx, sessions } = await setup()
const source = ctx.sessions.create(SessionId('empty-parent'), { meta: { cwd: '/workspace' } })
const source = ctx.sessions.create(SessionId('empty-parent'), {
meta: { cwd: '/workspace', timeZone: 'Asia/Shanghai' },
})
const child = sessions.fork(source, undefined, SessionId('empty-child'))
@@ -71,11 +73,21 @@ describe('SessionStore.fork', () => {
expect(child.header).toMatchObject({
id: SessionId('empty-child'),
cwd: '/workspace',
timeZone: 'Asia/Shanghai',
parentSession: SessionId('empty-parent'),
seedLength: 0,
})
})
it('keeps a headerless fork headerless', async () => {
const { ctx, sessions } = await setup()
const source = ctx.sessions.create(SessionId('headerless-parent'), { meta: { cwd: '/workspace' } })
const child = sessions.fork(source, undefined, SessionId('headerless-child'))
expect(child.header.timeZone).toBeUndefined()
})
it('forks the latest completed boundary by default into detached frozen seed events', async () => {
const { ctx, sessions } = await setup()
const source = ctx.sessions.create(SessionId('parent'), { meta: { cwd: '/workspace' } })