Compare commits

..
2 Commits
Author SHA1 Message Date
kiskaadee 74ce2af1ce journal: record daily log for 2026-09-27
Brain Structural Validation / Validate Markdown Structure & Links (push) Successful in 7s
2026-09-27 11:07:42 -05:00
kiskaadee 8928e522d7 plan(homelab): synchronize appctl cross-track seams and p3 convergence in roadmap v3 2026-09-27 11:07:19 -05:00
4 changed files with 295 additions and 17 deletions

No files matched your search

@@ -128,12 +128,50 @@ This plan modernizes the engine from a procedural ~900-line script with a hand-r
- [ ] Run full automated test suite: `pytest tests/` (100% Green). - [ ] Run full automated test suite: `pytest tests/` (100% Green).
- [ ] Run code linter: `ruff check .` with zero errors. - [ ] Run code linter: `ruff check .` with zero errors.
- [ ] Run type checker: `pyright` with zero errors. - [ ] Run type checker: `pyright` with zero errors.
- [ ] Replace `scripts/appctl_engine.py` with `scripts/appctl_engine_v2.py`. - [ ] **Topology Synchronization (Roadmap v3 P1 alignment)**:
- [ ] Run `./scripts/test` and live verification (`appctl list`, `appctl info`, `appctl sync`). - Update `scripts/appctl_engine_v2.py` `get_core_services()`:
* `stalwart`: domain `smtp.${HOMELAB_DOMAIN}`.
* Remove `snappymail` (discovered dynamically in `~/Sites/snappymail`).
* Remove deprecated `portainer`.
- [ ] **Manifest Engine Convergence (Roadmap v3 P3 alignment)**:
- In `~/Projects/active/appctl-refactor`, cherry-pick the atomic commit from `main` that introduces `Core/scripts/core_manifest.py`.
- Refactor `appctl_engine_v2.py` to ingest manifests via `core_manifest.py` in place of standalone `load_manifest()`.
- Update unit test fixtures in `tests/unit/test_appctl_engine_v2.py` to validate against schema v1.0 models.
- [ ] Promote `scripts/appctl_engine_v2.py` to `scripts/appctl_engine.py` within `refactor/appctl-rework`.
- [ ] Merge `refactor/appctl-rework` into `main`.
- [ ] Run `./scripts/test` and live verification (`appctl list`, `appctl info`, `appctl sync`) on `main`.
- [ ] Update `docs/appctl.md` with V2 architecture and developer documentation. - [ ] Update `docs/appctl.md` with V2 architecture and developer documentation.
--- ---
## 4.5 Cross-Track Coordination with Architecture Roadmap v3
The `appctl-v2` refactor operates as **Track B** (modernizing implementation in worktree `~/Projects/active/appctl-refactor` on branch `refactor/appctl-rework`), running parallel to the **Homelab Architecture Consolidation Roadmap v3** (**Track A** on `main`).
```text
Track B: appctl-v2 (refactor/appctl-rework)
│ (internal modernizations: dataclasses, PyYAML, TDD)
│
│ integration seam (cherry-pick core_manifest.py commit from main)
▼
Track A: Homelab Architecture (main)
├── P1: Mail topology (minimal compatibility patch to legacy engine on main)
├── P2: GitOps authority (independent of appctl)
└── P3: Manifest convergence (DELIBERATE JOIN POINT where Track B merges to main)
```
### Branch Operating Rules
1. **Isolated Development**: `refactor/appctl-rework` is NOT rebased or merged into `main` during P1 or P2. Frequent cross-merging between active branches is strictly avoided.
2. **Minimal Legacy Patching**: P1 modifies legacy `appctl_engine.py` on `main` strictly to update the `stalwart` domain and remove `snappymail`. Track B applies the identical semantic change directly to its typed `CoreService` definitions without merging git branches.
3. **P3 Controlled Convergence Direction**:
- `core_manifest.py` originates on `main` (tested with GitOps and existing platform tests).
- Track B brings that specific commit into `refactor/appctl-rework` via `git cherry-pick`.
- `appctl-v2` adapts its normalization seam to `core_manifest.py` and confirms all unit tests pass in its worktree.
- On `refactor/appctl-rework`, `scripts/appctl_engine_v2.py` is promoted to `scripts/appctl_engine.py`.
- The tested, compliant `refactor/appctl-rework` branch is then merged into `main`.
---
## 5. Invariants & Acceptance Criteria ## 5. Invariants & Acceptance Criteria
1. **Zero Breaking Changes to Bash Contract**: 1. **Zero Breaking Changes to Bash Contract**:
@@ -142,3 +180,11 @@ This plan modernizes the engine from a procedural ~900-line script with a hand-r
Unit tests in `tests/unit/test_appctl_engine_v2.py` must run hermetically without requiring a live Docker daemon, live network access, or mutating the user's real `~/Sites` or `~/Core`. Unit tests in `tests/unit/test_appctl_engine_v2.py` must run hermetically without requiring a live Docker daemon, live network access, or mutating the user's real `~/Sites` or `~/Core`.
3. **The Unlicense Integrity**: 3. **The Unlicense Integrity**:
All new files and refactored code preserve public domain status under The Unlicense. All new files and refactored code preserve public domain status under The Unlicense.
4. **Architectural Seams Preserved for Roadmap v3**:
`appctl_engine_v2.py` must preserve the 5 architectural seams until convergence at P3:
- **CLI Syntax**: Invocation syntax, subcommands, and flags unchanged.
- **`resolve` JSON Contract**: Emits exact keys required by `scripts/appctl`: required `name`, `dir_path`, `type` (`"app"` or `"core_service"`), `domain`, plus contextual `container` and `env`. Backed by an automated test fixture.
- **Canonical Identity**: Service identifiers remain stable within the systems that own them; Core services and Sites workloads use their canonical names consistently.
- **Core vs. Sites Taxonomy**: Platform capabilities in Core vs. independent workloads in Sites strictly maintained.
- **Homepage Sync Semantics**: `services.yaml` compilation matches existing schema.
@@ -37,8 +37,16 @@ tags:
## 2. Mandatory Working Rules ## 2. Mandatory Working Rules
### Rule 1 — One Architectural Workstream at a Time ### Rule 1 — One Production Transition at a Time (Parallel Refactoring Permitted)
Never combine mail infrastructure relocation, GitOps privilege modifications, and manifest schema refactors into single sweeping PRs. Keep each phase isolated on dedicated git branches (`feat/mail-topology-realignment`, `feat/gitops-authority-hardening`, etc.). Never combine mail infrastructure relocation, GitOps privilege modifications, and manifest schema refactors into single sweeping production changes. Keep each architectural phase isolated on dedicated git branches.
However, independent internal implementation refactors (specifically `appctl-v2` on branch `refactor/appctl-rework`) **may proceed concurrently in an isolated worktree**, provided they do not trigger production cutovers and strictly preserve the established architectural integration seams.
```text
Parallel development: YES (isolated feature / refactor branches)
Parallel production moves: NO (serialized host/service cutovers)
Parallel changes to same integration seam: ONLY when explicitly coordinated
```
### Rule 2 — Absolute Preservation of Application State ### Rule 2 — Absolute Preservation of Application State
State-bearing workloads must never be modified using destructive commands (`rm -rf`, `docker compose down -v`, or unverified moves). State directory migrations require an explicit pre-flight freeze, recursive archive with preserved timestamps/permissions, and parallel staging before live cutover. State-bearing workloads must never be modified using destructive commands (`rm -rf`, `docker compose down -v`, or unverified moves). State directory migrations require an explicit pre-flight freeze, recursive archive with preserved timestamps/permissions, and parallel staging before live cutover.
@@ -49,6 +57,37 @@ Never duplicate service definitions or trust boundaries across disparate files.
### Rule 4 — The User Controls Production Transitions ### Rule 4 — The User Controls Production Transitions
Per Homelab Agent Guidelines: The agent investigates, crafts local code changes, and verifies tests locally. The user reviews atomic commit proposals, merges to `main`, and runs production deployments (`nixos-rebuild switch`, container recreation). Per Homelab Agent Guidelines: The agent investigates, crafts local code changes, and verifies tests locally. The user reviews atomic commit proposals, merges to `main`, and runs production deployments (`nixos-rebuild switch`, container recreation).
### Rule 5 — Immutable Integration Seams Across Tracks
When multiple branches are active, the interfaces connecting them must not undergo uncoordinated drift. Specifically, the `appctl-v2` track must preserve the CLI invocation syntax, the `resolve` JSON contract, canonical service identifiers, and Homepage generation semantics until the deliberate convergence point at Milestone P3.
---
## 2.1 Concurrent Track Coordination: Homelab Architecture vs. appctl-v2
Two major engineering tracks are active concurrently:
- **Track A (Production Architecture)**: Based on `main` in `/home/kiskaadee/Homelab/Core`. Owns host configuration, service topology (P1 mail migration), GitOps privilege separation (P2), and platform readiness (P4).
- **Track B (Implementation Modernization)**: Based on `refactor/appctl-rework` (commit `5fc5ad8`) in `/home/kiskaadee/Projects/active/appctl-refactor`. Replaces legacy procedural code with a typed dataclass hierarchy (`SitesApp`, `CoreService`), PyYAML ingestion, and TDD unit tests.
### Operating Protocol Between Tracks
1. **Seam Isolation (Do Not Cross-Merge Branches Early)**:
Do not continuously merge `main` into `refactor/appctl-rework` or vice versa. The refactoring branch changes file structures drastically (`scripts/appctl_engine_v2.py`); frequent cross-merging will cause severe merge conflicts.
2. **Phase 1 Coordination (Mail Topology)**:
- **On `main`**: Apply the minimal required compatibility patch to legacy `scripts/appctl_engine.py`: change `stalwart` domain to `smtp.roadtotech.me`, remove `snappymail` from `get_core_services()`, and remove `snappymail` from Homepage metadata mapping.
- **On `refactor/appctl-rework`**: Update the typed `CoreService` list in `scripts/appctl_engine_v2.py` symmetrically (`stalwart` domain $\rightarrow$ `smtp.${HOMELAB_DOMAIN}`, remove `snappymail` and deprecated `portainer`). This requires zero branch merging.
3. **Phase 2 Coordination (GitOps Authority)**:
Phase 2 operates on `Core/nixos` systemd units and `Core/scripts/gitops_dispatcher.py`. It has zero dependencies on `appctl` and can execute without touching Track B.
4. **Phase 3 Convergence (The Controlled Integration Seam)**:
Phase 3 is the **deliberate join point**. To avoid branch confusion, `core_manifest.py` originates authoritatively on `main` (where it is validated against `gitops_dispatcher.py` and test suites). That atomic commit is then brought into `refactor/appctl-rework` via cherry-pick, `appctl-v2` adapts its manifest ingestion to the shared module and verifies its unit tests, and finally the fully integrated `refactor/appctl-rework` branch is merged into `main`.
### The 5 Architectural Invariants Protected by appctl-v2
1. **CLI Syntax**: `scripts/appctl` invocation arguments, flags, and exits remain identical.
2. **`resolve` JSON Contract**: `cmd_resolve` emits the exact JSON schema consumed by `scripts/appctl`: required keys `name` (str), `dir_path` (str), `type` (str: `"app"` or `"core_service"`), `domain` (str), plus contextual keys `container` (str) and `env` (dict). Backed by an automated test fixture in `test_appctl_engine_v2.py`.
3. **Canonical Identity**: Service identifiers remain stable within the systems that own them; Core services and Sites workloads use their canonical names consistently.
4. **Core vs. Sites Taxonomy**: Strict classification between platform capabilities in Core and independent workloads in Sites.
5. **Homepage Sync Semantics**: Compiles `Core/config/homepage/services.yaml` from Core inventory + discovered Sites manifests without schema drift.
--- ---
## 3. Phase 0: Architecture Re-Baseline & Structural Catalog ## 3. Phase 0: Architecture Re-Baseline & Structural Catalog
@@ -212,14 +251,25 @@ ssh server-local "ls -laR ~/Sites/snappymail/data | head -n 30"
2. Remove the `snappymail:` service definition from `Core/docker-compose.yml`. 2. Remove the `snappymail:` service definition from `Core/docker-compose.yml`.
#### Step 1.7: Update Core Platform Tooling (`appctl_engine.py`) #### Step 1.7: Update Core Platform Tooling (`appctl_engine.py`)
1. Remove `snappymail` from Core services list (`get_core_services()`) in `Core/scripts/appctl_engine.py`.
2. Update `stalwart` entry in `get_core_services()`: To prevent cross-branch merge conflicts, apply the service inventory update symmetrically across both branches without merging:
**Action on `main` (Legacy Engine)**:
1. In `Core/scripts/appctl_engine.py`, remove `"snappymail"` from `get_core_services()`.
2. Update the `"stalwart"` entry in `get_core_services()`:
```python ```python
{"name": "stalwart", "domain": "smtp.roadtotech.me", "container": "stalwart", "desc": "All-in-one Mail Server & JMAP/IMAP/SMTP"} {"name": "stalwart", "domain": "smtp.roadtotech.me", "container": "stalwart", "desc": "All-in-one Mail Server & JMAP/IMAP/SMTP"}
``` ```
3. Update Homepage metadata mapping so `stalwart` points to `smtp.roadtotech.me`. 3. Update Homepage metadata mapping so `stalwart` maps to `smtp.roadtotech.me`.
**Action on `refactor/appctl-rework` (V2 Engine in `~/Projects/active/appctl-refactor`)**:
1. In `scripts/appctl_engine_v2.py`, update `get_core_services()`:
- Change `stalwart` domain from `f"mail.{HOMELAB_DOMAIN}"` to `f"smtp.{HOMELAB_DOMAIN}"`.
- Remove the `snappymail` `CoreService` entry (SnappyMail will now be discovered dynamically as a `SitesApp` in `~/Sites/snappymail`).
- Remove the deprecated `portainer` `CoreService` entry.
2. Run `pytest tests/unit/test_appctl_engine_v2.py` to confirm test suite remains green.
3. Commit to `refactor/appctl-rework` locally. **Do not merge into `main`**.
**Note**: The [appctl refactor](appctl/appctl-engine-v2-refactoring.md) is not completed (commit 5fc5ad86562e44246c2b0bb940f8626ce3311a0f (HEAD -> refactor/appctl-rework, origin/refactor/appctl-rework)). This change can be implemented in the running appctl version, and should be pinned as a task for appctl-v2.
#### Step 1.8: Production Cutover & Verification #### Step 1.8: Production Cutover & Verification
Deploy the Core update: Deploy the Core update:
```bash ```bash
@@ -354,15 +404,16 @@ The GitOps executor processes workload-authored `docker-compose.yml` files. A wo
--- ---
## 6. Phase 3: Manifest Contract Convergence ## 6. Phase 3: Manifest Contract Convergence & appctl-v2 Integration
Phase 3 is the **deliberate convergence point** between Track A (Homelab Architecture) and Track B (appctl-v2 Refactoring). At this milestone, the separate manifest models and YAML parsers converge into a single authoritative module (`core_manifest.py`), and `appctl-v2` is merged into `main`.
This requires further verification to integrate with the appctl refactor plan.
### Deliverable 3.1: Unified Manifest Parser (`core_manifest.py`) ### Deliverable 3.1: Unified Manifest Parser (`core_manifest.py`)
Create a shared, strictly typed Python module (`Core/scripts/core_manifest.py`) implementing: Create a shared, strictly typed Python module (`Core/scripts/core_manifest.py`) implementing:
- Dataclass models (`WorkloadManifest`, `NetworkConfig`, `DeploymentConfig`, `HealthcheckConfig`). - Dataclass models (`WorkloadManifest`, `NetworkConfig`, `DeploymentConfig`, `HealthcheckConfig`).
- Strict schema enforcement: Rejection of unknown fields. - Strict schema enforcement: Rejection of unknown top-level fields.
- Schema version gating (`schemaVersion: "1.0"`). - Schema version gating (`schemaVersion: "1.0"`).
- Replaces duplicate `parse_yaml_simple()` across `appctl_engine.py` and `gitops_dispatcher.py`. - Replaces duplicate `parse_yaml_simple()` across `gitops_dispatcher.py` and old `appctl_engine.py`.
### Deliverable 3.2: Declarative Intent Transition ### Deliverable 3.2: Declarative Intent Transition
Deprecate procedural action vectors: Deprecate procedural action vectors:
@@ -375,6 +426,49 @@ NEW: deployment:
### Deliverable 3.3: Sites Manifest Migration ### Deliverable 3.3: Sites Manifest Migration
Update all manifests in `~/Sites/*/app.yaml` to schema v1.0. Update all manifests in `~/Sites/*/app.yaml` to schema v1.0.
### Deliverable 3.4: appctl-v2 Integration & Controlled Convergence
To ensure reproducibility and zero merge churn between divergent branches, the convergence of Track B into Track A follows a **strict direction of integration** with a defined origin for `core_manifest.py`.
#### The Origin & Direction Rule
- **Origin**: `core_manifest.py` originates authoritatively on `main` (under Deliverables 3.1–3.3) where it is immediately tested against `gitops_dispatcher.py` and the 35 architecture invariants.
- **Direction**: `main` $\rightarrow$ `refactor/appctl-rework` (cherry-pick contract commit) $\rightarrow$ adapt in worktree $\rightarrow$ `main` (merge refactored engine).
#### The 6-Step Controlled Convergence Runbook
1. **Lock Prerequisites on `main`**:
Ensure P1 (mail topology), P2 (GitOps authority & Compose security policy), and Deliverables 3.1–3.3 (`core_manifest.py` schema & Sites manifests) are committed and green on `main`.
2. **Isolate Contract Commit**:
Identify the atomic commit on `main` that introduces `Core/scripts/core_manifest.py` (e.g. `feat(core): introduce unified core_manifest parser`).
3. **Bring Contract into Worktree (`refactor/appctl-rework`)**:
In `/home/kiskaadee/Projects/active/appctl-refactor`, bring in the contract commit via cherry-pick:
```bash
cd ~/Projects/active/appctl-refactor
git cherry-pick <commit-sha-of-core_manifest>
```
*(Track B now has the identical, immutable manifest parser without absorbing unrelated P1/P2 host churn).*
4. **Adapt `appctl-v2` to Shared Parser**:
Refactor `scripts/appctl_engine_v2.py` to ingest manifests via `core_manifest.py` instead of its standalone `load_manifest()` seam. Update `tests/unit/test_appctl_engine_v2.py` fixtures to match.
5. **Hermetic Test Gate in Worktree**:
Verify 100% compliance within `~/Projects/active/appctl-refactor`:
```bash
pytest tests/unit/test_appctl_engine_v2.py
ruff check .
pyright
python3 scripts/appctl_engine_v2.py resolve snappymail
```
Ensure `cmd_resolve` emits the exact JSON schema consumed by `scripts/appctl`: required keys `name`, `dir_path`, `type`, `domain`, plus contextual keys `container` and `env`. Verify that this is guarded by an automated test fixture.
6. **Controlled Integration Merge to `main`**:
- On `refactor/appctl-rework`, promote `scripts/appctl_engine_v2.py` to `scripts/appctl_engine.py` so the branch carries the full engine replacement natively.
- Merge `refactor/appctl-rework` into `main` (resolving only expected integration conflicts).
- Run full regression suite on the resulting `main`:
```bash
cd ~/Homelab/Core
./scripts/test
nix flake check
```
- Verify live CLI behavior: `appctl list`, `appctl info snappymail`, `appctl sync`.
- Decommission the worktree and declare Milestone P3 complete.
--- ---
## 7. Phase 4: Platform Lifecycle & Readiness Contracts ## 7. Phase 4: Platform Lifecycle & Readiness Contracts
@@ -48,6 +48,7 @@ Roadmap v3 establishes a fresh architectural re-baseline, clarifies service taxo
4. **Single Manifest Contract**: There is exactly one schema and typed parser for workload manifests (`app.yaml`). `appctl`, `gitops_dispatcher`, and dashboard generators must consume the same verified contract. 4. **Single Manifest Contract**: There is exactly one schema and typed parser for workload manifests (`app.yaml`). `appctl`, `gitops_dispatcher`, and dashboard generators must consume the same verified contract.
5. **Deployment Truth**: The deployment engine must record true runtime facts: requested revision, actual checked-out revision, prior revision, execution duration, and failure stage. 5. **Deployment Truth**: The deployment engine must record true runtime facts: requested revision, actual checked-out revision, prior revision, execution duration, and failure stage.
6. **Zero-Data-Loss Migration**: State-bearing components are relocated across architectural boundaries through staged, reversible migrations with verified pre-flight snapshots, non-destructive file staging, and validated cutover windows. 6. **Zero-Data-Loss Migration**: State-bearing components are relocated across architectural boundaries through staged, reversible migrations with verified pre-flight snapshots, non-destructive file staging, and validated cutover windows.
7. **Concurrent Refactoring Tracks & Seam Isolation**: Internal engine refactors (such as the `appctl-v2` modernization on branch `refactor/appctl-rework`) proceed in parallel with architecture consolidation on `main`. Production transitions remain serialized. Architectural changes apply minimal compatibility patches to legacy code on `main`, while refactoring tracks preserve defined architectural seams until deliberate convergence at milestone P3.
--- ---
@@ -404,7 +405,79 @@ graph TD
--- ---
## Part 7: Roadmap Execution Phases ## Part 7: Parallel Track Coordination (Architecture vs. appctl-v2)
A major source of potential friction is the concurrent development of the **appctl-v2 modernization** (tracked on branch `refactor/appctl-rework` in worktree `~/Projects/active/appctl-refactor`) alongside the **Homelab Architecture Consolidation** (tracked on `main`).
These two tracks operate with fundamentally different concerns:
- **Track A (Production Architecture)**: Alters the host and service topology (mail migration P1, GitOps privilege P2, platform lifecycle P4). It mutates production state, requires human-controlled cutover, and runs from `main`.
- **Track B (Implementation Modernization)**: Replaces the internal engine implementation (`appctl_engine_v2.py` with typed domain objects, PyYAML, and TDD tests). It is an internal refactor that must preserve runtime contracts.
Treating `appctl-v2` as a prerequisite for early consolidation would unnecessarily block P1 and P2. Conversely, continuously cross-merging the architecture branch into the refactoring branch would create destructive merge conflicts in rapidly changing files.
### The Dependency & Convergence Graph
```text
┌─────────────────────────┐
│ appctl-v2 refactor │
│ (refactor/appctl-rework)│
│ independent workstream │
└────────────┬────────────┘
│
│ integration point
▼
┌─────────────────────────┐
│ Manifest / domain model │
│ + Core inventory model │
└─────────────────────────┘
main
│
├── P1: Mail topology migration
│ └── minimal compatibility change to current appctl
│
├── P2: GitOps authority hardening
│ └── does not require appctl-v2
│
└── P3: Manifest convergence
└── integrate appctl-v2 here (CONVERGENCE POINT)
```
### The Three Operating Rules
1. **Keep `appctl-v2` isolated**: Work proceeds in its dedicated worktree toward its own deliverables. It is not rebased or merged into `main` until its seams are stable.
2. **Keep architectural migrations rooted on `main`**: For P1 (mail migration), apply only the minimal required compatibility patch to legacy `scripts/appctl_engine.py` on `main`: change `stalwart` domain to `smtp.roadtotech.me` and remove `snappymail` from `get_core_services()`.
3. **Do not duplicate implementation work**: When `appctl-v2` converges at P3, apply the semantic change directly to its typed registry (`CoreService`) rather than attempting a mechanical code merge of legacy `appctl_engine.py`.
### The 5 Stable Integration Seams
`appctl-v2` must preserve these 5 architectural seams until convergence:
| Seam | Scope | Contract Guarantee |
| :--- | :--- | :--- |
| **1. CLI Syntax** | `scripts/appctl` | Bash caller flags, subcommands (`list`, `info`, `up`, `down`, `sync`), and exits remain identical. |
| **2. `resolve` JSON Contract** | Emitter $\rightarrow$ Caller | `cmd_resolve` emits the exact JSON schema consumed by `scripts/appctl`: required keys `name`, `dir_path`, `type` (`"app"` or `"core_service"`), `domain`, plus contextual keys `container` and `env`. Backed by an automated test fixture. |
| **3. Canonical Identity** | Service names | Service identifiers remain stable within the systems that own them; Core services and Sites workloads use their canonical names consistently. |
| **4. Core vs. Sites Taxonomy** | Classification | Core services represent platform capabilities; Sites represent independent workloads. No blurred boundaries. |
| **5. Homepage Sync Semantics** | Output generation | Compiles `Core/config/homepage/services.yaml` from Core inventory + discovered Sites manifests without schema break. |
### P3 Controlled Convergence Mechanics
To prevent merge churn and ambiguity over code ownership, Milestone P3 enforces a **strict direction of integration**:
- **Contract Origin on `main`**: `core_manifest.py` is developed and validated on `main` first (Deliverables 3.1–3.3), ensuring direct compatibility with `gitops_dispatcher.py` and existing test suites.
- **Direction of Integration**: `main` $\rightarrow$ `refactor/appctl-rework` $\rightarrow$ `main`.
- **The Convergence Sequence**:
1. Complete P2 and author `core_manifest.py` on `main`.
2. Cherry-pick the isolated `core_manifest.py` commit into `refactor/appctl-rework` (`~/Projects/active/appctl-refactor`).
3. Adapt `appctl_engine_v2.py` to ingest via `core_manifest.py`.
4. Run hermetic test verification in worktree (`pytest`, `ruff`, `pyright`, `cmd_resolve` contract check).
5. On `refactor/appctl-rework`, promote `scripts/appctl_engine_v2.py` to `scripts/appctl_engine.py` so the branch carries the full replacement.
6. Merge `refactor/appctl-rework` into `main`, resolve any expected integration conflicts, run full `./scripts/test` and `nix flake check` on `main`, verify live CLI behavior, and decommission the worktree.
---
## Part 8: Roadmap Execution Phases
```text ```text
┌─────────────────────────────────────────────────────────────┐ ┌─────────────────────────────────────────────────────────────┐
@@ -419,6 +492,7 @@ graph TD
│ - Stalwart to smtp.roadtotech.me │ │ - Stalwart to smtp.roadtotech.me │
│ - SnappyMail State Backup & Transfer to ~/Sites │ │ - SnappyMail State Backup & Transfer to ~/Sites │
│ - Workload Scaffolding & mail.roadtotech.me Cutover │ │ - Workload Scaffolding & mail.roadtotech.me Cutover │
│ - Minimal compatibility patch to legacy appctl_engine │
└──────────────────────────────┬──────────────────────────────┘ └──────────────────────────────┬──────────────────────────────┘
│ │
┌──────────────────────────────▼──────────────────────────────┐ ┌──────────────────────────────▼──────────────────────────────┐
@@ -431,10 +505,10 @@ graph TD
└──────────────────────────────┬──────────────────────────────┘ └──────────────────────────────┬──────────────────────────────┘
│ │
┌──────────────────────────────▼──────────────────────────────┐ ┌──────────────────────────────▼──────────────────────────────┐
│ P3: Manifest Contract Convergence │ │ P3: Manifest Contract Convergence & appctl-v2 Integration │
│ - Schema v1.0 & Single Typed Parser Engine │ │ - Schema v1.0 & Single Typed Parser Engine │
│ - Declarative Deployment Intent (strategy: compose) │ │ - Declarative Deployment Intent (strategy: compose) │
│ - Elimination of Procedural Action Strings │ │ - CONVERGENCE: appctl-v2 replaces legacy engine on main │
│ - Core Service Inventory Normalization │ │ - Core Service Inventory Normalization │
└──────────────────────────────┬──────────────────────────────┘ └──────────────────────────────┬──────────────────────────────┘
│ │
@@ -455,7 +529,7 @@ graph TD
--- ---
## Part 8: Definition of Done ## Part 9: Definition of Done
The Roadmap v3 architectural consolidation is complete when: The Roadmap v3 architectural consolidation is complete when:
@@ -469,9 +543,11 @@ The Roadmap v3 architectural consolidation is complete when:
- Workload manifests cannot expand admission trust boundaries or register arbitrary aliases. - Workload manifests cannot expand admission trust boundaries or register arbitrary aliases.
- Webhook admission decisions rely exclusively on Core's authoritative registry. - Webhook admission decisions rely exclusively on Core's authoritative registry.
- `homelab-gitops` runs under dedicated systemd sandboxing with restricted filesystem access. - `homelab-gitops` runs under dedicated systemd sandboxing with restricted filesystem access.
4. **Contract Unification**: 4. **Contract Unification & Engine Modernization**:
- Exactly one parser library validates `app.yaml` across `appctl`, GitOps, and test suites. - Exactly one parser library validates `app.yaml` across `appctl`, GitOps, and test suites.
- All workloads declare declarative deployment intent (`strategy: compose`). - All workloads declare declarative deployment intent (`strategy: compose`).
- `appctl-v2` is fully integrated on `main`, replacing legacy procedural code with zero regressions to the bash caller.
5. **Operational Verification**: 5. **Operational Verification**:
- All 35 existing architecture invariant tests pass, plus new tests enforcing Stalwart/SnappyMail separation and manifest schema invariants. - All 35 existing architecture invariant tests pass, plus new tests enforcing Stalwart/SnappyMail separation and manifest schema invariants.
- Pure Nix `flake check` and Gitea Actions CI pass with zero warnings. - Pure Nix `flake check` and Gitea Actions CI pass with zero warnings.
+62
View File
@@ -0,0 +1,62 @@
---
type: journal
project: homelab
date: 2026-09-27
tags:
- homelab
- architecture
- curation
- gitops
- appctl
- roadmap
---
# Daily Journal: 2026-09-27
## Wins
### Homelab Architecture Consolidation Roadmap v3 & Guide Promotion
- Formally curated and promoted **Homelab Architecture Consolidation & Hardening Roadmap v3** and **Implementation Guide v3** to the canonical knowledge graph:
- [`projects/homelab/plans/architecture-consolidation-roadmap-v3.md`](../../projects/homelab/plans/architecture-consolidation-roadmap-v3.md)
- [`projects/homelab/plans/architecture-consolidation-implementation-guide-v3.md`](../../projects/homelab/plans/architecture-consolidation-implementation-guide-v3.md)
- Re-baselined the platform architecture against commit `246b587` (NixOS appliance, Portainer deprecation, Stalwart mail & SMTPS submission, Dozzle forward-proxy auth, Diun jitter/workers, and 35 invariant tests).
- Codified the 5-tier service taxonomy: Host Foundation, Edge & Security Primitives, Core Platform Capabilities, Platform Operations, and Workloads (Sites).
- Codified the Controller Authority Matrix and Resource & State Ownership Matrix, resolving multi-controller ambiguities across systemd, Core Compose, GitOps, and `appctl`.
- Inverted the GitOps trust boundary: admissions are authoritatively driven by `Core/config/deployments.yaml` instead of workload manifests claiming aliases.
- Isolated Second Brain (`~/Brain`) as a strictly read-only data vault (`strategy: pull-only`), completely stripped of Docker socket access and container lifecycle capabilities.
- Added workload Compose policy validation to treat untrusted Compose files as a capability attack surface.
- Archived superseded Roadmap v2 and Implementation Guide v2 into [`projects/homelab/archive/`](../../projects/homelab/archive/) with updated backlinks in past journals (`2026-09-13`, `2026-09-14`) and project landing pages.
### Dual-Track Boundary Lock & P3 Convergence Runbook
- Synchronized cross-track coordination between **Track A** (Architecture on `main`) and **Track B** (`appctl-v2` in `~/Projects/active/appctl-refactor` on `refactor/appctl-rework`).
- Codified the 5 stable architectural seams protected by `appctl-v2` until convergence:
1. **CLI Syntax**: Caller flags, subcommands (`list`, `info`, `up`, `down`, `sync`), and exit codes remain identical.
2. **`resolve` JSON Contract**: `cmd_resolve` schema guarantee (`name`, `dir_path`, `type`, `domain`, `container`, `env`) verified via automated test fixtures.
3. **Canonical Identity**: Unified service identifiers across platforms.
4. **Core vs. Sites Taxonomy**: Platform capabilities strictly separated from workloads.
5. **Homepage Sync Semantics**: Unbroken `services.yaml` compilation from Core inventory + Sites manifests.
- Defined symmetrical P1 isolation rules: minimal legacy patch to `Core/scripts/appctl_engine.py` on `main` (Stalwart domain to `smtp.roadtotech.me`, remove `snappymail`), while Track B applies the identical semantic change directly to its typed `CoreService` model without branch cross-merging.
- Established the concrete 6-step P3 convergence sequence: `main` authors `core_manifest.py`, Track B cherry-picks the isolated contract commit, adapts `appctl_engine_v2.py`, runs hermetic test verification, promotes `appctl_engine_v2.py` to `appctl_engine.py`, and merges into `main` with full regression verification (`./scripts/test` and `nix flake check`).
### Architectural Planning Freeze & Transition to Implementation
- Formally declared an end to architectural revision cycles across Homelab Core documentation.
- The guides are now the authoritative source of truth. Implementation of Phase 1 (Mail Topology Realignment) is cleared to begin.
- Implementation-level issues encountered during rollout will be addressed directly in code unless an underlying architectural assumption in the frozen guides is proven invalid.
---
## Planning & Specifications
- [Architecture Consolidation & Hardening Roadmap v3](../../projects/homelab/plans/architecture-consolidation-roadmap-v3.md)
- Canonical 5-tier architecture, authority matrices, inverted GitOps registry, mail topology realignment, and platform readiness contracts.
- [Architecture Consolidation Implementation Guide v3](../../projects/homelab/plans/architecture-consolidation-implementation-guide-v3.md)
- Executable step-by-step phased runbooks, zero-data-loss SnappyMail migration gates, and P3 controlled convergence procedure.
- [appctl Engine V2 Refactoring Plan](../../projects/homelab/plans/appctl/appctl-engine-v2-refactoring.md)
- Modernization of `appctl` into a typed, test-driven engine, aligned with the 5 integration seams and P3 cherry-pick runbook.
---
## Architecture & Design Decisions
### Strict Direction of Integration (`main` $\rightarrow$ `refactor/appctl-rework` $\rightarrow$ `main`)
Treating `appctl-v2` as a hard prerequisite for Phase 1 and Phase 2 would stall necessary infrastructure realignments (mail domain migration, GitOps sandboxing). Conversely, continuous bidirectional merging between `main` and the refactor branch risks thrashing and merge conflicts in rapidly changing files. By adopting a strict one-way contract flow—authoring `core_manifest.py` on `main`, cherry-picking only the contract commit into the worktree, adapting and verifying hermetically, promoting the file, and then merging back to `main`—both tracks maintain complete velocity and clean boundaries until convergence at P3.