Commit 0d60956
fix: use atomic writes in
`FileExporter.export()` used `fs.writeFile` directly, while the snapshot mechanism
used atomic writes (tmp + rename). When concurrent sessions wrote to the same trace
file, a snapshot rename could race with a non-atomic writeFile, producing truncated
JSON ("Unterminated string" parse error).
Also adds temp file cleanup on failure, matching the existing `snapshot()` pattern.
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>FileExporter.export() to prevent corrupted trace files (#646)1 parent 448a8cb commit 0d60956
1 file changed
+7
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
179 | 180 | | |
180 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
181 | 186 | | |
182 | 187 | | |
183 | 188 | | |
184 | 189 | | |
185 | 190 | | |
186 | 191 | | |
187 | 192 | | |
| 193 | + | |
188 | 194 | | |
189 | 195 | | |
190 | 196 | | |
| |||
0 commit comments