fix: preserve malformed snapshot fixtures

This commit is contained in:
Tianyi Cui
2026-07-14 12:35:25 +08:00
parent dc67def3f3
commit 287041e39e

View File

@@ -486,8 +486,10 @@ export function defineAcpSnapshotSuite(options: SnapshotSuiteOptions): void {
const entries = await readdir(dir, { withFileTypes: true })
await Promise.all(entries
.filter(entry => entry.isFile()
&& entry.name.startsWith('session.')
&& entry.name.endsWith('.jsonl')
// Only valid numbered children are record-owned stale output.
// Malformed session-like names stay for the inventory guard to
// reject instead of being silently deleted during mutation.
&& /^session\.[1-9]\d*\.jsonl$/.test(entry.name)
&& !outputNames.has(entry.name))
.map(entry => rm(join(dir, entry.name))))
fixtureFiles = outputFixtureFiles