Replace the V1 service with the tested V2 production configuration #258

Merged
nimmo merged 12 commits from feat/257-redview-v2-production into main 2026-10-02 14:26:07 +01:00
Owner

Summary

Replace the V1 application declaration with the root-layout V2 production module and retain the existing operational integrations. Use the same immutable dev.118 application package exercised by the operator; do not upgrade the application during this configuration merge.

Related: #257, milestone Lyra Redview v2 Migration. Keep the issue open for persistent deployment and the remaining operator acceptance.

Validation

  • Full local flake checks and target system build passed.
  • Migration helper rehearsals pass interruption/resumption, verifier failure/retry, stale-source rejection and no-overwrite protection; shell lint passes.
  • The operator completed final migration and test activation. Read-only health/spec, authentication-contract, four-worker startup and live writable-media checks passed with zero worker restarts.
  • V1 is inactive/absent in the active configuration. Old databases and the previous system closure are retained.

Remaining operator steps

Keep the auto-update hold until persistent deployment succeeds. Test activation reverts on reboot. A personal login and new GPU/Reddit/VPN job were not performed by the agent's post-activation checks; production rollback was not exercised. Detailed operational metadata and commands remain in the privately staged guide. This PR does not publish a stable application release.

## Summary Replace the V1 application declaration with the root-layout V2 production module and retain the existing operational integrations. Use the same immutable dev.118 application package exercised by the operator; do not upgrade the application during this configuration merge. Related: #257, milestone Lyra Redview v2 Migration. Keep the issue open for persistent deployment and the remaining operator acceptance. ## Validation - Full local flake checks and target system build passed. - Migration helper rehearsals pass interruption/resumption, verifier failure/retry, stale-source rejection and no-overwrite protection; shell lint passes. - The operator completed final migration and test activation. Read-only health/spec, authentication-contract, four-worker startup and live writable-media checks passed with zero worker restarts. - V1 is inactive/absent in the active configuration. Old databases and the previous system closure are retained. ## Remaining operator steps Keep the auto-update hold until persistent deployment succeeds. Test activation reverts on reboot. A personal login and new GPU/Reddit/VPN job were not performed by the agent's post-activation checks; production rollback was not exercised. Detailed operational metadata and commands remain in the privately staged guide. This PR does not publish a stable application release.
Author
Owner

Automated code review

Reviewed commit: fb39419204cae7a2382ca273e78ac3b3ecc61e3e

Verdict: Requires further work

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

Overall assessment

The PR introduces a V2 Redview service configuration on the Lyra host, replacing the V1 service. It includes a NixOS module update, a deterministic check script, and a shell helper for database migration with Python tests. The diff shows correct usage of lib.range within the flake context in the check script, and the migration script implements robust atomicity checks for snapshots and migrations.

Blocking findings

None.

Important findings

  • Migration script assumes specific worker service naming convention (scripts/redview-v2-production-prepare.sh:115; high confidence)
    The script explicitly stops services: systemctl stop 'redview-v2-worker*.service' redview-v2.service redview.service and checks for specific units: for unit in redview.service redview-v2.service redview-v2-worker.service redview-v2-worker-{2,3,4}.service; do. This hardcodes the worker count (4) and naming scheme (redview-v2-worker, redview-v2-worker-2, etc.) which matches the NixOS module config but is brittle if the module configuration changes.
    Impact: If the NixOS module's worker naming or count changes, the migration script may fail to stop all relevant services or check for stale states incorrectly, potentially leading to data inconsistency during migration.
    Suggested fix: Consider making the service names dynamic based on the expected configuration or documenting that this script must be updated alongside any changes to the NixOS module's worker configuration.

Suggestions

  • Migration script relies on external package binaries without version pinning in script (scripts/redview-v2-production-prepare.sh:95; medium confidence)
    The script takes a Nix store path as an argument ($1) and uses binaries from it ($package/bin/python3, $package/bin/redview-backup, etc.). While the README instructs users to pass a 'tested' package path, the script itself does not verify that these binaries are compatible with each other or with the target database schema beyond runtime execution.
    Impact: If a user passes a mismatched or partially built package, the migration might fail in subtle ways or produce an incompatible database.
    Suggested fix: Add a version check or compatibility assertion within the script if possible, or ensure the operator guide explicitly states that all binaries must come from the same derivation build.

Tests and validation

  • No configured deterministic checks.

Questions

  • Does the redview-v2 NixOS module automatically configure RequiresMountsFor for /var/lib/redview/media in worker units, or is this handled by the explicit systemd.services overrides in the diff?
  • Is the redview-migrate tool idempotent enough to resume from a partial migration state without corrupting the target database if interrupted again?

Review limitations

  • I cannot execute the NixOS configuration or run the Python tests to verify their success.
  • I cannot verify the actual behavior of the external redview-backup, redview-migrate, and redview-verify-migration binaries.
  • The diff does not show the full content of the redview-v2 NixOS module from the flake input, only the host-specific configuration.

Diff coverage

  • README.md: reviewed — included in a context-limited batch
  • flake.lock: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • modules/services/redview.nix: reviewed — included in a context-limited batch
  • scripts/check-redview-v2-production.nix: reviewed — included in a context-limited batch
  • scripts/redview-v2-production-prepare.sh: reviewed — included in a context-limited batch
  • scripts/test-redview-v2-production-prepare.py: 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, docs/auto-update-remediation.md, docs/nova-remote-builder.md, README.md
  • Commits considered: 12
  • Previous automated review: updated
  • Findings: 2
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `fb39419204cae7a2382ca273e78ac3b3ecc61e3e` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment The PR introduces a V2 Redview service configuration on the Lyra host, replacing the V1 service. It includes a NixOS module update, a deterministic check script, and a shell helper for database migration with Python tests. The diff shows correct usage of `lib.range` within the flake context in the check script, and the migration script implements robust atomicity checks for snapshots and migrations. ### Blocking findings None. ### Important findings - **Migration script assumes specific worker service naming convention** (scripts/redview-v2-production-prepare.sh:115; high confidence) The script explicitly stops services: `systemctl stop 'redview-v2-worker*.service' redview-v2.service redview.service` and checks for specific units: `for unit in redview.service redview-v2.service redview-v2-worker.service redview-v2-worker-{2,3,4}.service; do`. This hardcodes the worker count (4) and naming scheme (`redview-v2-worker`, `redview-v2-worker-2`, etc.) which matches the NixOS module config but is brittle if the module configuration changes. Impact: If the NixOS module's worker naming or count changes, the migration script may fail to stop all relevant services or check for stale states incorrectly, potentially leading to data inconsistency during migration. Suggested fix: Consider making the service names dynamic based on the expected configuration or documenting that this script must be updated alongside any changes to the NixOS module's worker configuration. ### Suggestions - **Migration script relies on external package binaries without version pinning in script** (scripts/redview-v2-production-prepare.sh:95; medium confidence) The script takes a Nix store path as an argument (`$1`) and uses binaries from it (`$package/bin/python3`, `$package/bin/redview-backup`, etc.). While the README instructs users to pass a 'tested' package path, the script itself does not verify that these binaries are compatible with each other or with the target database schema beyond runtime execution. Impact: If a user passes a mismatched or partially built package, the migration might fail in subtle ways or produce an incompatible database. Suggested fix: Add a version check or compatibility assertion within the script if possible, or ensure the operator guide explicitly states that all binaries must come from the same derivation build. ### Tests and validation - No configured deterministic checks. ### Questions - Does the `redview-v2` NixOS module automatically configure `RequiresMountsFor` for `/var/lib/redview/media` in worker units, or is this handled by the explicit `systemd.services` overrides in the diff? - Is the `redview-migrate` tool idempotent enough to resume from a partial migration state without corrupting the target database if interrupted again? ### Review limitations - I cannot execute the NixOS configuration or run the Python tests to verify their success. - I cannot verify the actual behavior of the external `redview-backup`, `redview-migrate`, and `redview-verify-migration` binaries. - The diff does not show the full content of the `redview-v2` NixOS module from the flake input, only the host-specific configuration. ### Diff coverage - `README.md`: **reviewed** — included in a context-limited batch - `flake.lock`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `modules/services/redview.nix`: **reviewed** — included in a context-limited batch - `scripts/check-redview-v2-production.nix`: **reviewed** — included in a context-limited batch - `scripts/redview-v2-production-prepare.sh`: **reviewed** — included in a context-limited batch - `scripts/test-redview-v2-production-prepare.py`: **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, docs/auto-update-remediation.md, docs/nova-remote-builder.md, README.md - Commits considered: 12 - Previous automated review: updated - Findings: 2 </details>
fix(redview): retain the tested pin through main after rewrite merge (#257)
All checks were successful
AI pull-request review / review (pull_request) Successful in 1m24s
Build and Push Attic Cache / test (pull_request) Successful in 1m31s
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
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
fb39419204
Author
Owner

Reviewed the advisory findings against the implementation and test evidence:

  • The production check intentionally asserts the target deployment contract of four workers, each with one slot. Worker names are generated dynamically from service.workerCount, matching the module; this is not an incomplete fixed-name list. Generic count overrides and disabling the pool are tested in Redview's nix/tests/v2-module.nix. If the agreed production count changes, updating this explicit target assertion is expected. nixpkgs is pinned by flake.lock, and the current flake check passes. No defect was identified in this finding.
  • The preparation helper accepts an explicit immutable package argument so the reviewed operator wrapper can select the tested package and disposable rehearsals can use the same tools. The wrapper validates its exact package/configuration before invoking preparation. It does not guess a mutable default. Completed preparation is not repeated during activation/resume.
  • Detailed rollback metadata is retained privately by design. Publishing it here was rejected by automatic approval review, so the public issue/MR contains scope and evidence rather than those private details. Previous system/database retention and the operator guide were checked; no executed production rollback is claimed.
  • The now-deleted rewrite branch reference is fixed in fb39419: fetch through main while preserving the exact tested application commit and package. Package equality and full local flake checks pass. The old review at 18de484 predates this adjustment.

The authoritative CI test job passed on the prior head and is running for the reference-only update. The operator has completed real migration/test activation; read-only post-activation checks passed. The issue remains open for persistent deployment and remaining operator acceptance.

Reviewed the advisory findings against the implementation and test evidence: - The production check intentionally asserts the target deployment contract of four workers, each with one slot. Worker names are generated dynamically from service.workerCount, matching the module; this is not an incomplete fixed-name list. Generic count overrides and disabling the pool are tested in Redview's nix/tests/v2-module.nix. If the agreed production count changes, updating this explicit target assertion is expected. nixpkgs is pinned by flake.lock, and the current flake check passes. No defect was identified in this finding. - The preparation helper accepts an explicit immutable package argument so the reviewed operator wrapper can select the tested package and disposable rehearsals can use the same tools. The wrapper validates its exact package/configuration before invoking preparation. It does not guess a mutable default. Completed preparation is not repeated during activation/resume. - Detailed rollback metadata is retained privately by design. Publishing it here was rejected by automatic approval review, so the public issue/MR contains scope and evidence rather than those private details. Previous system/database retention and the operator guide were checked; no executed production rollback is claimed. - The now-deleted rewrite branch reference is fixed in fb39419: fetch through main while preserving the exact tested application commit and package. Package equality and full local flake checks pass. The old review at 18de484 predates this adjustment. The authoritative CI test job passed on the prior head and is running for the reference-only update. The operator has completed real migration/test activation; read-only post-activation checks passed. The issue remains open for persistent deployment and remaining operator acceptance.
Author
Owner

Reviewed the updated fb39419 advisory: it reports no blocking findings. The remaining worker-naming concern is about hypothetical configuration drift. The stop command uses a wildcard for the whole worker pool, not just four named workers; systemctl stop is synchronous and any stop failure aborts the helper under set -e before migration. The subsequent explicit checks cover the exact four-worker target contract, which the flake check also asserts. An altered naming/count contract would require reviewing this target-specific initial-cutover helper. No observed stopping or migration defect was identified.

The package argument supplies all tools from one immutable derivation; the prepared operator wrapper validates that exact package and configuration. Rehearsals cover interruption/retry and full-field verification, and the user completed the real cutover. Required mounts are checked in both evaluated configuration and the five live process namespaces.

Final-head authoritative CI and advisory jobs are successful. Local full flake checks and target system build pass; the main reference resolves to the identical deployed dev.118 package. Proceeding with the authorized configuration merge; persistent deployment remains with the operator.

Reviewed the updated fb39419 advisory: it reports no blocking findings. The remaining worker-naming concern is about hypothetical configuration drift. The stop command uses a wildcard for the whole worker pool, not just four named workers; systemctl stop is synchronous and any stop failure aborts the helper under set -e before migration. The subsequent explicit checks cover the exact four-worker target contract, which the flake check also asserts. An altered naming/count contract would require reviewing this target-specific initial-cutover helper. No observed stopping or migration defect was identified. The package argument supplies all tools from one immutable derivation; the prepared operator wrapper validates that exact package and configuration. Rehearsals cover interruption/retry and full-field verification, and the user completed the real cutover. Required mounts are checked in both evaluated configuration and the five live process namespaces. Final-head authoritative CI and advisory jobs are successful. Local full flake checks and target system build pass; the main reference resolves to the identical deployed dev.118 package. Proceeding with the authorized configuration merge; persistent deployment remains with the operator.
nimmo merged commit 517cfdb21d into main 2026-10-02 14:26:07 +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!258
No description provided.