# Regression fixtures for the 17 pre-Phase-2 working flows

These are normalised JSON dumps of `flow.Metadata` for the ActiveVersion
of each of the 17 record-triggered AutoLaunchedFlows targeted by
`flow_regression_test.go` (build tag `regression`).

**Two transformations are applied at dump time:**
1. JSON keys are sorted alphabetically (stable diffs).
2. `apiVersion` is coerced from a JSON number to its string form, because
   `models.FlowMetadata.ApiVersion` is string-typed on main (the merged
   branch relaxes it to `interface{}` via commit d9bd7e57 on
   `test/flow-integration`). Without this coercion, baseline snapshot
   generation fails with "cannot unmarshal number into string".

Everything else is byte-for-byte what the DB returned.

## Regenerate

```bash
TIDB_TEST_HOST=gateway01.us-east-1.prod.aws.tidbcloud.com \
TIDB_TEST_USER=4Qbn3F3nyaU9DLk.root \
TIDB_TEST_PASSWORD=... \
TIDB_TEST_DATABASE=nexuscrm \
TIDB_TEST_PORT=4000 \
./scripts/dump-flow-regression-fixtures/run.sh
```

After dumping, regenerate snapshots on the baseline (main) branch:

```bash
REGRESSION_UPDATE=1 go test -tags=regression \
  -run TestFlowRegression ./internal/features/automation/...
```

## One-time fixup

`apiVersion` in the raw flow metadata is a JSON number, but
`models.FlowMetadata.ApiVersion` is string-typed on main (relaxed to
`interface{}` on the merged branch by commit d9bd7e57). The dump script
coerces numeric apiVersion to its string form so fixtures parse on both
branches.
