Skip to content

Lint/CI gates, panic hardening, activate.profile, nullable schema#381

Merged
jagajaga merged 6 commits into
masterfrom
improve/lint-reliability-profile
Jun 16, 2026
Merged

Lint/CI gates, panic hardening, activate.profile, nullable schema#381
jagajaga merged 6 commits into
masterfrom
improve/lint-reliability-profile

Conversation

@jagajaga

@jagajaga jagajaga commented Jun 16, 2026

Copy link
Copy Markdown
Member

A batch of small, non-breaking improvements. The public surface — deploy-rs.lib.<system>.activate.*, the interface.json config schema, the deploy CLI flags, and the deployactivate protocol — is unchanged.

Commits

  1. chore: clippy lints + clippy/rustfmt/reuse checks — resolves all clippy warnings, annotates the genuinely-many-arg functions with #[allow], and adds three lint derivations to the flake checks (so they run in CI). The reuse check caught two pre-existing files missing SPDX headers (src/command.rs, .github/workflows/check.yml) — fixed.
  2. docs: example off deprecated setActivateexamples/simple now uses activate.custom (the alias stays for back-compat).
  3. fix: avoid panics in the deploy waiter and flake-target parser — the magic-rollback waiter unwrap()ped a oneshot RecvError (a successful activation finishing before the wait command returned would panic); now handled as success. The rnix fragment parser unwrap()ped AST nodes; malformed targets now return ParseFlakeError instead of panicking.
  4. feat: activate.profile — a new additive activator that installs the closure into the target's nix3 nix profile (idempotent: replaces a previous generation of the same name). Existing activators untouched.
  5. feat: nullable optional fields in interface.json — widens the schema so optional settings may be null (backward-compatible; also future-proofs a module-system consumer that emits explicit null defaults).

Verification

Run in a nixos/nix (aarch64) container against a toy multi-node flake:

  • nix build .#checks.<sys>.{clippy,rustfmt,reuse,deploy-rs} → all pass
  • magic-rollback deploy → Deployment confirmed. (confirms the waiter fix doesn't regress the rollback path)
  • activate.profile → installs + runs a package, idempotent on re-deploy
  • deploy with schema checks and fastConnection = null → passes (exercises the nullable schema end-to-end)

jagajaga added 5 commits June 16, 2026 02:13
Resolve all clippy warnings (io::Error::other, redundant field names,
needless borrows, redundant closures) and annotate the few functions
that legitimately take many arguments with #[allow(clippy::too_many_arguments)].

Add `clippy`, `rustfmt` and `reuse` derivations to the flake checks so
they run in CI alongside the existing build. The reuse check surfaced two
files missing SPDX headers (src/command.rs and the CI workflow); add them.
The activation waiter unwrapped oneshot channel results: a successful
activation that finished before the wait command returned would resolve
recv_activate with a RecvError and panic. Handle that case as success,
and ignore send errors when the receiver is already gone.

The flake-fragment parser unwrapped rnix AST nodes; malformed targets
could panic instead of returning ParseFlakeError. Propagate the error.
A new activator alongside custom/nixos/home-manager/darwin/noop that
installs the closure into the target user's `nix profile`, replacing a
previous generation of the same name. The existing lib API is unchanged.
Comment thread flake.nix
# into the calling user's `nix profile`, replacing a previous
# generation with the same name. Useful for declaratively rolling
# out a package (or a `buildEnv`) to a machine.
profile = base: custom base ''

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would be nice to mention this activator in the README.

@jagajaga jagajaga merged commit 6d3087e into master Jun 16, 2026
13 checks passed
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.

2 participants