Skip to content

rolloutPlan, fleet doctor, promoter, promote.yaml: four things that passed or ran without checking - #68

Open
Savid wants to merge 4 commits into
masterfrom
fail-loudly
Open

Savid wants to merge 4 commits into
masterfrom
fail-loudly

Conversation

@Savid

@Savid Savid commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Four places where something passed, or ran, without checking anything. Each is its own commit with a test that fails on the previous code.

  • lib.rolloutPlan: a class that can never fire stops evaluation. The promoter compares the fingerprint keys a class names, and reads a key that only one side has as unknown. So a class naming a key that no host's ethpandaops.fingerprint has (or that some hosts lack) never fires for those hosts, silently: a k3s minor upgrade soaks as a plain reboot, and the class's alone guard never runs. Evaluation now refuses such a class with the class, the key and the hosts that lack it. It also refuses a misspelt class attribute, and a class after the first that compares nothing. To list the keys without evaluating them, ethpandaops.fingerprint becomes lazyAttrsOf: with attrsOf, listing keys forced toplevel, a second evaluation of each host's system, and the example plan went from 0.6 to 2.2 GB to evaluate. It's back to 0.6 GB now. The fingerprint and the example server's system are unchanged apart from the revision in /etc/nixhost/modules.json.
  • fleet doctor: a deploy key that's a file on the host is compared, in --live. For deployKey = "file", the github section's deploy-key check passed with "--live compares it", but --live never compared it. Now --live reads the public half of the host's key over SSH (sudo ssh-keygen -y) and requires GitHub's comin <config> to be that key, read-only. The github section checks only sops keys, which it can read.
  • Promoter: a run that applies with no webhook stops before doing anything. With discord-webhook empty, the promoter moved hosts and only logged its notices, so a halt or a promotion reached nobody. A run with --apply and no webhook now fails first, the way refresh-keys already does; a dry run still needs none. discord-webhook stays optional in host-promote, so callers need no change.
  • Generated promote.yaml runs on a schedule only when ci.jobs.promote is on. With the job off, the schedule still started a plan job every 10 minutes just to say so. Now that workflow is dispatch-only. A fleet with the job off sees its promote.yaml change at its next fleet upgrade.

Tested

  • checks.rollout-plan: plans over stand-in hosts with and without a fleet's own key are refused when no host has the key, when one host lacks it, for a misspelt attribute, for a class with nothing to compare, and for an alone field no host has. They're accepted when every host has the key. The example plan still evaluates.
  • tests/fleet (checks.fleet-scripts), 4 new doctor cases: no file-mode check in the github section; --live passes the matching key, fails the key under another title or a writable key, and is unread when the host can't be reached.
  • Promoter tests, 2 new: a run that applies, with the webhook unset or empty, exits 1, posts nothing, saves no state and moves no branch; a dry run without one passes. ruff and all 99 tests pass.
  • checks.fleet-example renders and lints a promoter fleet with the job off and finds no schedule.
  • nix build of rollout-plan, fleet-example, fleet-scripts, formatting and workflows.

@redpandabot redpandabot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR makes four previously silent paths fail loudly: rolloutPlan now refuses classes that can never fire, fleet doctor compares file-mode deploy keys during --live, the promoter refuses an applying run without a Discord webhook, and generated promote.yaml drops its schedule when ci.jobs.promote is off. The accompanying tests and fixtures cover each case, and I found no concrete defect in the implementation or its callers.


Reviewed 21 changed file(s) @ c768986f — no blocking issues found.
Red pandas are famous zoo escape artists. Never trust a default-deny that hasn't been tested.

Savid added 4 commits December 1, 2026 08:09
classify compares the fingerprint keys a class names, and reads a key
only one side has as unknown, not changed. So a class naming a key no
host's fingerprint has, or that some hosts' lack, never fires for those
hosts, and nothing says so: a k3s minor upgrade soaks as a plain reboot,
and the class's `alone` guard never runs. The same goes for a misspelt
class attribute (`serie` for `series`) and for a class after the first
that compares nothing.

