fix(migrations): parseMigrationStatus accepts fresh-database output without explicit Dirty line#545
Conversation
…ne in atlas driver Agent-Logs-Url: https://github.com/GoCodeAlone/workflow/sessions/53efbe3a-acca-4b90-b019-e60fb1112c6a Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes wfctl migrations validate baseline-candidate validation for fresh databases when the atlas migration driver outputs No migrations applied. without an explicit Dirty: line, by inferring dirty=false for that sentinel state so the status output is no longer treated as incomplete.
Changes:
- Update
parseMigrationStatusto treatNo migrations applied.as implicitly clean (dirtySeen=true,Dirty=false) when noDirty:line is present. - Add unit tests covering text and JSON fresh-database status parsing (including
pending: []andpending: null). - Add an integration-style test covering the baseline-candidate validation flow with atlas-style fresh-database status output.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cmd/wfctl/migrations_baseline.go | Infers dirty=false for the No migrations applied. sentinel to avoid rejecting fresh-database status output that omits Dirty:. |
| cmd/wfctl/migrations_baseline_test.go | Adds unit + integration coverage to ensure fresh-database status parsing/validation succeeds with and without an explicit Dirty: line. |
Agent-Logs-Url: https://github.com/GoCodeAlone/workflow/sessions/4aba00f5-c1a5-42d7-bb58-7af52a167cf2 Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
The CI failure was caused by 33 pre-existing lint issues from the golangci-lint v2.12.1 upgrade (tracked in issue #516). Fixed in commit
|
⏱ Benchmark Results✅ No significant performance regressions detected. benchstat comparison (baseline → PR)
|
The atlas driver (via
workflow-migrate) omits the"Dirty:"line when outputting"No migrations applied."for a fresh database.parseMigrationStatusrequired an explicitdirtySeenflag, causing it to reject valid fresh-database status as"incomplete migration status output"— failing baseline-candidate validation even after the atlas executor panic (the primary CI blocker) was fixed in the binary.Changes
cmd/wfctl/migrations_baseline.go—parseMigrationStatus: when"No migrations applied."is seen, implicitly setdirtySeen = truewithdirty = false. A fresh database cannot be dirty (no migration has been attempted), so the inference is always safe. An explicit subsequent"Dirty: true"line can still override it.cmd/wfctl/migrations_baseline_test.go— adds:TestParseMigrationStatusFreshDatabaseNoMigrationsApplied: unit tests for text-format (with/without explicitDirty:line) and JSON (pending: [],pending: null)TestRunMigrationsValidateAtlasFreshDatabaseStatusWithoutDirtyLine: integration test for the full baseline-candidate validation flow returning atlas-style fresh-database status