fix(02-03): expand expected placeholders after replay capture

Unquoted numeric id placeholders made recorded JSON illegal to parse.
Replay now recaptures, persists vars, expands the expected body, and
diffs against the live response.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jakub Zych
2026-09-17 12:51:24 +02:00
parent 1ea3c59055
commit 591a0d4681
3 changed files with 79 additions and 1 deletions

View File

@@ -59,7 +59,18 @@ func ReplayFlow(ctx context.Context, flow Flow, cfg ReplayConfig) (Result, error
skipRest = true
continue
}
_ = ScrubStep(store, &live)
if err := store.Save(); err != nil {
return result, fmt.Errorf("tide: replay step %s: %w", step.ID, err)
}
want.Response, err = expandResponse(want.Response, store)
if err != nil {
sr.OK = false
result.OK = false
sr.Diffs = append(sr.Diffs, Diff{Path: "expected", Expected: "resolved placeholders", Actual: err.Error()})
result.Steps = append(result.Steps, sr)
skipRest = true
continue
}
sr.Diffs = append(sr.Diffs, compareStep(want, live.Response)...)
if len(sr.Diffs) > 0 {
sr.OK = false