flake-update-cascade: never prompt on foreign nixConfig, keep Ctrl-C working #151
No reviewers
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/tools!151
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/cascade-noninteractive"
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?
flake-update-cascadeno longer freezes when a repo's flake declares its own binary caches (nixConfig.extra-substituters): the nix question that used to block the whole run on the TTY is auto-declined and the cascade moves on, and Ctrl-C now actually interrupts a stuck update instead of being swallowed.The tool declines the foreign settings rather than adopting them; nothing changes for repos that declare no such settings — same commands, same 120-second bound, same commits and PRs — and declining is exactly what nix already did on its own whenever the cascade's output was piped.
Proof: a new regression test reproduces the freeze against the unfixed script (prompt shown, run killed at the bound) and shows the fixed script completing with the settings declined and the repo untouched; all existing cascade tests (20 assertions plus the multiple-inputs suite) still pass.
If this is wrong, revert the one commit: it touches only the three
nix flake updateinvocations in one script and adds one test file; no data or lock formats change.Mechanism
Two stacked defects, fixed identically at all three
nix flake updatesites:/dev/null. When nix wants to ask about untrusted flake configuration it reads stdin; with no stdin it declines and continues (warning: ignoring untrusted flake configuration setting 'extra-substituters') and the lock update still succeeds — verified on nix 2.31.5 with a fixture flake declaringextra-substitutersand a local path input (exit 0, lock updated).timeout --foregroundkeeps nix in the terminal's foreground process group so SIGINT reaches it, and the 120s timeout can actually fire.Rejected alternative: the issue suggested
--accept-flake-config. It also silences the prompt (verified on nix 2.24.14: succeeds without prompting and updates the lock), but it does so by adopting the foreign flake's nix configuration — third-party substituter URLs included — into every cascade run. For lock resolution nothing is lost by declining (inputs are fetched from their declared sources; substituters serve realized store paths), and auto-trusting third-party binary-cache configuration is the wrong posture for this stack (architecture principle 4).--no-accept-flake-configwas also tested and rejected: on prompting nix versions it still prompts, because explicit false and the default take the same code path.Risk
error: unexpected EOF reading a line, exit 1) instead of hanging — the cascade's existing per-repo failure path reports it and continues with the other repos; without a tty, 2.24 declines cleanly and the update succeeds. Current nix 2.31.5 declines cleanly with a tty or without. No tested nix version hangs and none adopts foreign config.timeout --foregroundno longer isolates nix in its own process group, so when the 120s timeout fires it signals nix itself but not helper processes nix may have spawned; a fetch helper could briefly outlive it. That is the documented cost of making SIGINT work at all.nix, util-linuxscript, andgiton PATH (all present on stack VMs) and costs about 17s, 15s of which is the deliberate arm-1 wedge bound.Validation
nixConfig.extra-substituters = [ "https://cache.example.invalid" ]and a local path input, no network needed): the unfixedtimeout 120 nix flake updateunder a pty with stdin held open printsdo you want to allow configuration setting 'extra-substituters' to be set to 'https://cache.example.invalid' (y/N)?and blocks until an outer bound kills it (exit 124), on both the system nix 2.31.5 and nix 2.24.14; on 2.31.5 an injected Ctrl-C is echoed (^C) and ignored.timeout --foreground 120 nix flake update ...plus an injected Ctrl-C at 2s yieldserror: interrupted by the userimmediately; plaintimeout 120ignores the same Ctrl-C until the outer bound kills the session.tests/flake/flake-update-cascade-nixconfig.sh(real nix, real fixture repo, pty viascript): arm 1 proves the fixture provokes the prompt on the running nix, so the test cannot rot into a vacuous pass; arm 2 runs the real cascade in--dry-runand asserts completion, the decline warning, and an unchanged repository lock. It passes against the fixed script (17s) and, run against the stashed unfixed script, fails as intended:FAIL: cascade did not complete (exit 124; 124 means it wedged at the prompt).timeoutconsumes--foregroundbefore the mock runs.bash -nand shellcheck 0.11.0 are clean on the edited script; the test file passesbash -n.Closes #143