homelab-codex-ws/services/control-plane
Oskar Kapala 5e97b4e448 fix(supervisor): atomic writes + skip cycle on unreadable world state
Two independent fixes for the false-alarm storm caused by race-condition
reads of truncated world state files:

1. Atomic writes: _atomic_write_json (write→fsync→os.replace) replaces
   all bare open('w')+json.dump calls in supervisor and executor, so the
   action-file pipeline is never visible in a half-written state.

2. Resilient loader: _load_actual_state now returns False when any world
   state file fails to parse (empty or truncated mid-write). reconcile()
   skips the entire drift check on False instead of treating {} as "all
   services missing". actual_state retains its last-known-good values so
   a single bad cycle does not wipe accumulated context.

   Before: parse error → raw[key]={} → all desired services missing →
     wall of redeploy actions → drift_resolved_auto churn on next cycle.
   After:  parse error → WARNING logged → cycle skipped → no actions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03 12:26:59 +02:00
..
src fix(supervisor): atomic writes + skip cycle on unreadable world state 2026-06-03 12:26:59 +02:00
tests feat(control-plane): shadow_mode for HA event auto-actions + deploy docs 2026-05-29 17:12:33 +02:00
deploy-local.sh deploy: chmod/chown na /opt/homelab odporne na znikające pliki eventow 2026-06-01 14:35:19 +02:00
docker-compose.yml Add control plane deploy script and fix UI healthcheck 2026-05-18 21:34:57 +02:00
Dockerfile Add heartbeat updates and improve health checks in control-plane components 2026-05-12 20:59:46 +02:00
pyproject.toml feat(control-plane): route ha-diag-agent events through supervisor 2026-05-29 15:59:23 +02:00