fix(auto-update): remove recovered dfhack pin and consume standalone cloudflare-cli flake #362
No reviewers
Labels
No labels
area:authentication
area:flake-utilities
area:performance
area:tbd
host:chaos
host:cosmos
host:electra
host:fleet
host:lena
host:lyra
host:mass-storage
host:media1
host:nimmog-de
host:nova
host:pangolin
host:pangolin-vps
host:phone
host:router
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:nix-idioms-hygiene
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:gitlab
service:hermes
service:mem0
service:nix
service:sillytavern
service:slskd
service:synthseek
service:tdarr
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
nimmo/nixos-config!362
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/auto-update-remediation-262-353"
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?
Closes #262
Closes #353
Closes #356
Summary
Remove obsolete DFHack GCC 15 compatibility pin & support reversed file creations/deletions in
pin-lifecycle(#262):nixpkgs(f20cd90e28fe0403873f473b29e42662cd86e8c4) now setsstdenv = gcc15Stdenv;directly fordfhackinpkgs/games/dwarf-fortress/default.nixand removedgccStdenvfrom its top-level lambda arguments, causingpackages/dwarf-fortress-full/default.nixto fail evaluation on newernixpkgscandidates.remediation/pins/6a04b2c6e4fae9c31d686b5a1cd5e1ec50f944dfdd3e2bc495309fb6cf212f49.remove.patch, remove the pin metadata/patch files along withpackages/dwarf-fortress-full/default.nix, the overlay entry inmodules/common/nix-settings.nix, and the temporary note inREADME.md, and advanceflake.locknixpkgstof20cd90e28fe0403873f473b29e42662cd86e8c4.publish_removal()inscripts/nixos-pin-lifecycle.pyso tracked paths deleted or recreated when reversing a forward pin patch that created or deleted a file (" D <path>"/"?? <path>"with--untracked-files=all) are accepted and staged withgit add -A, and extendtests/nixos-pin-lifecycle-integration.pyto cover reversed file creations and deletions.Consume standalone
cloudflare-cli.nixflake with automated GitLab CI upstream updates (#353, #356):forge.nimmog.uk/nimmo/cloudflare-cli.nixnow strips non-runtime workspacedevDependenciesandpkg.pr.newpreview URLs beforepnpm2nixlockfile parsing (069e5ec), and runs a guarded GitLab CIupdate-upstreampipeline (ci/update.sh) on daily schedule (23 4 * * *UTC) with a project-lockednix-docker-x86_64runner and job-token repository push enabled.#14onnimmo/cloudflare-cli.nixvalidated and publishedchore: update cf to v1.0.0-beta.18(af63ae5447d204f63c9a6a2fb447bcea39f77d14) automatically.modules/profiles/cloudflare-cli/,scripts/update-cloudflare-cli-release.sh,tests/cloudflare-cli-release-regressions.sh, and thecloudflare-cli-release/cloudflare-cli-source/pnpm2nixinputs with the singlecloudflare-cliinput locked ataf63ae5447d204f63c9a6a2fb447bcea39f77d14.Validation
./tests/nixos-update-remediation-regressions.shand./tests/nixos-pin-lifecycle-regressions.sh(includingtests/nixos-pin-lifecycle-integration.py): passnix build .#nixosConfigurations.electra.pkgs.dwarf-fortress-fullatf20cd90e28fe0403873f473b29e42662cd86e8c4:/nix/store/jsaf1pqwv2nqsff4zmg7hrh7xl85zap9-dwarf-fortress-full-53.16nix flake checkonnimmo/cloudflare-cli.nix(GitLab pipelines#13and#14, includingcf-updater-regressions,tests/update-job.py, Sharp native image check, and local Miniflare Worker smoke test on1.0.0-beta.18): passnix flake checkonnimmo/nixos-configatd93eb57adee8d837d3c867aaea864dae81c83533and Forgejo CIattic-cache.yml(run#1338) +ai-review.yml(run#1337, verdictReady to mergewith 0 findings): passAutomated code review
Reviewed commit:
41cda57595d91df9dfd709274fa0aebaec672f73Verdict: Requires further work
Resolve the blocking or important findings and investigate failed deterministic checks before merging.
Overall assessment
Two independent changes were reviewed. (1) The manually approved DFHack GCC 15 compatibility pin is reversed by hand (overlay entry in modules/common/nix-settings.nix, the packages/dwarf-fortress-full/default.nix overlay target, the pin JSON/reverse-patch pair, and the README note), and publish_removal() in scripts/nixos-pin-lifecycle.py is widened so tracked paths deleted when reversing a forward pin patch that created a file (porcelain ' D ') are accepted and staged with git add -A; tests/nixos-pin-lifecycle-integration.py adds a created-file fixture for that case. (2) The in-tree cf CLI packaging, its release-resolution adapter, its regression test and the coupled cloudflare-cli-release/cloudflare-cli-source/pnpm2nix root inputs are replaced by a single cloudflare-cli git input; modules/profiles/ai-agents.nix now consumes inputs.cloudflare-cli.packages..default, and flake.nix re-exports the external smoke check. I traced the affected callers: modules/profiles/gaming.nix still resolves dwarf-fortress-full through pkgs (all hosts are x86_64-linux, so the system-indexed lookup in ai-agents.nix is not a defect), lib/auto-update-policy.nix groups and the generated rootInputs in flake.nix are mutually consistent with the new single input (no group names a removed input, and no root input is left unclassified), and no stale references to the deleted scripts, tests, inputs or packaging internals remain anywhere in the checked-out tree (only flake.lock's now-transitive cloudflare-cli-source/pnpm2nix nodes). tests/nixos-pin-lifecycle-regressions.sh guards remediation/pins with [ -d ... ], so the now-empty pin directory does not break it, and the widened classifier matches the extended fixture. Two gaps remain: the pin reversal has no build-level evidence, which its own removalCondition and the lifecycle controller require, and the widened classifier is asymmetric for the mirror case (a forward patch that deleted a file).
Blocking findings
None.
Important findings
The deleted pin record states removalCondition: "A fresh nixpkgs candidate builds every affected host and passes flake checks after reverse application removes the DFHack GCC 15 override." and rationale: "DFHack 53.16-r1.1 rejects GCC 16.2.0 ... Full candidate fleet build and deployment remain pending". scripts/nixos-pin-lifecycle.py only publishes a removal after
succeeded = all(item.returncode == 0 for item in builds) and checks.returncode == 0(line 495), i.e. host builds plus flake checks; docs/auto-update-remediation.md:137 says manually approved compatibility pins use the same contract so "the scheduled lifecycle job retests them and can prepare the same review-only removal PR", and .forgejo/workflows/attic-cache.yml:597 restricts that job togithub.event_name == 'schedule' || github.event_name == 'workflow_dispatch'while the host-building job is gated byif: ${{ github.event_name != 'pull_request' }}(line 169). The supplied diff reverses the pin directly in a pull request and does not change flake.lock's nixpkgs node (locked rev 8edc0c72e3a38faf5434e40d1f19431125fe4b30, neither the pin's brokenRevision b6c8664d... nor its lastKnownGood f45c6f04...), so no build result for the affected hosts (electra, lena, vega, lyra) is present in the supplied material. dwarf-fortress-full is consumed only through modules/profiles/gaming.nix:20 underwith pkgs;, i.e. it is realised at build time, not at evaluation.Impact: Removing the overlay drops the
dwarf-fortress-full = import ../../packages/dwarf-fortress-fulloverride, so the package now resolves to whatever nixpkgs supplies at the currently locked revision. If upstream has not adopted a compiler default that DFHack 53.16-r1.1 accepts, evaluation andnix flake checkstay green and the failure surfaces only as a failed Electra (and any other gaming-profile host) build after merge - re-opening issue #262 and blocking the pull-only auto-update hosts.Suggested fix: Supply the build-level evidence the pin record itself requires before merging: build the affected hosts' toplevels (at minimum Electra's igpu/dgpu specialisations, which carry the DFHack closure) at the nixpkgs lock being merged, and record the result on the MR; or let the scheduled pin-lifecycle job publish its review-only removal PR instead of reversing the pin in this change.
Suggestions
The new classifier accepts only
" M "/" D "into actual_model_paths and"D "into actual_removed_paths; every other porcelain form falls through toelse: raise LifecycleError("removal candidate contains files beyond the bound pin")(line 393). scripts/nixos_update_remediation/validation.py:36-56 derives modelPatch paths fromgit apply --recount --numstat, which reports a file deletion as0\tN\t<path>(only binary hunks print-), so a pin patch may legitimately delete a tracked file. Reversing such a patch recreates the file in the working tree only, whichgit status --porcelainreports as?? <path>, so the widened check still fails closed for that mirror case while it now succeeds for the created-file case exercised by the new fixture in tests/nixos-pin-lifecycle-integration.py.Impact: Asymmetric support: a bound pin whose forward patch removed a file can never be auto-removed, and the scheduled lifecycle job aborts with 'removal candidate contains files beyond the bound pin' instead of producing the review-only removal PR. The current tree contains no such pin, so this is latent rather than an observed failure.
Suggested fix: Accept
?? <path>for a path listed in metadata["modelPatch"]["paths"] into actual_model_paths (the followinggit add -A -- <paths>already stages it), or state in docs/auto-update-remediation.md that pin patches never delete files so the fail-closed branch is intentional.Tests and validation
Questions
packages.x86_64-linux.defaultandchecks.x86_64-linux.smoke? flake.nix re-exports that single smoke check as the fleet's cf CLI gate, and the removed in-tree smoke.cjs (sharp native addon plus a local Miniflare Worker) is no longer exercised here.latest), which previously applied to host builds as well as checks?Review limitations
packages.x86_64-linux.defaultandchecks.x86_64-linux.smokeattribute names, its smoke-check coverage, and its release-metadata guard could not be verified.pkgs.dwarf-fortress-fullresolves without the overlay or that its bundled DFHack now uses a compiler default that 53.16-r1.1 accepts.as_user()in scripts/attic-cache-build.sh is the hook it calls and could not confirm that from the supplied files.nix flakerun.Diff coverage
.forgejo/workflows/attic-cache.yml: reviewed — included in a context-limited batchREADME.md: reviewed — included in a context-limited batchflake.lock: reviewed — included in a context-limited batchflake.nix: reviewed — included in a context-limited batchlib/auto-update-policy.nix: reviewed — included in a context-limited batchmodules/common/nix-settings.nix: reviewed — included in a context-limited batchmodules/profiles/ai-agents.nix: reviewed — included in a context-limited batchmodules/profiles/cloudflare-cli/default.nix: reviewed — included in a context-limited batchmodules/profiles/cloudflare-cli/smoke.cjs: reviewed — included in a context-limited batchpackages/dwarf-fortress-full/default.nix: reviewed — included in a context-limited batchremediation/pins/6a04b2c6e4fae9c31d686b5a1cd5e1ec50f944dfdd3e2bc495309fb6cf212f49.json: reviewed — included in a context-limited batchremediation/pins/6a04b2c6e4fae9c31d686b5a1cd5e1ec50f944dfdd3e2bc495309fb6cf212f49.remove.patch: reviewed — included in a context-limited batchscripts/attic-cache-build.sh: reviewed — included in a context-limited batchscripts/nixos-pin-lifecycle.py: reviewed — included in a context-limited batchscripts/update-cloudflare-cli-release.sh: reviewed — included in a context-limited batchtests/cloudflare-cli-release-regressions.sh: reviewed — included in a context-limited batchtests/nixos-pin-lifecycle-integration.py: reviewed — included in a context-limited batchReview metadata
Response to Automated Review (commit
41cda57595d91df9dfd709274fa0aebaec672f73)Implemented in follow-up commit
d93eb57adee8d837d3c867aaea864dae81c83533:Important finding — DFHack pin removal &
nixpkgslock coupling (modules/common/nix-settings.nix/flake.lock):nixpkgsrevision (8edc0c72e3a38faf5434e40d1f19431125fe4b30),pkgs/games/dwarf-fortress/default.nixstill defaultedgccStdenvto GCC 16.2.0, which failed to builddfhack-53.16-r1.1without the overlay pin. Conversely, upstreamnixpkgs(f20cd90e28fe0403873f473b29e42662cd86e8c4) fixeddfhackinternally to usegcc15Stdenvand removed thegccStdenvparameter, causing the pin'spkgs.dwarf-fortress-packages.override { gccStdenv = pkgs.gcc15Stdenv; }to fail evaluation (called with unexpected argument 'gccStdenv') and blockingmainfrom advancingnixpkgswhile the pin was present.flake.lock'snixpkgsinput tof20cd90e28fe0403873f473b29e42662cd86e8c4alongside the pin removal..#nixosConfigurations.electra.pkgs.dwarf-fortress-fullwithout the pin atf20cd90e28fe0403873f473b29e42662cd86e8c4->/nix/store/jsaf1pqwv2nqsff4zmg7hrh7xl85zap9-dwarf-fortress-full-53.16(including/nix/store/cfw8s0g0m9473v2m4gba19l9g2fpxpq4-dfhack-53.16-r1.1and/nix/store/pyxk76vnmgalkmkw7h3wcd0v0d801z3r-dwarf-therapist-42.1.21).#1334(job 5296 on Nova),scripts/nixos-pin-lifecycle.pyalso built all four affected host toplevels (.#nixosConfigurations.{electra,lena,lyra,vega}.config.system.build.toplevel) and passednix flake checkwith the pin reversed againstf20cd90e28fe0403873f473b29e42662cd86e8c4.Suggestion — Symmetric handling of recreated files in
publish_removal()(scripts/nixos-pin-lifecycle.py:382-391):publish_removal()to pass--untracked-files=alltogit status --porcelainand accept"?? "alongside" M "and" D "intoactual_model_paths. Extendedtests/nixos-pin-lifecycle-integration.pywith a deleted-file fixture (modules/services/leaf-app-legacy.nix) so modification, creation, and deletion reversals are all exercised.Answers to reviewer questions on
nimmo/cloudflare-cli.nix(af63ae5447d204f63c9a6a2fb447bcea39f77d14):packages.x86_64-linux.{default,cloudflare-cli}andchecks.x86_64-linux.{default,smoke,updater,update-job}.checks.x86_64-linux.smokeexecutes the samepackage/smoke.cjscheck (verifyingcf --version, loadingsharp, and booting a localworkerdWorker viaminiflare).package/default.nixretains the versioned tarball assertion (assert lib.hasInfix "/-/cf-${release.version}.tgz" release.tarballUrl;) on every package evaluation, andtests/updater.sh/tests/update-job.pyenforce it in GitLab CI (de.nimmog.ukpipelines#13and#14passed).Validation run on
d93eb57adee8d837d3c867aaea864dae81c83533:./tests/nixos-update-remediation-regressions.sh: passed./tests/nixos-pin-lifecycle-regressions.sh: passednix flake check: passed (all checks passed!)Automated code review
Reviewed commit:
d93eb57adee8d837d3c867aaea864dae81c83533Verdict: Ready to merge
No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory.
Overall assessment
Both halves of the change are internally consistent in the checked-out tree, and I found no defect attributable to the supplied diff. (1) DFHack pin removal: the three files named by the pin's reverse patch (the README note, packages/dwarf-fortress-full/default.nix, and the modules/common/nix-settings.nix overlay entry at the removed line) are deleted together; modules/profiles/gaming.nix:20 still names
dwarf-fortress-fullonly throughwith pkgs, so it now resolves from nixpkgs instead of the repository overlay, and a tree-wide search fordwarf-fortress/dfhack/gcc15returns no other reference.remediation/now contains only nova-policy.json and worker-prompt.md, so the[ -d "$ROOT/remediation/pins" ]guard in tests/nixos-pin-lifecycle-regressions.sh skips its per-pin reverse-patch proof, and scripts/nixos-pin-lifecycle.py:566 already guards withif (repo / PINS_DIRECTORY).is_dir() else []. (2) Cloudflare rework:cloudflare-cli-release,cloudflare-cli-sourceandpnpm2nixoccur nowhere outside flake.lock (they survive only as nodes re-bound under the newcloudflare-clinode at flake.lock:75/79, which is legitimate for subflake inputs); flake.nix removed the twoletbindings (lock,release) and the versioned-URL assertion together, and no remaining flake.nix text referenceslock.nodesorrelease.locked.scripts/update-cloudflare-cli-release.shandtests/cloudflare-cli-release-regressions.share deleted along with thechecks.x86_64-linux.cloudflare-cli-releasederivation that ran them, and no workflow, script, or test still names them. lib/auto-update-policy.nix now lists 23 groups whose inputs plus the singlepinnedentry (nixpkgs-sbomnix-176) exactly cover the 24 root inputs named at flake.nix:102-125, so the newcloudflare-cliinput is classified and nothing became unclassified; flake.nix:443 regeneratesrootInputsfrom the flake's argument set, so no second list drifted. Thehostslist for the cloudflare-cli group matches the four hosts that import modules/profiles/ai-desktop.nix (hosts/{electra,lena,vega,lyra}). (3) The publish_removal widening in scripts/nixos-pin-lifecycle.py is coherent with its fixture: reverse application of the new multi-path fixture patch yields??for the recreated modules/services/leaf-app-legacy.nix,Dfor the working-tree deletion of packages/leaf-app-pin/default.nix,Mfor the reverted leaf-app.nix, andDfor the twogit rm-ed pin files; the new classifier accepts exactly those five states, the count plus set comparisons still reject any path outside modelPatch.paths ∪ {metadataPath, removalPath}, andgit add -Astages the recreated file and the deletion.--untracked-files=allis required to see a single-entry recreated directory, and the fixture's expected diff-tree order matches git's byte-wise path sort ('-' 0x2D < '.' 0x2E, so leaf-app-legacy precedes leaf-app.nix). modelPatch.paths remains valid against the validator at scripts/nixos-pin-lifecycle.py:214-235 (non-empty, sorted, noremediation/pins/prefix), and the newgit(...)call form matches the helper at line 134.Blocking findings
None.
Important findings
None.
Suggestions
None.
Tests and validation
Questions
as_user()as a barecd "$REPO_ROOT"; "$@"passthrough, and a tree-wide search finds no remaining caller ofas_userin this checkout (the only occurrence is the definition). Please confirm from the pinned nixos-auto-update package (nixos-update-common.sh, sourced at attic-cache-build.sh:772) that it still invokesas_user; if it does not, the function is now unreachable in this repository.cloudflare-cligroup in lib/auto-update-policy.nix names only the outer input, while flake.lock:75/79 re-binds the subflake'scloudflare-cli-sourceandpnpm2nixnodes. Confirm from the pinned nixos-auto-update package that a singlenix flake update cloudflare-clirefreshes that whole subtree (the flake.lock diff bumpscloudflare-cli-sourceto rev 6fdb57383a… alongsidecloudflare-clirev af63ae5447…, which suggests it does); the updater package is not in this checkout, so the group adapter's behaviour cannot be inspected here.git apply --reverse --check) is now vacuous because remediation/pins/ no longer exists. Is that acceptable as-is, or is a fixture expected to keep that guard non-vacuous? The integration fixture in tests/nixos-pin-lifecycle-integration.py does cover the reversed-creation path end-to-end.Review limitations
nix flake check,nix flake eval, the two named test scripts, and thegit apply --reverse --checkproof were read, not run, so evaluation-time failures in the new flake attributes are not observable here.cloudflare-cli.packages.x86_64-linux.defaultandcloudflare-cli.checks.x86_64-linux.smoke(flake.nix:191-192) could not be confirmed to exist with those attribute names, nor could its smoke check be compared with the deleted in-tree modules/profiles/cloudflare-cli/smoke.cjs; likewise its input names (cloudflare-cli-source,pnpm2nix) implied by flake.lock:75/79 are unverified.pkgs.dwarf-fortress-fullwith the default compiler is taken from the diff's intent only; the nixpkgs tree is not in this checkout.Diff coverage
.forgejo/workflows/attic-cache.yml: reviewed — included in a context-limited batchREADME.md: reviewed — included in a context-limited batchflake.lock: reviewed — included in a context-limited batchflake.nix: reviewed — included in a context-limited batchlib/auto-update-policy.nix: reviewed — included in a context-limited batchmodules/common/nix-settings.nix: reviewed — included in a context-limited batchmodules/profiles/ai-agents.nix: reviewed — included in a context-limited batchmodules/profiles/cloudflare-cli/default.nix: reviewed — included in a context-limited batchmodules/profiles/cloudflare-cli/smoke.cjs: reviewed — included in a context-limited batchpackages/dwarf-fortress-full/default.nix: reviewed — included in a context-limited batchremediation/pins/6a04b2c6e4fae9c31d686b5a1cd5e1ec50f944dfdd3e2bc495309fb6cf212f49.json: reviewed — included in a context-limited batchremediation/pins/6a04b2c6e4fae9c31d686b5a1cd5e1ec50f944dfdd3e2bc495309fb6cf212f49.remove.patch: reviewed — included in a context-limited batchscripts/attic-cache-build.sh: reviewed — included in a context-limited batchscripts/nixos-pin-lifecycle.py: reviewed — included in a context-limited batchscripts/update-cloudflare-cli-release.sh: reviewed — included in a context-limited batchtests/cloudflare-cli-release-regressions.sh: reviewed — included in a context-limited batchtests/nixos-pin-lifecycle-integration.py: reviewed — included in a context-limited batchReview metadata
Answers to Informational Review Questions (commit
d93eb57adee8d837d3c867aaea864dae81c83533)as_user()inscripts/attic-cache-build.sh: Confirmed against.#nixos-auto-update(share/nixos-auto-update/nixos-update-common.shlines 118, 125, 203, 204, 208, 210, 236, 237, 243) —nixos-update-common.shinvokesas_userfornix eval,mktemp,cp, andnix flake update, so the hook definition inscripts/attic-cache-build.shremains required.nix flake update cloudflare-clisubtree refresh: Confirmed —nixos_update_input_group()callsas_user nix flake update "$input", which updates thecloudflare-cliroot node and refreshes its transitivecloudflare-cli-sourceandpnpm2nixlock nodes from the subflake's lockedflake.lock.tests/nixos-pin-lifecycle-regressions.shwhenremediation/pins/has no active pins: Intentional — the[ -d "$ROOT/remediation/pins" ]guard allows the production-pin check to be a no-op when no temporary pins are active onmain, whiletests/nixos-pin-lifecycle-integration.pyalways exercises the hermetic modification, creation, and deletion pin fixtures end-to-end.