Preserve snapshot refresh seed boundaries

This commit is contained in:
Tianyi Cui
2026-07-10 01:04:06 +08:00
parent 5f7177a0a9
commit af242dbae5
2 changed files with 2 additions and 2 deletions

View File

@@ -245,7 +245,7 @@ export function refreshFixtureReplacements(logs: HarvestedLog[], fixtures: strin
function preserveFixtureVolatiles(record: Record<string, unknown>, existing: Record<string, unknown> | undefined): void {
if (existing === undefined || existing.type !== record.type) return
if (record.type === 'session') {
for (const field of ['id', 'createdAt', 'cwd', 'parentSession', 'seedLength'] as const) {
for (const field of ['id', 'createdAt', 'cwd', 'parentSession'] as const) {
if (field in record && field in existing) record[field] = existing[field]
}
return

View File

@@ -271,7 +271,7 @@ describe('stabilizeRefreshLog', () => {
{ from: 'new-child', to: 'old-child' },
{ from: '/new', to: '/old' },
])).toBe([
'{"type":"session","id":"old-child","createdAt":100,"cwd":"/old","parentSession":"old-parent","seedLength":5}',
'{"type":"session","id":"old-child","createdAt":100,"cwd":"/old","parentSession":"old-parent","seedLength":1}',
'{"type":"hook/result","seq":1,"time":11,"data":{"decision":"block","durationMs":99}}',
'{"type":"turn/end","seq":2,"time":33,"data":{"error":"fresh error"}}',
'{"type":"tool/result","seq":3,"time":44,"data":{"text":"old-parent in /old"}}',