refactor: clarify fleet configuration boundaries #181

Merged
nimmo merged 2 commits from refactor/fleet-boundary-cleanup into main 2026-08-17 00:35:09 +01:00
Owner

Summary

  • replace duplicated Vega/Lyra Paseo daemon configuration with a reusable fleet service module
  • keep scripts/nixos-update-remediation.py as the stable executable while splitting implementation into core, model, validation, publication, and CLI modules
  • extend workflow path coverage and safety assertions for the internal package
  • refresh the README for all six active hosts and the new subsystem boundaries

Validation

  • ruff check scripts/nixos-update-remediation.py scripts/nixos_update_remediation
  • ./tests/nixos-update-remediation-regressions.sh
  • evaluated Vega and Lyra Paseo hostnames through their NixOS configurations
  • nix flake check

Refs #178
Refs #179
Refs #180

## Summary - replace duplicated Vega/Lyra Paseo daemon configuration with a reusable fleet service module - keep `scripts/nixos-update-remediation.py` as the stable executable while splitting implementation into core, model, validation, publication, and CLI modules - extend workflow path coverage and safety assertions for the internal package - refresh the README for all six active hosts and the new subsystem boundaries ## Validation - `ruff check scripts/nixos-update-remediation.py scripts/nixos_update_remediation` - `./tests/nixos-update-remediation-regressions.sh` - evaluated Vega and Lyra Paseo hostnames through their NixOS configurations - `nix flake check` Refs #178 Refs #179 Refs #180
refactor: clarify fleet configuration boundaries
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 1m47s
Build and Push Attic Cache / build (pull_request) Has been skipped
Build and Push Attic Cache / pin-lifecycle (pull_request) Has been skipped
Build and Push Attic Cache / remediate (pull_request) Has been skipped
Build and Push Attic Cache / notify-remediation (pull_request) Has been skipped
AI pull-request review / review (pull_request) Successful in 12m41s
4a50fd8ab9
Extract shared Paseo daemon policy, split guarded remediation into responsibility-based modules, and refresh the six-host documentation.\n\nRefs #178\nRefs #179\nRefs #180
Author
Owner

Automated code review

Reviewed commit: b074ac8f62e96db6367489bd193ce87d359e2f42

Verdict: Requires further work

Resolve the blocking or important findings and investigate failed deterministic checks before merging.

Overall assessment

Refactors shared Paseo daemon configuration into a reusable NixOS module and splits the monolithic remediation Python script into a responsibility-based package. Updates CI trigger paths, host configurations, and documentation to reflect the new boundaries while preserving functional parity.

Refactors the NixOS update remediation controller into a structured Python package (model, validation, publication) and updates regression tests to validate the new module paths and CI workflow triggers. Identifies a critical defect in the test script where passing a directory directly to grep causes an immediate failure under strict shell settings.