rolloutPlan now refuses each of these with the class, the key and the
hosts that lack it, and says to add the key to every host's fingerprint
(a fleet's module can) or drop it from the class. The header says that a
class's fields must be keys of every host's fingerprint.

ethpandaops.fingerprint's type becomes lazyAttrsOf. With attrsOf, listing
the keys forced every value, and `toplevel` is a second evaluation of the
whole system, so checking a plan's classes cost one more system
evaluation per host (this repository's example plan went from 0.6 to
2.2 GB and from 4 to 29 seconds). Keys are now listed without touching
the values, and the values the promoter reads are the same. A key defined
only under mkIf false now fails when it's read, instead of being absent.

Tested: checks.rollout-plan builds plans over stand-in hosts with and
without a fleet's own key. The plan is accepted when every host has the
key, and refused when no host has it, when one host lacks it, for a
misspelt attribute, for a class with nothing to compare, and for an
`alone` field no host has. The example plan, whose default classes name
only nixos-modules' own keys, still evaluates. Without the new assertion
the check fails.
…--live

For a host whose deploy key is a file on it (fleet.nix deployKey =
"file"), the github section's deploy-key check passed with "--live
compares it", and --live didn't compare it: nothing checked that the key
on GitHub is the host's.

Now the github section checks only sops keys, which it can read from the
repository. With --live, a file-mode host's check reads the public half
of its key over SSH (sudo ssh-keygen -y, so no private material leaves
the host) and requires GitHub's "comin <config>" to be that key and
read-only. A host it can't reach is unread, and a mismatch says how to
put the right key back under the right title.

Tested in tests/fleet: the github section has no file-mode check; --live
passes the matching key; it fails the key under another title and a
writable key; it fails as unread when the host can't be reached. All
four fail on the previous doctor.
…thing

With discord-webhook empty, the promoter moved hosts and only printed its
notices to the run's log: a halt, a promotion or a rollback reached
nobody, and the run passed. A webhook of the wrong form already stopped
the run; a missing one now does too, the way refresh-keys stops without
one. A dry run (no --apply) still needs none.

host-promote's discord-webhook description says so. It stays optional
for a dry run, so a caller needs no change; a fleet whose webhook secret
is unset finds out at its first run that applies, which fails before
moving anything.

Tested: a run that applies with the webhook unset or empty exits 1 with
the reason, posts nothing, saves no state and leaves the deploy branch
where it was; a dry run without one passes. The first case fails on the
previous promoter. ruff and the promoter's 99 tests pass.
With ci.jobs.promote = false, the generated promote.yaml still ran every
10 minutes, and each run only started a plan job to say the promoter is
off: 144 idle runs a day on the fleet's runners. Now the schedule is
there only when the job is on, and the header says the workflow runs by
dispatch only otherwise. Dispatch works either way. The header also says
that a run that applies fails without CI_WEBHOOK.

A fleet with the job off sees its promote.yaml change at its next
fleet upgrade; checks.workflows asks for that run after the bump, as it
does for any change to what's generated.

Tested: checks.fleet-example renders and lints a promoter fleet with the
job off; its promote.yaml has workflow_dispatch and no schedule, while the
default one keeps it. Without this change the check fails.

@redpandabot redpandabot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Four loud-failure changes: rolloutPlan refuses classes whose fingerprint keys hosts lack, fleet doctor compares file-mode deploy keys over SSH in --live, the promoter fails an applying run with no webhook, and promote.yaml drops its schedule when ci.jobs.promote is off. I traced the doctor's key comparison (including the null deployKeyFile/title/read-only paths), the promoter's early-return ordering, and the rendered YAML indentation, and found no defect there; one concern with the fingerprint option's type change, plus a stale option description.

Issues

  • 🟡 modules/fingerprint.nix:22 — lazyAttrsOf makes a conditionally-defined fingerprint key present but unreadable — see the thread on that line
  • 🟢 lib/fleet/files.nix:439 — ci.jobs description contradicts promote's dispatch-only behaviour — lib/fleet/schema.nix:238 still says a job that's off "still runs its plan job, which says why", but with ci.jobs.promote = false this change makes the generated workflow dispatch-only, so no plan job runs at all. Worth updating the description with the same change.

Reviewed @ 9a0f6144
Red pandas are famous zoo escape artists. Never trust a default-deny that hasn't been tested.

Comment thread modules/fingerprint.nix
type = lib.types.attrsOf lib.types.unspecified;
# Lazy: listing the keys (lib.rolloutPlan checks every class's) mustn't
# evaluate toplevel, a second evaluation of the whole system.
type = lib.types.lazyAttrsOf lib.types.unspecified;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 lazyAttrsOf makes a conditionally-defined fingerprint key present but unreadable

lazyAttrsOf does not drop mkIf false attributes (nixpkgs' lib/types.nix at the locked rev): attrNames lists them while reading the value throws, because types.unspecified has no emptyValue. A fleet adding a key as ethpandaops.fingerprint.k3sVersion = lib.mkIf … therefore looks like every host has the key, so the new classProblems check accepts the class, and the failure surfaces later in the promoter's nix eval --json of the fingerprint (breaking the nix eval … .fingerprint documented at the top of this file) instead of being refused up front.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant