fix(snapshot): harden message id retention

This commit is contained in:
Tianyi Cui
2026-08-08 02:15:44 +08:00
parent fa31f27865
commit 8982d714cb
12 changed files with 283 additions and 131 deletions

View File

@@ -350,15 +350,18 @@ describe('TypeScript SDK snapshots over the jsonrpc runtime', () => {
content: log.content,
}))
const replacements = refreshFixtureReplacements(harvested, expectedContents)
expectedContents = await Promise.all(ordered.map(async (log, index) => {
const refreshed = ordered.map((log, index) => {
const existing = expectedContents[index]
const file = files[index]
if (existing === undefined || file === undefined) throw new Error(`no fixture for persisted log ${index}`)
const stable = scrubRequestHeaders(tokenizeSessionFixtureCwd(
if (existing === undefined) throw new Error(`no fixture for persisted log ${index}`)
return scrubRequestHeaders(tokenizeSessionFixtureCwd(
stabilizeRefreshLog(log.content, existing, replacements, actualContext),
))
})
expectedContents = stabilizeFixtureMessageIds(refreshed, expectedContents)
await Promise.all(expectedContents.map(async (stable, index) => {
const file = files[index]
if (file === undefined) throw new Error(`no fixture for persisted log ${index}`)
await writeFile(file, stable)
return stable
}))
}