Skip to content

Fleet: group per-host previews by what the operator would approve (a pure function) #678

Open

Description

@vladimirrott

#617's design rule "plan per distro class, approve per preview class" needs one piece that has no daemon dependency: given each host's preview, put the hosts whose previews are the same approval into one group, and show every split.

The input types exist: PreviewEnvelope (crates/sysknife-types/src/lib.rs:573) and the CLI's PreparedPreview { transaction_id, preview } (apps/sysknife-cli/src/client.rs:45). proposed_change carries {action, params} with params redacted, plus the autoremove set and deployment identity where they apply (crates/sysknife-daemon/src/dispatcher.rs:2436-2472).

Scope

Traps

  • Do not key on request_hash or transaction_id. Both differ per host by design, and fix(security): key request_hash with an HMAC under the audit key (chain_version 4) #627 (223e86e) made request_hash an HMAC under each host's own audit key, so keying on it would put every host in its own group.
  • Do not key on current_state: it describes the host, not the change.
  • proposed_change can differ legitimately (a different autoremove set on one host). That split is correct and must be shown, never merged away.

Tests first

  • Two previews identical except request_hash and transaction_id form one group.
  • Two previews with different autoremove sets form two groups.
  • Reordered warnings still group together.
  • Empty input is refused.
  • Add request_hash to the key and the first test must go red.

Difficulty

medium: a pure function over existing types, but choosing the key is the whole job.

Getting started

CONTRIBUTING.md has the build and test commands. No CLA and no copyright waiver. The project is MIT; sign off each commit with git commit -s (the required dco check enforces it since #732).

Activity

  1. added
    enhancementNew feature or request
    help wantedExtra attention is needed
    mediumDifficulty: needs familiarity with one subsystem
    on Oct 26, 2026
  2. vladimirrott commented on Oct 26, 2026

    @vladimirrott
    MemberAuthor

    @Georgefifth, if you want this one, it's yours. Your #627 is what makes request_hash differ per host, so you know better than anyone why this grouping must not key on it. It's a pure function over PreviewEnvelope with no daemon in the loop.

    Say so here and I'll assign it to you. No pressure either way.

  3. vladimirrott commented on Oct 26, 2026

    @vladimirrott
    MemberAuthor

    Line numbers moved after #626 merged today. I updated the anchors in the body; the code they point at is unchanged:

    • apps/sysknife-cli/src/client.rs:44 → :45
    • crates/sysknife-daemon/src/dispatcher.rs:2356-2392 → :2364-2400
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is neededmediumDifficulty: needs familiarity with one subsystem

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions