Move pi-provider-lifecycle's embedded programs out of Nix strings #97

Closed
opened 2026-09-22 01:30:41 +01:00 by allod-agent · 0 comments
Member

Bring checks/pi-provider-lifecycle.nix up to the standard checks/site-content.nix already sets: its three Python programs and its bash test become real files under checks/pi-provider-lifecycle/, referenced by path, so they get syntax highlighting, shellcheck and a Python linter, and lose the ''${ escaping.

Primary goals:

  • Scripts are files — the fixture HTTP server, the process-leak sampler, the RPC driver and the bash body each live in their own file with the right extension.
  • Nix values arrive as environment variables — the reconcilers, the selector command and the runtime root are handed to the script the way site-content.nix hands SITE_ROOT and the two helper scripts to site-content.sh, not interpolated into its text.
  • Lint runs on them — shellcheck on the bash and a syntax check on the Python become possible, and check-selftest.sh-style proof stays with the check's own sabotage section.
  • The check stays what it is — every assertion and sabotage fixture is preserved; only where the text lives changes.

Current state and specifics

Line numbers are for the tree after allod/archetypes#93 lands (PR allod/archetypes#96). The file is 1397 lines. pkgs.writeText "pi-provider-fixture-server.py" holds an 81-line Python program (checks/pi-provider-lifecycle.nix:93-173), the process-leak sampler is 42 lines (:174-215), and pi-rpc-driver.py is 114 lines (:216-329). The pkgs.runCommand "pi-provider-lifecycle-check" body runs from :375 to the end, about a thousand lines of bash inside a Nix indented string, interpolating ${all.reconcile}, ${partial.reconcile}, ${empty.reconcile}, ${all.selectorCommand}, ${runtimeRoot}, the three Python files and the generated activation texts (:392-396, :330-332). checks/site-content.nix is the model: a small runCommand whose script is ${pkgs.bash}/bin/bash ${./site-content.sh} with its inputs as environment variables.

This is not a pure move, so the derivation-path witness allod/archetypes#93 used does not apply; the check's derivation changes by design. The witness is the check itself: it must build green after the move, and its sabotage section (:1342 onward) must still fail when a fixture is sabotaged. Read nix.md on patchShebangs and tracked files before building: a new script that is not staged is invisible to the build.

Scope

In scope: the four embedded programs, the environment-variable seam that replaces interpolation, and lint over the new files.

Explicitly not in scope: changing what the check asserts, or touching modules/pi-provider-reconcile.sh and modules/pi-provider-lifecycle.nix, which are production.

Refs allod/archetypes#93

Bring `checks/pi-provider-lifecycle.nix` up to the standard `checks/site-content.nix` already sets: its three Python programs and its bash test become real files under `checks/pi-provider-lifecycle/`, referenced by path, so they get syntax highlighting, shellcheck and a Python linter, and lose the `''${` escaping. Primary goals: - **Scripts are files** — the fixture HTTP server, the process-leak sampler, the RPC driver and the bash body each live in their own file with the right extension. - **Nix values arrive as environment variables** — the reconcilers, the selector command and the runtime root are handed to the script the way `site-content.nix` hands `SITE_ROOT` and the two helper scripts to `site-content.sh`, not interpolated into its text. - **Lint runs on them** — shellcheck on the bash and a syntax check on the Python become possible, and `check-selftest.sh`-style proof stays with the check's own sabotage section. - **The check stays what it is** — every assertion and sabotage fixture is preserved; only where the text lives changes. ### Current state and specifics Line numbers are for the tree after allod/archetypes#93 lands (PR allod/archetypes#96). The file is 1397 lines. `pkgs.writeText "pi-provider-fixture-server.py"` holds an 81-line Python program (`checks/pi-provider-lifecycle.nix:93-173`), the process-leak sampler is 42 lines (`:174-215`), and `pi-rpc-driver.py` is 114 lines (`:216-329`). The `pkgs.runCommand "pi-provider-lifecycle-check"` body runs from `:375` to the end, about a thousand lines of bash inside a Nix indented string, interpolating `${all.reconcile}`, `${partial.reconcile}`, `${empty.reconcile}`, `${all.selectorCommand}`, `${runtimeRoot}`, the three Python files and the generated activation texts (`:392-396`, `:330-332`). `checks/site-content.nix` is the model: a small `runCommand` whose script is `${pkgs.bash}/bin/bash ${./site-content.sh}` with its inputs as environment variables. This is not a pure move, so the derivation-path witness allod/archetypes#93 used does not apply; the check's derivation changes by design. The witness is the check itself: it must build green after the move, and its sabotage section (`:1342` onward) must still fail when a fixture is sabotaged. Read `nix.md` on `patchShebangs` and tracked files before building: a new script that is not staged is invisible to the build. ### Scope In scope: the four embedded programs, the environment-variable seam that replaces interpolation, and lint over the new files. Explicitly not in scope: changing what the check asserts, or touching `modules/pi-provider-reconcile.sh` and `modules/pi-provider-lifecycle.nix`, which are production. Refs allod/archetypes#93
vnprc closed this issue 2026-09-22 03:36:55 +01:00
Sign in to join this conversation.
No milestone
No project
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
allod/archetypes#97
No description provided.