# Session 0004: Adjacent Env Restriction & Lifecycle Operations **Date:** 2026-02-22 **Status:** Completed **Origin:** MDF Webseiten session 0034 --- ## Work Done ### Adjacent Environment Restriction - [x] Removed direct prod↔dev sync/promote paths from UI and API - [x] Only adjacent pairs allowed: dev↔int, int↔prod - [x] Backend returns HTTP 400 for invalid environment pairs ### Container Lifecycle Operations (Rebuild/Recreate) - [x] Implemented three lifecycle operations (discovered Coolify API caused duplicate containers): - **Restart** — `docker restart` via SSH (safe, no image changes) - **Rebuild** — stop → build image → start (keeps data volumes) - **Recreate** — stop → wipe data → build image → start (full disaster recovery) - [x] Color-coded UI: green (restart), yellow (rebuild), red (recreate) - [x] Type-to-confirm dialog for destructive Recreate operation - [x] Fixed EventSource auto-reconnect causing duplicate banners across operations - [x] Fixed "already stopped" graceful handling, NameError crash, container filter OR vs AND ## Key Decisions / Learnings - Direct prod↔dev skips review in intermediate env (int) — adjacent-only enforced at API level, not just UI - Coolify stop prunes local Docker images — cannot use Coolify API to stop services with locally-built images - EventSource auto-reconnect must be explicitly closed after operation complete to prevent duplicate banners - Type-to-confirm for Recreate is appropriate UX — wipes data volumes, no undo --- **Tags:** #Session #OpsDashboard #Lifecycle