@@ -3702,45 +3702,60 @@ sudo eos update hecate --migrate-to-vault # Migrates existing .env to Vault
37023702
37033703---
37043704
3705- ### Phase C: Option C - Precipitate Pattern (Runtime → Disk Sync) 📅 DEFERRED (2026-01 → 2026-02)
3706-
3707- **Goal**: Automatically sync live Caddy API state and Docker runtime back to disk files
3708-
3709- **Status**: ⚠️ DEFERRED - Blocked by technical challenges (see below)
3710-
3711- **Rationale for Deferral**:
3712- 1. **Caddy JSON → Caddyfile conversion is lossy/impossible** (Issue #11 from Option B analysis)
3713- - Caddy Admin API returns JSON format
3714- - No official JSON → Caddyfile converter exists
3715- - Manual conversion loses comments, formatting, and some directives
3716- - Would require building custom AST parser (100+ hours effort)
3717-
3718- 2. **Comment preservation is non-trivial**
3719- - User's working Caddyfile has inline comments explaining config
3720- - JSON format doesn't preserve comments
3721- - Precipitating would destroy all documentation
3722-
3723- 3. **Secret handling complexity**
3724- - Environment variables in docker-compose.yml may contain secrets
3725- - Precipitating runtime values could expose secrets in version control
3726- - Need secret detection + Vault integration first
3727-
3728- 4. **Option B (drift detection) solves 80% of the problem**
3729- - Users get actionable drift reports with remediation commands
3730- - Manual fixes are well-documented and low-risk
3731- - Automatic precipitation adds complexity without proportional value
3732-
3733- **Alternative Approach** (if demand emerges):
3734- - **Manual Sync Workflow**: User reviews `21_DRIFT_REPORT.md` → manually applies changes
3735- - **Assisted Sync**: `eos update hecate --suggest-fixes` generates bash script with recommended changes (user reviews before executing)
3736- - **Partial Precipitation**: Sync ONLY routes (not env vars) using Caddy Admin API → Caddyfile template regeneration
3737-
3738- **Revisit Criteria**:
3739- - User feedback: 5+ requests for automatic precipitation
3740- - Caddy upstream: Official JSON → Caddyfile converter released
3741- - Secret manager: Phase 4-6 complete (Vault integration mature)
3742-
3743- **Revisit Date**: January 15, 2026 (after Phase B.2 complete, gather user feedback)
3705+ ### Phase C: Option C - Precipitate Pattern (Runtime State Documentation) ✅ CLARIFIED (2025-10-31)
3706+
3707+ **Goal**: Document live Caddy API state and Docker runtime in declarative format for observability
3708+
3709+ **Status**: ✅ PATTERN CLARIFIED - Pure observability tool, no disk writes
3710+
3711+ **What --precipitate Does** (CORRECTED UNDERSTANDING):
3712+ 1. **Query runtime state**:
3713+ - Caddy Admin API: `GET http://localhost:2019/config` (JSON)
3714+ - Docker API: `docker inspect hecate-*` containers
3715+ 2. **Convert to declarative format**:
3716+ - Caddy JSON → Caddyfile format representation
3717+ - Docker inspect → docker-compose.yml format representation
3718+ 3. **DISPLAY output to terminal** (does NOT write to disk)
3719+ 4. **User manually copies** if they want to persist the runtime state
3720+
3721+ **Use Cases**:
3722+ - **Documentation**: Capture "what's actually running" for disaster recovery planning
3723+ - **Comparison**: Compare runtime state against git-tracked disk files
3724+ - **Drift understanding**: Visualize the delta between disk templates and live state
3725+ - **Troubleshooting**: See actual running config when debugging issues
3726+
3727+ **NOT Use Cases** (Anti-patterns):
3728+ - ❌ Automatic synchronization (precipitate is display-only)
3729+ - ❌ Writing files to disk (user must manually copy if desired)
3730+ - ❌ Configuration management (use drift detection + manual fixes instead)
3731+ - ❌ Backup/restore workflow (use proper backup tools)
3732+
3733+ **Why Pure Observability**:
3734+ 1. **Comment preservation**: Never overwrites Caddyfiles with inline documentation
3735+ 2. **Secret safety**: No risk of writing secrets to version control
3736+ 3. **User control**: Explicit consent required for any disk changes
3737+ 4. **No conversion challenges**: Display format can be approximate/lossy (not authoritative)
3738+
3739+ **Implementation Status**:
3740+ - ✅ Pattern documented in [pkg/hecate/authentik/export.go:870-890](pkg/hecate/authentik/export.go#L870-L890)
3741+ - ✅ Pattern documented in [pkg/hecate/authentik/drift.go:501-507, 661-668](pkg/hecate/authentik/drift.go#L501-L507)
3742+ - ⏳ Drift detection (Phase B) provides recommendations to use `--precipitate`
3743+ - ⏳ CLI flag `--precipitate` implementation (pending)
3744+
3745+ **Comparison with Drift Detection (Phase B)**:
3746+
3747+ | Feature | Drift Detection (Phase B) | Precipitate (Phase C) |
3748+ |---------|---------------------------|------------------------|
3749+ | **Purpose** | Identify differences | Document runtime state |
3750+ | **Output** | Drift report with remediation | Declarative config (display only) |
3751+ | **Actionable?** | Yes (commands to fix) | No (informational only) |
3752+ | **Writes files?** | Yes (drift report) | No (display only) |
3753+ | **Use case** | Ongoing monitoring | Ad-hoc documentation |
3754+
3755+ **Implementation Priority**: LOW (2026-02+)
3756+ - Drift detection (Phase B) solves operational monitoring
3757+ - Precipitate adds documentation value but not critical path
3758+ - Wait for user feedback after Phase B deployment
37443759
37453760---
37463761
0 commit comments