Skip to content

[249] Converge the demo mission to its committed config at boot - #258

Merged
CarsonDavis merged 6 commits into
developmentfrom
feature/249-demo-mission-overwrite
Aug 5, 2026
Merged

[249] Converge the demo mission to its committed config at boot#258
CarsonDavis merged 6 commits into
developmentfrom
feature/249-demo-mission-overwrite

Conversation

@CarsonDavis

Copy link
Copy Markdown
Collaborator

Closes #249

Boot-time convergence of the demo mission to its committed blueprint (mission-profiles/generated/full-demo-mission.json), run from scripts/init-db.js.

Opt-in via OVERWRITE_DEMO_MISSION=true (documented in sample.env). Dormant until the dev rebuild sets that flag — code and tests land now; with the flag unset (every existing deployment), boot behavior is unchanged.

Semantics (scripts/demo-mission-converge.js):

  • Missing mission → created at version 0; identical → left alone; differing → exactly one new version appended, so prior versions stay in history. No other mission is touched.
  • Comparison is structural (Postgres JSON round-trips don't preserve key order), with the Mapbox token placeholder resolved from the environment.
  • A fixed advisory lock ensures only one booting server copy runs the check; every write — including the append-path create — is pinned to a single transaction.
  • Boot-safe: never throws; any failure is swallowed after one structured error log line.

Unit spec covers the create / skip / append paths and asserts the transaction pinning.

- Assert the advisory-lock query, findOne and create all share one
  transaction object, and that the lock SQL uses the xact-scoped variant
  with the fixed key
- Test resolveBlueprint directly, including replacement-pattern-immune
  token substitution
- Document OVERWRITE_DEMO_MISSION in sample.env
- Note why API/utils.js isEqual is unusable for the config diff
@CarsonDavis CarsonDavis linked an issue Aug 3, 2026 that may be closed by this pull request
@CarsonDavis
CarsonDavis marked this pull request as ready for review August 5, 2026 19:46
@CarsonDavis
CarsonDavis merged commit 748309f into development Aug 5, 2026
4 checks passed
@CarsonDavis
CarsonDavis deleted the feature/249-demo-mission-overwrite branch August 5, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Converge the demo mission to its committed config at boot (dev only)

2 participants