Repository navigation
fix(boxes,minimal,minimald): a newer box-state format is refused before any write, with a message - #3850
Conversation
DiskLoader::new now reads and checks sessions/index.json before it creates dirs, tightens modes, self-heals or flushes. The refusal is a typed NewerStateFormat error that names the state dir and the next step.
In the microVM the daemon sends STATE_REFUSED in place of READY and parks. A native daemon, detached or not, prints the refusal and exits non-zero.
Parse STATE_REFUSED beside MOUNT_FAILED, kill the guest, keep the data volume, and report the refusal with the volume path in place of the generic supervisor text.
min prints the refusal from minvmd or the native minimald as it is, with no retry advice. Spec 08 records the STATE_REFUSED beacon.
|
Important Review skippedBot user detected. Ask an organization administrator to verify that this bot has an active assigned CodeRabbit review seat. See the seat-assignment guide. After the seat is confirmed, request a review again.
|
Spec lint
Advisory. None of this blocks the merge; the review decides. Advisory, and never a merge gate. Linter: |
|
Approved: no findings at Nothing to do. Verdict APPROVE, posted as a comment: the App cannot review its own pull request; the check and the label carry it. Clobber: none seen. |
|
/arch-review |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The change conforms. The box store, the guest and the host refuse a newer box-state format before any write to the box store. The refusal names both versions, as the version-skew line in architecture.md (line 589) requires for a peer outside the window. minvmd keeps the data volume on a state refusal. That is the safe side, and no check moves across the guest and host boundary. The summary lists two message points for the code review. CI must still run the min test that failed on a full disk.
Ruled at e3b0aa9 against gominimal/arch@4f2eb87d5d12 by claude-opus-5-5.
#3850 makes the daemon refuse a newer box-state format before it changes anything, and min prints the reason. Refs gominimal/inbox#1330. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016CYvTvep9ZaSf5pJMB2hQA
…e, and how to go back (gominimal#3844) * docs(install): say how to copy box state before the 0.7 to 0.8 upgrade, and how to go back The install guide gains a 0.7 to 0.8 section: what changes, how to copy the box state before the upgrade (sparse-safe on macOS and Linux), and how to put the copy back and reinstall 0.7. Boxes made on 0.8 are lost on the way back. Refs gominimal/inbox#1330. BREAKING CHANGE: 0.7 cannot read the box state that 0.8 writes. Copy the state directory before the upgrade to keep the way back to 0.7; the install guide's "Upgrade from 0.7 to 0.8" section has the steps. BREAKING CHANGE: a box without a chosen name takes `<project>`, or `<project>-<entry>` for an entry other than the default, with `-<n>` added when a box already has that name. A name given with `--name` or `[box] name` is kept exactly, and a create under it is refused while any box on the host has it, in any state. BREAKING CHANGE: environment variables are set in `env_vars` in every layer of minimal.toml and in loadout files. A file that sets `vars` or `vars_lenient` fails with exit code 3, naming the file and the key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016CYvTvep9ZaSf5pJMB2hQA * docs(install): name the min init scaffold's session entry among the 0.8 changes Refs gominimal/inbox#1330. The scaffold change is gominimal#3829's. BREAKING CHANGE: `min init` writes the session entry as `[sessions.default]`, holding the session's packages, and writes no `[boxes]` or `[defaults]` table. A first `min session start` with no entry name starts `default`, and the box takes the project name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016CYvTvep9ZaSf5pJMB2hQA * docs(install): say that the installer copies the box state itself on a 0.7 upgrade Refs gominimal/inbox#1330 and gominimal#3845, which makes the installer copy. The way back names the copy by its path, which the installer prints. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016CYvTvep9ZaSf5pJMB2hQA * docs(install): clear the prose-lint alerts in the install guide just lint-prose docs/guide/install.md now reports no alerts. The lines the upgrade section added and the older lines in the file both change: no semicolons, no 'for example', the Verify headings become 'Check the install', and the uninstall flags are a list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016CYvTvep9ZaSf5pJMB2hQA * docs(install): say that 0.8 stops on box state from a newer release gominimal#3850 makes the daemon refuse a newer box-state format before it changes anything, and min prints the reason. Refs gominimal/inbox#1330. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016CYvTvep9ZaSf5pJMB2hQA * docs(install): fix the 0.7 to 0.8 section's review findings - A box stays until min box rm or min box prune removes it (arch C1). - The intro says that the installer makes the copy, so no reader makes a second one by hand. - vars_lenient entries move into env_vars as NAME = "value" rows. Only vars is a rename, and only box tables and loadout files refuse them. - The hand copy goes to another disk after a short-space stop, and runs only into a path that does not exist yet. - The state directory honours XDG_STATE_HOME only when it is absolute, as the runtime does. - The way back moves nothing when the aside path exists, and names the 0.7 version to reinstall as a placeholder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016CYvTvep9ZaSf5pJMB2hQA * docs(install): copy through a symlinked state directory, and gate the rollback install The hand copy resolves the state directory with cd -P and copies what it holds into a new directory, so a state directory that is a symbolic link to another disk is copied, not only the link. The way back prints restored when both moves work, installs 0.7 only after that, and says how to put the 0.8 state back when the second move fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016CYvTvep9ZaSf5pJMB2hQA * docs(install): refuse an empty copy source, and recover from a partial restore move When the state directory does not resolve, source is empty, so the ready check now needs it set before the copy runs (arch advisory). A second restore move that fails partway can leave part of the copy at the state path; the recovery removes that part only while both the 0.8 state and the copy are still in place, then puts the 0.8 state back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016CYvTvep9ZaSf5pJMB2hQA * docs(install): make the way back to 0.7 delete nothing The recovery step could run rm -rf on the live 0.8 state when the move aside had not run. The way back is now three steps, none of which deletes the 0.8 state or the copy: - rename the 0.8 state to $state.0.8 in its own directory, only when the copy exists and that name is free; - copy the 0.7 state into $state.restore and rename it into place, so a failed copy leaves only $state.restore, never a partial state; - install 0.7 only after the restore printed restored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016CYvTvep9ZaSf5pJMB2hQA * docs(install): let the installer's own refusal give the steps back to 0.7 The guide's hand-written restore drew a new edge case at each review: a symlinked state, a full disk, a leftover restore directory. gominimal#3848's installer already refuses 0.7 over 0.8 state and prints the stop, the move aside to a free name, and the rename of the newest copy beside the state directory. The guide now has the reader put a hand copy beside the state directory as a new directory, run the 0.7 install, and follow the commands it prints. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016CYvTvep9ZaSf5pJMB2hQA * docs(install): run only the installer's combined restore line, and say how to make room The R2.6 refusal prints a standalone mv and then the line that moves the 0.8 state aside and the copy into place. Running both leaves the copy where it is, so step 3 now names the stop commands and the last line only (arch note). A hand copy that runs out of space is retried after moving unneeded files off the disk, never by deleting the 0.8 state or the copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016CYvTvep9ZaSf5pJMB2hQA * docs(install): note the 0.7 version before the upgrade, and check which copy the restore names The way back reinstalls the 0.7 version, which min --version no longer shows after the upgrade, so the guide asks for it first and says that an installer copy's name ends with it. The installer's restore line names the newest copy by modification time, which can be an installer copy in place of a hand copy, so the reader checks the line and puts in the copy they mean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016CYvTvep9ZaSf5pJMB2hQA --------- Co-authored-by: Karl Godard <karl@minimal.dev> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Follow-up
Fixes #3843
crates/boxes/src/store.rscrates/minimald/src/guest.rscrates/minimald/src/main.rscrates/minvmd/src/cmd/mod.rscrates/minvmd/src/cmd/run.rscrates/minvmd/src/cmd/boot.rscrates/minimal/src/autospawn.rsdocs/specs/08-spec-vm-ext4-volume/08-spec-vm-ext4-volume.mdTask marker
Proof
When min meets sessions/index.json with format_version 2, it prints the refusal as its error and exits non-zero. The refusal reads: "A newer min wrote the box state in . That state has format version 2. This min reads format version 1 or older, and it changed nothing. Install the newer min, then run your command again." In the VM, the line ends with "That state is on the data volume ." The store reads and checks the index before it writes anything. A test confirms that the state tree keeps the same bytes, entries and modes after the refusal, including a 0755 dir that the open usually tightens and an orphan dir that self-heal usually indexes.
Notes from the agent: The task gave no exact refusal text. I wrote it, and boxes::store::tests::newer_state_format_refusal_text_is_pinned pins it. Its next step ("Install the newer min") names no command, because min has no upgrade command. The refusal is a typed boxes::store::NewerStateFormat error inside an io::Error, and NEWER_STATE_FORMAT_LEAD finds it in text. I replaced the old store test index_with_newer_format_version_is_refused_with_a_clear_error with store_refuses_a_newer_format_and_changes_nothing. minimald checks the state before it creates any dir. It also checks in the parent of
run --detach, because the detached child's stderr is /dev/null. A native daemon prints the text alone (not the Debug form of MainError) and exits 1. In the VM, the guest's refusal names /var/lib/minimal, and minvmd adds the data volume path on the host. minvmd keeps the volume on a state refusal in both boot paths. The detach_failure_message test (detach_failure_names_quarantine_unreadable) now also checks the state-refusal case. This box has no libkrun, so the minvmd_libkrun code in boot.rs and run.rs does not compile in a normal build. A cargo check with RUSTFLAGS=--cfg minvmd_libkrun in a separate target dir type-checks it with no errors. No VM e2e ran. just lint-prose did not run because vale is not installed here.Tests
cargo test -p boxes store_refuses_a_newer_format_and_changes_nothingcargo test -p boxes refusalcargo test -p minimald state_refused_beacon_is_two_lines_flattened_and_cappedcargo test -p minvmd read_ready_beacon_parses_state_refusedcargo test -p minimal boot_failure_error_for_a_state_refusalVerify
min task run agent-verifyexited 101 under rustc 1.100.0, which the repository does not pin (1.99.1 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.