Compare commits

..
10 Commits
Author SHA1 Message Date
kiskaadee bbbf58a27c docs(p4): approve and lock control plane readiness plan and boundary specifications
Core Architecture & Invariant CI / validate (push) Successful in 38s
2026-10-14 15:25:47 -05:00
kiskaadee a9ada28c65 fix(appctl): set app_type to core when resolving core stack query
Core Architecture & Invariant CI / validate (push) Successful in 38s
2026-10-14 14:16:53 -05:00
kiskaadee 6052019f2c fix(appctl): lock HOMELAB_DOMAIN at startup to prevent application
Core Architecture & Invariant CI / validate (push) Successful in 40s
domain leaks during sync
2026-10-14 13:41:17 -05:00
kiskaadee 298ae728e1 chore(tooling): enforce python >=3.13 requirement and align uv lockfile
- Declare project.requires-python = ">=3.13" in pyproject.toml
- Lock dependencies and virtual package in uv.lock
- Update datetime.timezone.utc usages to datetime.UTC across scripts
2026-10-14 13:41:17 -05:00
kiskaadee ecacb1cc39 docs(p4): formalize control plane readiness plan and boundary specifications
- Reconcile appctl implementation inventory and caller map
- Define canonical command and error contract with schema v1.0
- Close authorization design with strict token enforcement everywhere
- Specify daemon execution boundaries and fixed subprocess allowlist
- Formalize append-only audit telemetry schema and failure-handling semantics
- Establish P4 acceptance test matrix and definition of done
- Synchronize ROADMAP.md milestone table and todo.txt task tracking
2026-10-14 13:41:17 -05:00
kiskaadee f261b80477 chore(uv): bump python requirement to >=3.13 in uv.lock 2026-10-14 13:41:17 -05:00
kiskaadee 2c99e3e92e chore(flake): update nixpkgs and sops-nix inputs.
- bump nixpkgs to nixos-unstable 7fdd4004(2026-10-11)
- bump sops-nix to ee48786 with systemd shutdown fxi and nested JSON key
  support
2026-10-14 13:41:17 -05:00
kiskaadee 9381f3e070 feat(nixos): configure automated nix store garbage collection and deduplication
- Enable weekly garbage collection retaining generations newer than 14 days

- Enable automatic nix store hardlink deduplication
2026-10-14 13:41:17 -05:00
kiskaadee f0e0fc41a1 feat(appctl): promote engine v2 to authoritative appctl_engine and complete Milestone P3
- Promote scripts/appctl_engine_v2.py to authoritative scripts/appctl_engine.py
- Add full two-axis inspection, Homepage synchronization, and schema v1.0 support
- Convert scripts/appctl_engine_v2.py into a backward-compatibility shim
- Rename tests/unit/test_appctl_engine_v2.py to test_appctl_engine.py and remove xfail marker
- Update README.md, docs/appctl.md, and docs/architecture.md to reference appctl_engine
- Synchronize todo.txt and mark Milestone P3 as completed in ROADMAP.md
2026-10-14 13:41:17 -05:00
kiskaadee c78550abea feat(provenance): implement two-axis inspection engine and bounded upstream resolver
- Implement scripts/provenance.py evaluating local deployment checkout state independently from upstream software provenance.
- Add bounded git ls-remote provenance resolver with 10s timeout to prevent hanging on unresponsive remotes during --fetch.
- Add 10 unit tests in tests/unit/test_provenance.py covering clean/dirty detection, synced vs update-available states, timeout handling, and unreachable remotes.
- Include git in test-suite nativeBuildInputs in flake.nix for hermetic sandbox execution.
- Update todo.txt marking Tasks 3, 4, & 5 of Milestone P3 completed.
2026-10-14 13:41:17 -05:00
4 changed files with 59 additions and 8 deletions

No files matched your search

