fix(02): write fixtures exclusively and only on successful flush (WR-01)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -336,7 +336,10 @@ func recordSeed(ctx context.Context, seed *Seed, cfg ManifestConfig) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return SaveFlow(dest, flow)
|
||||
if _, err := os.Stat(dest); err == nil {
|
||||
return SaveFlow(dest, flow)
|
||||
}
|
||||
return SaveFlowExclusive(dest, flow)
|
||||
}
|
||||
|
||||
func seedAlreadyRecorded(path string) (bool, error) {
|
||||
@@ -404,7 +407,13 @@ func recordRoute(ctx context.Context, route Route, cfg ManifestConfig) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := SaveFlow(dest, flow); err != nil {
|
||||
if cfg.Update {
|
||||
if err := SaveFlow(dest, flow); err != nil {
|
||||
return err
|
||||
}
|
||||
continue
|
||||
}
|
||||
if err := SaveFlowExclusive(dest, flow); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user