refactor: clarify fleet configuration boundaries #181
No reviewers
Labels
No labels
area:authentication
area:flake-utilities
area:performance
area:tbd
host:chaos
host:electra
host:fleet
host:lyra
host:nova
host:vega
investigation
phase:cutover
phase:deploy
phase:mcp
phase:module
phase:packaging
phase:prep
phase:validation
priority:high
priority:medium
project:attic-postgres-lyra-rollout
project:auto-update-reliability
project:auto-update-remediation
project:declarative-purity-cleanup
project:external-review
project:fleet-boundary-cleanup
project:host-facts-refactor
project:lyra-nixos-deploy
project:lyra-service-stack-migration
project:nebula-mesh-network
project:nixos-build-deployment-pipeline
project:security-hardening
project:service-stack-migration
project:vega-sillytavern-cutover
project:wiki-rebuild
repo:numtide/flake-utils
repo:numtide/nix-auth
repo:numtide/nixos-passthru-cache
repo:numtide/nix-relay
service:auto-update
service:mem0
service:nix
service:sillytavern
service:slskd
service:synthseek
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
nimmo/nixos-config!181
Loading…
Reference in a new issue
No description provided.
Delete branch "refactor/fleet-boundary-cleanup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
scripts/nixos-update-remediation.pyas the stable executable while splitting implementation into core, model, validation, publication, and CLI modulesValidation
ruff check scripts/nixos-update-remediation.py scripts/nixos_update_remediation./tests/nixos-update-remediation-regressions.shnix flake checkRefs #178
Refs #179
Refs #180
Automated code review
Reviewed commit:
b074ac8f62e96db6367489bd193ce87d359e2f42Verdict: 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
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
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
Questions
Review limitations
Diff coverage
.forgejo/workflows/attic-cache.yml: reviewed — included in a context-limited batchREADME.md: reviewed — included in a context-limited batchhosts/lyra/default.nix: reviewed — included in a context-limited batchhosts/vega/default.nix: reviewed — included in a context-limited batchmodules/common/default-config.nix: reviewed — included in a context-limited batchmodules/services/paseo-daemon.nix: reviewed — included in a context-limited batchscripts/nixos-update-remediation.py: reviewed — included in a context-limited batchscripts/nixos_update_remediation/__init__.py: reviewed — included in a context-limited batchscripts/nixos_update_remediation/cli.py: reviewed — included in a context-limited batchscripts/nixos_update_remediation/core.py: reviewed — included in a context-limited batchscripts/nixos_update_remediation/model.py: reviewed — included in a context-limited batchscripts/nixos_update_remediation/publication.py: reviewed — included in a context-limited batchscripts/nixos_update_remediation/validation.py: reviewed — included in a context-limited batchtests/nixos-update-remediation-regressions.sh: reviewed — included in a context-limited batchReview metadata
Addressed the important relay-endpoint finding in
b074ac8: the shared module now validateshostname:portsyntax 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 rerannix flake checksuccessfully.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.Reviewed the refreshed automated findings against executed behavior:
grep -ERninvocation is valid GNU grep usage:-Rrecursively traverses the supplied package directory. It returns status 1 with no stderr because no forbiddenCloses #text exists, which is exactly the condition expected by the surroundingif. More importantly, the complete strict-mode regression script passed twice after this change, including every subsequent check and the integration fixtures.sys.path, independent of the caller working directory.cd /tmp && python3 /home/nimmo/.paseo/worktrees/3u5fp3xy/purple-dragon/scripts/nixos-update-remediation.py verifysucceeds and reports the verified contract.The hardcoded firewall port preserves the upstream
services.paseodefault 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.