Skip to content

feat: the binary runs every slot; mayfly.sh and the engine switch are gone - #42

Merged
Variiuz merged 3 commits into
mainfrom
feat/nifty-hawking-q2a2q0
Nov 11, 2026
Merged

Variiuz merged 3 commits into
mainfrom
feat/nifty-hawking-q2a2q0

Conversation

@Variiuz

@Variiuz Variiuz commented Nov 11, 2026

Copy link
Copy Markdown
Owner

What changes

One slot loop. Every slot kind has had a Rust loop since 0.7.0, chosen with engine= or SLOT_ENGINE. It is now the only loop.

  • mayfly.sh, the forwarding to it and the switch are removed.
  • engine= in slots.conf and SLOT_ENGINE in pool.env do nothing; mayfly check lists them until they are removed.
  • mayfly status has no ENGINE column.
  • An unknown command prints the help and fails (exit 1; exit 2 with no command), as the script did.

Running slots take an update by themselves. A slot loop is one long process, so until now it kept its old code until its unit was restarted, although mayfly update said "running slots use it from their next job". Between two guests the loop now checks whether the installed command was replaced and, if so, hands over to it in the same process. A VM or container slot does this after its job, a pod slot when its VM is recycled. No job is cancelled.

Migration from 0.9.0 or earlier. Loops of those versions cannot hand over. mayfly install over such an install (it finds mayfly.sh in the share directory) removes the script and restarts the running slots once with systemctl restart --no-block. A restart drains: an idle guest is replaced, a job in progress finishes first. mayfly update --rollback restores the script with the old version.

Release plumbing. install.sh, scripts/package.sh and CI read the version from Cargo.toml and recognise a release by mayfly-slot@.service. release-please no longer stamps mayfly.sh. mayfly install installs only curl (the script needed jq and openssl).

This is not marked breaking: nothing has to be done on a host, and a breaking marker would stop mayfly update --auto from ever installing it or any later release.

The first commit restructures the README (tables, numbered steps, a Commands section) without changing what it says.

Tests

tests/run.sh and tests/parity.sh compared the binary with the script and go with it.

  • tests/e2e.sh (new) runs the built binary through a slot of each kind against stub commands and compares every call, file, GitHub request and log line with tests/golden/. The recordings for vm, lxc and pod were made from the bash loop before it was removed, and the binary matches them. It also covers the hand-over to a newer command for a vm and a pod slot.
  • tests/slot.rs: five new tests for the hand-over; the routing tests are replaced by tests that every kind runs the loop whatever the old settings say.
  • tests/cli.rs: the script is removed on install, running slots are restarted once and only once, a slot that cannot be restarted is named, unknown commands, the new check warnings.
  • tests/shipped.rs (new) keeps the two checks of run.sh that were about shipped files: pool.env.example is plain KEY=value, and provision.sh exports both template.env files.

Run locally: cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test (284 passed), bash tests/e2e.sh (6/6), shellcheck, and tests/update.sh with a build stamped 0.10.0: the real 0.9.0 and 0.4.1 releases update to it and roll back (15/15 each). Before deleting it, tests/parity.sh was 58/58 identical.

Not tested: a real Proxmox host.


Generated by Claude Code

The README gets a Commands section, command and option tables, numbered
steps for the engine switch, NAT hosts and updates, and a Development
section for releases and tests. No behavior is described differently.

pool.env.example lists the vm-stuck hook; pve-on-debian.sh names the
README section as it is called.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GGBbe73cn8jLtTaF9GtkTU
… gone

Every slot kind has had a Rust loop since 0.7.0, chosen with engine= or
SLOT_ENGINE. That loop is now the only one. mayfly.sh, the forwarding to
it and the switch are removed; engine= and SLOT_ENGINE are ignored and
`mayfly check` lists them. `mayfly status` has no ENGINE column.

A running slot now takes an update by itself: between two guests the loop
looks whether the installed command was replaced and, if so, hands over to
it in the same process. Before, a loop kept its old code until the unit
was restarted, whatever the update said.

Loops of 0.9.0 and earlier cannot do that, so `mayfly install` over such
an install (it finds mayfly.sh) removes the script and restarts the
running slots once. A restart drains: a job in progress finishes first.

install.sh, package.sh and CI read the version from Cargo.toml and find a
release by mayfly-slot@.service. `mayfly install` only installs curl.
An unknown command prints the help and fails, as the script did.

Tests: tests/run.sh and tests/parity.sh compared against the script and go
with it. tests/e2e.sh runs the built binary through a slot of each kind
against stubs and compares with tests/golden/, recorded from the bash
loop before it was removed, and covers the hand-over to a newer command.
tests/shipped.rs keeps the checks of the example files and provision.sh.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GGBbe73cn8jLtTaF9GtkTU
The recordings in tests/golden/ carried the name of the machine they were
made on (in the pvesh calls), so the suite failed everywhere else. A
hostname stub answers pve1; the recordings change in that name only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GGBbe73cn8jLtTaF9GtkTU
@Variiuz
Variiuz merged commit 3da6cce into main Nov 11, 2026
1 check 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