Blocking findings

  • Test script passes directory directly to grep, causing immediate failure (tests/nixos-update-remediation-regressions.sh:48; high confidence)
    grep -ERn 'Closes #' "$CONTROLLER" "$CONTROLLER_PACKAGE"; then
    Impact: The regression test will abort with a non-zero exit status due to set -euo pipefail when grep encounters the directory argument, preventing all subsequent validation checks from executing.
    Suggested fix: Append a trailing slash to the directory path (e.g., "$CONTROLLER_PACKAGE/") or expand files explicitly (e.g., "$CONTROLLER_PACKAGE"/*.py) so grep processes files recursively instead of receiving a raw directory argument.

Important findings

  • Python relative imports may fail outside Nix execution context (scripts/nixos-update-remediation.py:3; high confidence)
    from nixos_update_remediation.cli import entrypoint
    Impact: Running the script directly via python3 from a different working directory or without PYTHONPATH set to the repository root will raise ModuleNotFoundError.
    Suggested fix: Add sys.path manipulation to resolve the package relative to the script location, or ensure all invocation paths (CI, local scripts) explicitly set PYTHONPATH to the flake root.

Suggestions

  • Hardcoded Paseo daemon firewall port in shared module (modules/services/paseo-daemon.nix:97; medium confidence)
    networking.firewall.interfaces."nebula.mesh".allowedTCPPorts = [ 6767 ];
    Impact: Future changes to the daemon listener port require modifying the shared module or overriding it in every host configuration.
    Suggested fix: Expose listenPort as a nixosConfig.paseoDaemon option with a default of 6767, allowing hosts to override it declaratively if needed.

  • Fragile parent directory traversal in core.py (scripts/nixos_update_remediation/core.py:21; medium confidence)
    ROOT = Path(file).resolve().parents[2]
    Impact: If the package directory structure changes (e.g., moved to a different depth), ROOT will resolve incorrectly, breaking policy and prompt path resolution.
    Suggested fix: Use an environment variable or explicit configuration constant for the repository root, or validate ROOT exists at import time with a clear error message.

Tests and validation

  • No configured deterministic checks.

Questions

  • Does the CI runner that executes scripts/nixos-update-remediation.py set PYTHONPATH to the flake root, or does it rely on the script's directory being in sys.path?
  • Are there any other hosts or profiles that currently define services.paseo inline that should be migrated to nixosConfig.paseoDaemon.enable?

Review limitations

  • Review is based solely on the provided diff and documentation; runtime behavior of the Python package split and NixOS module evaluation cannot be verified without execution.
  • SOPS secret path resolution and Nebula overlay IP availability depend on host-specific configurations not fully visible in this context.
  • Review is limited to the provided diff; unchanged files like core.py were not supplied, so cross-module import resolution relies on their prior existence in the repository.

Diff coverage

  • .forgejo/workflows/attic-cache.yml: reviewed — included in a context-limited batch
  • README.md: reviewed — included in a context-limited batch
  • hosts/lyra/default.nix: reviewed — included in a context-limited batch
  • hosts/vega/default.nix: reviewed — included in a context-limited batch
  • modules/common/default-config.nix: reviewed — included in a context-limited batch
  • modules/services/paseo-daemon.nix: reviewed — included in a context-limited batch
  • scripts/nixos-update-remediation.py: reviewed — included in a context-limited batch
  • scripts/nixos_update_remediation/__init__.py: reviewed — included in a context-limited batch
  • scripts/nixos_update_remediation/cli.py: reviewed — included in a context-limited batch
  • scripts/nixos_update_remediation/core.py: reviewed — included in a context-limited batch
  • scripts/nixos_update_remediation/model.py: reviewed — included in a context-limited batch
  • scripts/nixos_update_remediation/publication.py: reviewed — included in a context-limited batch
  • scripts/nixos_update_remediation/validation.py: reviewed — included in a context-limited batch
  • tests/nixos-update-remediation-regressions.sh: reviewed — included in a context-limited batch
Review metadata
  • Reviewer: forgejo-ai-review v1
  • Model: qwen3.6:35b-a3b-q8_0
  • Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, README.md
  • Commits considered: 2
  • Previous automated review: updated
  • Findings: 4
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `b074ac8f62e96db6367489bd193ce87d359e2f42` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment Refactors shared Paseo daemon configuration into a reusable NixOS module and splits the monolithic remediation Python script into a responsibility-based package. Updates CI trigger paths, host configurations, and documentation to reflect the new boundaries while preserving functional parity. Refactors the NixOS update remediation controller into a structured Python package (model, validation, publication) and updates regression tests to validate the new module paths and CI workflow triggers. Identifies a critical defect in the test script where passing a directory directly to grep causes an immediate failure under strict shell settings. ### Blocking findings - **Test script passes directory directly to grep, causing immediate failure** (tests/nixos-update-remediation-regressions.sh:48; high confidence) grep -ERn 'Closes #' "$CONTROLLER" "$CONTROLLER_PACKAGE"; then Impact: The regression test will abort with a non-zero exit status due to set -euo pipefail when grep encounters the directory argument, preventing all subsequent validation checks from executing. Suggested fix: Append a trailing slash to the directory path (e.g., "$CONTROLLER_PACKAGE/") or expand files explicitly (e.g., "$CONTROLLER_PACKAGE"/*.py) so grep processes files recursively instead of receiving a raw directory argument. ### Important findings - **Python relative imports may fail outside Nix execution context** (scripts/nixos-update-remediation.py:3; high confidence) from nixos_update_remediation.cli import entrypoint Impact: Running the script directly via python3 from a different working directory or without PYTHONPATH set to the repository root will raise ModuleNotFoundError. Suggested fix: Add sys.path manipulation to resolve the package relative to the script location, or ensure all invocation paths (CI, local scripts) explicitly set PYTHONPATH to the flake root. ### Suggestions - **Hardcoded Paseo daemon firewall port in shared module** (modules/services/paseo-daemon.nix:97; medium confidence) networking.firewall.interfaces."nebula.mesh".allowedTCPPorts = [ 6767 ]; Impact: Future changes to the daemon listener port require modifying the shared module or overriding it in every host configuration. Suggested fix: Expose listenPort as a nixosConfig.paseoDaemon option with a default of 6767, allowing hosts to override it declaratively if needed. - **Fragile parent directory traversal in core.py** (scripts/nixos_update_remediation/core.py:21; medium confidence) ROOT = Path(__file__).resolve().parents[2] Impact: If the package directory structure changes (e.g., moved to a different depth), ROOT will resolve incorrectly, breaking policy and prompt path resolution. Suggested fix: Use an environment variable or explicit configuration constant for the repository root, or validate ROOT exists at import time with a clear error message. ### Tests and validation - No configured deterministic checks. ### Questions - Does the CI runner that executes scripts/nixos-update-remediation.py set PYTHONPATH to the flake root, or does it rely on the script's directory being in sys.path? - Are there any other hosts or profiles that currently define services.paseo inline that should be migrated to nixosConfig.paseoDaemon.enable? ### Review limitations - Review is based solely on the provided diff and documentation; runtime behavior of the Python package split and NixOS module evaluation cannot be verified without execution. - SOPS secret path resolution and Nebula overlay IP availability depend on host-specific configurations not fully visible in this context. - Review is limited to the provided diff; unchanged files like core.py were not supplied, so cross-module import resolution relies on their prior existence in the repository. ### Diff coverage - `.forgejo/workflows/attic-cache.yml`: **reviewed** — included in a context-limited batch - `README.md`: **reviewed** — included in a context-limited batch - `hosts/lyra/default.nix`: **reviewed** — included in a context-limited batch - `hosts/vega/default.nix`: **reviewed** — included in a context-limited batch - `modules/common/default-config.nix`: **reviewed** — included in a context-limited batch - `modules/services/paseo-daemon.nix`: **reviewed** — included in a context-limited batch - `scripts/nixos-update-remediation.py`: **reviewed** — included in a context-limited batch - `scripts/nixos_update_remediation/__init__.py`: **reviewed** — included in a context-limited batch - `scripts/nixos_update_remediation/cli.py`: **reviewed** — included in a context-limited batch - `scripts/nixos_update_remediation/core.py`: **reviewed** — included in a context-limited batch - `scripts/nixos_update_remediation/model.py`: **reviewed** — included in a context-limited batch - `scripts/nixos_update_remediation/publication.py`: **reviewed** — included in a context-limited batch - `scripts/nixos_update_remediation/validation.py`: **reviewed** — included in a context-limited batch - `tests/nixos-update-remediation-regressions.sh`: **reviewed** — included in a context-limited batch <details><summary>Review metadata</summary> - Reviewer: forgejo-ai-review v1 - Model: qwen3.6:35b-a3b-q8_0 - Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, README.md - Commits considered: 2 - Previous automated review: updated - Findings: 4 </details>
fix: validate shared Paseo relay endpoint
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 1m43s
Build and Push Attic Cache / build (pull_request) Has been skipped
Build and Push Attic Cache / pin-lifecycle (pull_request) Has been skipped
Build and Push Attic Cache / remediate (pull_request) Has been skipped
Build and Push Attic Cache / notify-remediation (pull_request) Has been skipped
AI pull-request review / review (pull_request) Successful in 12m1s
b074ac8f62
Provide an explicit hostname:port assertion and document the option contract.\n\nRefs #179
Author
Owner

Addressed the important relay-endpoint finding in b074ac8: the shared module now validates hostname:port syntax and the 1–65535 port range with an explicit NixOS assertion, and the option documentation records that contract. Verified the valid endpoint evaluates to port 443, exercised the invalid-endpoint diagnostic, and reran nix flake check successfully.

The package already includes scripts/nixos_update_remediation/__init__.py; the automated review included it in diff coverage but appears to have overlooked its one-line package declaration. The fixed Git timestamp behavior is pre-existing deterministic-publication behavior moved unchanged from the monolith.

Addressed the important relay-endpoint finding in b074ac8: the shared module now validates `hostname:port` syntax and the 1–65535 port range with an explicit NixOS assertion, and the option documentation records that contract. Verified the valid endpoint evaluates to port 443, exercised the invalid-endpoint diagnostic, and reran `nix flake check` successfully. The package already includes `scripts/nixos_update_remediation/__init__.py`; the automated review included it in diff coverage but appears to have overlooked its one-line package declaration. The fixed Git timestamp behavior is pre-existing deterministic-publication behavior moved unchanged from the monolith.
Author
Owner

Reviewed the refreshed automated findings against executed behavior:

  • The grep -ERn invocation is valid GNU grep usage: -R recursively traverses the supplied package directory. It returns status 1 with no stderr because no forbidden Closes # text exists, which is exactly the condition expected by the surrounding if. More importantly, the complete strict-mode regression script passed twice after this change, including every subsequent check and the integration fixtures.
  • Python adds the directory containing the executed script to sys.path, independent of the caller working directory. cd /tmp && python3 /home/nimmo/.paseo/worktrees/3u5fp3xy/purple-dragon/scripts/nixos-update-remediation.py verify succeeds and reports the verified contract.

The hardcoded firewall port preserves the upstream services.paseo default and the previous two host definitions; making it independently configurable would allow the firewall and service port to drift unless both are coupled, so it is outside this behavior-preserving extraction. The repository-root calculation is now centralized in one module and covered by the same absolute-path execution test. No blocking or important finding remains after verification.

Reviewed the refreshed automated findings against executed behavior: - The `grep -ERn` invocation is valid GNU grep usage: `-R` recursively traverses the supplied package directory. It returns status 1 with no stderr because no forbidden `Closes #` text exists, which is exactly the condition expected by the surrounding `if`. More importantly, the complete strict-mode regression script passed twice after this change, including every subsequent check and the integration fixtures. - Python adds the directory containing the executed script to `sys.path`, independent of the caller working directory. `cd /tmp && python3 /home/nimmo/.paseo/worktrees/3u5fp3xy/purple-dragon/scripts/nixos-update-remediation.py verify` succeeds and reports the verified contract. The hardcoded firewall port preserves the upstream `services.paseo` default and the previous two host definitions; making it independently configurable would allow the firewall and service port to drift unless both are coupled, so it is outside this behavior-preserving extraction. The repository-root calculation is now centralized in one module and covered by the same absolute-path execution test. No blocking or important finding remains after verification.
nimmo merged commit 62bf275750 into main 2026-08-17 00:35:09 +01:00
Sign in to join this conversation.
No reviewers
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
nimmo/nixos-config!181
No description provided.