Align in_flight_scripts_json to the array shape it actually carries
Summary
- The deployment checkpoint's
in_flight_scripts_jsoncolumn was seeded/defaulted/documented as the legacy object form"{}", butInFlightScriptMapserializes aList<Entry>— a JSON array[{ "m": machineId, "s": stepId, "a": actionId, "t": scriptTicket }].Parse("{}")throws (caught → treated as empty), so"{}"only ever worked via that catch fallback, and a fresh checkpoint's"{}"leaked pastIsMachineBusyAsync's!= "[]"pre-filter. - Align the empty form to
"[]"across all four sources of truth: entity default (+ doc-comment), EF column default,EnsureExistsAsyncseed, and a DbUp migration.
Changes
-
DeploymentExecutionCheckpoint.cs— default"[]"+ doc-comment now describes the array shape. -
DeploymentExecutionCheckpointConfiguration.cs—HasDefaultValue("[]"). -
DeploymentCheckpointService.EnsureExistsAsync— seed"[]". -
20260615_align_inflight_scripts_default_to_array.sql—ALTER COLUMN ... SET DEFAULT '[]'::jsonb+ rewrite existing empty'{}'rows to'[]'(empty object ≡ empty array — pure shape normalization).
Non-breaking
-
InFlightScriptMap.Parsestill tolerates any leftover legacy shape (left untouched) — existing data unaffected. - EF always supplies an explicit value on insert, so the DB default is belt-and-braces.
- No new
MachineUpgradeStatusenum value; no change to the upgrade-defer logic. Purely a data-shape alignment.
Test plan
-
Integration (real Postgres, InFlightScriptStoreTests): newEnsureExists_SeedsInFlightScriptsJson_AsEmptyArraypins the seed is"[]"(discriminating vs the prior"{}"); existing suite (16) green incl. the seeded-checkpoint busy-check. -
Unit ( InFlightScriptMapTests, 23): legacy"{}"/ malformed /"[]"all → empty via the retainedParsecatch — confirms tolerance of pre-migration rows. -
Build green; DbUp migration applies cleanly (the integration DB is freshly migrated).