+8 -7
View File
@@ -1,6 +1,6 @@
# 📋 Control Plane Milestone P4: Readiness Plan & Boundary Specifications
**Status**: 🛠️ **In Progress (Pre-P4 Architecture & Security Gate)**
**Status**: ✅ **Approved & Locked (Ready for P4 Daemon Implementation)**
**Target Milestone**: [Milestone P4: Appctl Control Plane Daemon & API](../../ROADMAP.md#milestone-p4-appctl-control-plane-daemon--command-oriented-api)
**Governing ADR**: [`homelab-appctl-control-plane-architecture.md`](../decisions/README.md)
@@ -25,11 +25,11 @@ This plan resolves the six architectural prerequisites necessary to implement P4
| Deliverable | Phase | Focus | Status |
| :--- | :--- | :--- | :--- |
| **1. Implementation Inventory** | P0 Verification | Baseline truth, callers, dependencies, and migration state | ✅ **Completed** |
| **2. Command & Error Contract** | P4 Prerequisite (Blocker) | Canonical domain operations, typed schemas, and error taxonomy | 🎯 **In Review** |
| **3. Authorization Design** | Security Gate (Blocker) | Token lifecycle, RBAC matrix, and fail-closed evaluation | 🎯 **In Review** |
| **4. Execution & Privilege Boundaries** | P4 Prerequisite | Subprocess allowlist, Docker API capabilities, and filesystem roots | ⏳ Pending Gate |
| **5. Audit Telemetry Semantics** | P4 Prerequisite | RFC JSONL audit schema, persistent ownership, and lifecycle | ⏳ Pending Gate |
| **6. P4 Acceptance Test Suite** | Verification | Concrete DoD, black-box transport parity, and security regression gates | ⏳ Pending Gate |
| **2. Command & Error Contract** | P4 Prerequisite (Blocker) | Canonical domain operations, typed schemas, and error taxonomy | ✅ **Locked & Approved** |
| **3. Authorization Design** | Security Gate (Blocker) | Token lifecycle, RBAC matrix, and fail-closed evaluation | ✅ **Locked & Approved** |
| **4. Execution & Privilege Boundaries** | P4 Prerequisite | Subprocess allowlist, Docker API capabilities, and filesystem roots | ✅ **Locked & Approved** |
| **5. Audit Telemetry Semantics** | P4 Prerequisite | RFC JSONL audit schema, persistent ownership, and lifecycle | ✅ **Locked & Approved** |
| **6. P4 Acceptance Test Suite** | Verification | Concrete DoD, black-box transport parity, and security regression gates | ✅ **Locked & Approved** |
---
@@ -229,6 +229,7 @@ Following the pattern established in Milestone P2 for `homelab-gitops.service`,
- `ReadWritePaths`: Explicitly allowlisted writable roots:
- `/home/kiskaadee/Sites` (workload definitions and Git checkouts)
- `/home/kiskaadee/var/lib/homelab` (workload persistent state roots)
- `/home/kiskaadee/Core/config/homepage` (Homepage services.yaml destination)
- `/var/log/homelab/appctl` or `/home/kiskaadee/.local/state/homelab/appctl` (audit log directory)
- `/run/homelab` (socket runtime directory)
- `PrivateTmp = true`: Isolated temporary directories.
@@ -308,4 +309,4 @@ Before marking Milestone P4 complete, the following automated regression suite m
| **Truthful Error Reporting** | `test_execution_failure_audit`: Mock failing Docker compose run (exit 1). Assert daemon returns `ERR_EXECUTION_FAILED` (500) and records `phase: FAILED` in audit log. | Reject PR |
| **Audit Persistence Gate** | `test_audit_failure_blocks_mutation`: Mock read-only audit log. Assert mutating command fails closed with zero Docker invocations. | Block Release |
| **Daemon Crash Recovery** | `test_daemon_restart_preserves_state`: Kill and restart `homelab-appctl.service`. Assert running container stacks are undisturbed and desired Git state remains intact. | Reject PR |
| **Existing Invariant Regression** | Run `./scripts/test`: All 84 existing unit, security, and nix flake tests pass with 0 regressions. | Block Merge |
| **Existing Invariant Regression** | Run `./scripts/test`: All 86 existing unit, security, and nix flake tests pass with 0 regressions. | Block Merge |
+3
View File
@@ -35,6 +35,9 @@ if [ -f "$ENV_FILE" ]; then
set +a
fi
# Lock the homelab root domain before setup_app_env can mutate $DOMAIN
export HOMELAB_DOMAIN="${HOMELAB_DOMAIN:-${DOMAIN_SUFFIX:-${DOMAIN:-roadtotech.me}}}"
# Show help usage
show_help() {
echo "🚀 appctl - Homelab Container Orchestrator"
+6 -1
View File
@@ -37,7 +37,11 @@ SITES_DIR = os.environ.get(
else os.path.expanduser("~/Sites"),
)
HOMELAB_DOMAIN = os.environ.get("HOMELAB_DOMAIN") or os.environ.get("DOMAIN", "")
HOMELAB_DOMAIN = (
os.environ.get("HOMELAB_DOMAIN")
or os.environ.get("DOMAIN_SUFFIX")
or os.environ.get("DOMAIN", "")
)
def validate_environment() -> None:
@@ -393,6 +397,7 @@ def resolve_app(
container="",
description="Homelab Core Platform Stack",
dir_path=CORE_DIR,
app_type="core",
)
return None
+42
View File
@@ -336,3 +336,45 @@ def test_homepage_sync_groups_and_sorts_correctly(
content = output_file.read_text()
assert content.find("- Group A") < content.find("- Group B") # Group A should appear before Group B
assert "App2" in content # App 2 is in the file
def test_homepage_sync_core_services_domain_isolation(
mock_core_dir: Path,
monkeypatch,
):
"""
Ensure Core Infrastructure services use HOMELAB_DOMAIN and do not leak
an application's domain if DOMAIN is overridden by appctl.
"""
hp_config_dir = mock_core_dir / "config" / "homepage"
hp_config_dir.mkdir(parents=True, exist_ok=True)
monkeypatch.setattr(engine, "HOMELAB_DOMAIN", "roadtotech.me")
monkeypatch.setenv("DOMAIN", "mermaid.roadtotech.me")
engine.cmd_sync_homepage(["--homepage-dir=" + str(hp_config_dir)])
output_file = hp_config_dir / "services.yaml"
assert output_file.exists()
content = output_file.read_text()
assert "https://dashboard.roadtotech.me" in content
assert "https://traefik.roadtotech.me" in content
assert "https://auth.roadtotech.me" in content
assert "mermaid.roadtotech.me" not in content
def test_resolve_core_stack_type():
"""
Ensure resolving 'core' returns app_type='core' (entire stack),
while individual core services return app_type='core_service'.
"""
core = engine.resolve_app("core")
assert core is not None
assert core.to_dict()["type"] == "core"
assert core.container == ""
traefik = engine.resolve_app("traefik")
assert traefik is not None
assert traefik.to_dict()["type"] == "core_service"
assert traefik.container == "traefik"