Skip to content

v0.5.0

Choose a tag to compare

@AusafMo AusafMo released this 28 Nov 18:39
· 72 commits to main since this release

cfgit 0.5.0

New

  • cfg add / cfg rm: create records and delete them with a tombstone kept in history; cfg restore <record> @<seq> brings a deleted record back (#45).
  • cfg promote --from dev --to prod: move a record, or every record with a tag, between envs through the target's own rules. Provenance is recorded and promote_ignore paths stay env-local (#47).
  • List edits in cfg set: orgs+=x / orgs-=x, race-safe (#49).
  • Per-collection validation: validate = { schema = ... } (JSON Schema, needs cfgit[validate]) or { python = "mod:fn" }. Runs on every write path; --no-validate is audited (#46).
  • History read contract: cfg log entries carry field-level changes; new --since; last_changed_at in status; Python API cfg.history() / cfg.heads() (docs/HISTORY_CONTRACT.md) (#48).
  • Notifications on writes ([env.<name>.notify], webhook / Slack, field paths only by default), and code references in cfg impact via code_refs; cfg rm refuses while code still reads the id (#50).

Fixed

  • Datetimes, decimals, ObjectIds, binary and UUIDs keep their type through bulk commit, cfg edit and export → import. A write that would silently turn one into a string is refused (--allow-type-change to override) (#51).
  • Secret scan: credential-looking names no longer block numeric, boolean, null or datetime values; strings and binary are still checked (#51).
  • Ignored fields are never changed by a write. Previously a full-document commit, bulk, import, restore, promote or merge could overwrite or delete fields matched by ignore_patterns / ignore_paths (Mongo), or any ignored field (Postgres), with nothing in the preview (#53).
  • Concurrent writes: cfg set, cfg edit and cfg promote refuse with stale_base instead of overwriting a write that landed in between. MCP cfg_commit accepts expected_live_oid for the same protection.

Upgrading from 0.4.x

No data migration: 0.5.0 reads everything 0.4.x wrote, and no command or flag was removed. These behaviour changes can surprise a script. Full guide: docs/UPGRADING.md.

  • Upgrade both packages together: pip install -U 'cfgit==0.5.0' 'cfgit-impact==0.5.0'. The 0.4.7 plugin pins cfgit<0.5.
  • Type changes are refused. A payload that would turn a live datetime, decimal, ObjectId, binary or UUID into a string (e.g. built with json.dumps(..., default=str)) gets TypeChangeBlocked. Send Extended JSON ({"$date": ...}), or use --allow-type-change if it's intended.
  • Old export files. 0.4.x exports (version: 1, dates as strings) are refused by the same rule when imported over real datetimes. Re-export with 0.5, convert the dates, or use --allow-type-change.
  • New export files. cfg export now writes version: 2 (Extended JSON). Don't import these with cfgit 0.4.x; it would store the {"$date": ...} wrappers literally.
  • Concurrent edits return stale_base (exit 2). set, edit and promote refuse instead of overwriting a write that landed in between. Rerun the same command. A refused cfg edit keeps your edit in a temp file.
  • Ignored fields are never written. If something relied on a commit setting an ignored field (e.g. updated_at on Postgres), that no longer happens.
  • Timestamps on Mongo in log / status / cfg.history now carry +00:00; previously they had no offset.
  • JSON output gains fields (changes, last_changed_at, new states and summary counters). Existing fields are unchanged.
  • Rare: don't downgrade to 0.4.x after using cfg rm (it doesn't understand tombstones). Custom storage adapters must honour ApplyItem.delete_live.

Verification

  • 279 tests, including live Mongo (replica set) and Postgres runs.
  • A concurrent-writer race suite: 0 failures in 20 rounds at 16 writers.
  • Two independent review passes, with all findings fixed.