fix(02-03): re-record on --update and honor case capture rules

Ordered PHP self-replay needs regenerated share tokens captured into
vars, and --update must overwrite already-recorded route fixtures.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jakub Zych
2026-09-17 13:00:14 +02:00
parent 5b947c7454
commit 39ddf787ce
2 changed files with 70 additions and 1 deletions

View File

@@ -65,6 +65,7 @@ type RouteCase struct {
Headers map[string]string `yaml:"headers,omitempty"`
Fixture string `yaml:"fixture,omitempty"`
Request *Request `yaml:"request,omitempty"`
Capture []CaptureRule `yaml:"capture,omitempty"`
}
// ManifestConfig drives recording or replay of a manifest.
@@ -296,7 +297,7 @@ func RecordManifest(ctx context.Context, m Manifest, cfg ManifestConfig) (Covera
break
}
}
if allRecorded {
if allRecorded && !cfg.Update {
cov.markRecorded(route)
continue
}
@@ -396,6 +397,7 @@ func recordRoute(ctx context.Context, route Route, cfg ManifestConfig) error {
ID: c.ID,
RouteID: route.ID,
Request: caseRequest(route, c),
Capture: c.Capture,
Normalize: route.Normalize,
Headers: mergeHeaders(route.Headers, c.Headers),
}},