8000 fix(boxes,minimal,minimald): a newer box-state format is refused before any write, with a message by minimal-foundry[bot] · Pull Request #3850 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(boxes,minimal,minimald): a newer box-state format is refused before any write, with a message - #3850

Merged
mitodrummer merged 4 commits into
mainfrom
agent/3843-a-newer-box-state-format-is-refused-before-any-w
Nov 27, 2026
Merged

mitodrummer merged 4 commits into
mainfrom
agent/3843-a-newer-box-state-format-is-refused-before-any-w

Conversation

@minimal-foundry
Copy link
Copy Markdown
Contributor

Follow-up

Fixes #3843

  • Epic: none; not charged to an epic
  • Size: M; estimated 180 code, 160 tests
  • May touch:
    • crates/boxes/src/store.rs
    • crates/minimald/src/guest.rs
    • crates/minimald/src/main.rs
    • crates/minvmd/src/cmd/mod.rs
    • crates/minvmd/src/cmd/run.rs
    • crates/minvmd/src/cmd/boot.rs
    • crates/minimal/src/autospawn.rs
    • docs/specs/08-spec-vm-ext4-volume/08-spec-vm-ext4-volume.md
Task marker
### D3842 — A newer box-state format is refused before any write, with a message that names the next step, and min shows it on the host
  kind: task
  size: M
  est: 180 code, 160 tests
  executor: agent
  origin: bug
  layers:
    - boxes:
      - crates/boxes/src/store.rs: DiskLoader::new reads and checks index.json before create_dir_all, tighten_store_modes, self_heal and flush. read_index returns the pinned refusal text with the state dir, through a public constant or typed error
      test: cargo test -p boxes store_refuses_a_newer_format_and_changes_nothing
      test: cargo test -p boxes refusal
    - guest:
      - crates/minimald/src/guest.rs: adds state_refused_beacon and emit_state_refused_marker, with the same 512-byte cap and one-line flattening as mount_failed_beacon
      - crates/minimald/src/main.rs: in the vsock microVM, a store refusal at startup emits STATE_REFUSED and parks, and never sends READY. A native daemon exits non-zero with the refusal text
      test: cargo test -p minimald state_refused_beacon_is_two_lines_flattened_and_capped
    - host:
      - crates/minvmd/src/cmd/mod.rs: adds BootBeacon::StateRefused, parses STATE_REFUSED in read_ready_beacon, and adds an error builder that appends the data volume path
      - crates/minvmd/src/cmd/run.rs: fails the boot with the StateRefused reason and does not touch the volume. detach_failure_message carries the refusal in place of the generic supervisor text
      - crates/minvmd/src/cmd/boot.rs: handles BootBeacon::StateRefused: kills the child, keeps the volume, and returns the refusal error
      - crates/minimal/src/autospawn.rs: boot_failure_error prints the state refusal text as the error, with no retry advice, for the VM and the native minimald
      - docs/specs/08-spec-vm-ext4-volume/08-spec-vm-ext4-volume.md: records the STATE_REFUSED beacon beside MOUNT_FAILED
      test: cargo test -p minvmd read_ready_beacon_parses_state_refused
      test: cargo test -p minimal boot_failure_error_for_a_state_refusal
  proof: A 0.8 min that meets sessions/index.json with format_version 2 prints the pinned refusal text with the state dir, exits non-zero, and the state tree stays byte-identical with the same modes.

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

line exit tail
cargo test -p boxes store_refuses_a_newer_format_and_changes_nothing 0 running 1 test test store::tests::store_refuses_a_newer_format_and_changes_nothing ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 630 filtered out; finished in 0.00s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; finished in 0.00
cargo test -p boxes refusal 0 running 7 tests test core::bep::tests::bep_refusals_name_the_minimal_toml_table_or_the_source ... ok test core::bep::tests::bep_refusals_name_the_minimal_toml_table ... ok test core::bep::tests::dns_steering_is_admitted_with_the_resolver_and_no_interim_refusal ... ok test core::bep::tests::bep_refu
cargo test -p minimald state_refused_beacon_is_two_lines_flattened_and_capped 0 t; finished in 0.00s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out; finished in 0.00s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out; finished in 0.00s warning: unknown fields in task runtime-implement-te
cargo test -p minvmd read_ready_beacon_parses_state_refused 0
cargo test -p minimal boot_failure_error_for_a_state_refusal 101 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt

Verify

min task run agent-verify exited 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.

ownloaded ip_network v0.4.1
  Downloaded ip_network_table v0.2.0
  Downloaded matchit v0.8.4
  Downloaded prost-build v0.14.4
  Downloaded mockall v0.15.0
  Downloaded poly1305 v0.8.0
  Downloaded predicates v3.1.4
  Downloaded inout v0.1.4
  Downloaded ip_network_table-deps-treebitmap v0.5.0
  Downloaded predicates-core v1.0.10
  Downloaded prettyplease v0.2.37
  Downloaded pulldown-cmark v0.13.6
  Downloaded predicates-tree v1.0.13
  Downloaded pulldown-cmark-to-cmark v22.0.0
  Downloaded termtree v0.5.1
  Downloaded tonic-prost-build v0.14.6
  Downloaded tonic-build v0.14.6
  Downloaded universal-hash v0.5.1
  Downloaded x25519-dalek v2.0.1
warning: unused workspace dependency `google-cloud-gax`
   --> Cargo.toml:153:1
    |
153 | google-cloud-gax = "1.13"
    | ^^^^^^^^^^^^^^^^
    |
    = note: `cargo::unused_workspace_dependencies` is set to `warn` by default
help: consider removing the workspace dependency `google-cloud-gax`
warning: unused workspace dependency `rustc-hash`
   --> Cargo.toml:205:1
    |
205 | rustc-hash = "2.1.3"
    | ^^^^^^^^^^
    |
help: consider removing the workspace dependency `rustc-hash`
warning: workspace (manifest) generated 2 warnings
   Compiling opentelemetry v0.33.1
   Compiling version v0.8.0 (/workbench/crates/version)
   Compiling switch v0.0.1 (/workbench/crates/switch)
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
   Compiling stdlib v0.0.22 (/workbench/crates/stdlib)
   Compiling serial_test v4.0.1
   Compiling opentelemetry_sdk v0.33.1
   Compiling tracing-opentelemetry v0.34.0
   Compiling opentelemetry-http v0.33.1
   Compiling opentelemetry-appender-tracing v0.33.1
   Compiling google-cloud-gax-internal v0.7.20
   Compiling opentelemetry-proto v0.33.0
   Compiling opentelemetry-otlp v0.33.0
   Compiling mlog v0.0.1 (/workbench/crates/mlog)
   Compiling google-cloud-longrunning v1.14.0
   Compiling google-cloud-iam-v1 v1.13.0
error: failed to build archive at `/work/build-cache/cargo-home/build/debug/build/google-cloud-gax-internal/a5bb8e01e8fd8771/out/libgoogle_cloud_gax_internal-a5bb8e01e8fd8771.rlib`: No space left on device (os error 28)

error: could not compile `google-cloud-gax-internal` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: failed to write to `/work/build-cache/cargo-home/build/debug/build/mlog/29f8131283a891a0/out/rmetaeY2YVY/full.rmeta`: No space left on device (os error 28)

error: could not compile `mlog` (lib) due to 1 previous error
error: failed to build archive at `/work/build-cache/cargo-home/build/debug/build/google-cloud-iam-v1/ec8f7c9214dc6fd3/out/libgoogle_cloud_iam_v1-ec8f7c9214dc6fd3.rlib`: No space left on device (os error 28)

error: could not compile `google-cloud-iam-v1` (lib) due to 1 previous error
error: command `/usr/bin/cargo '--color=auto' test --no-run '--message-format=json-render-diagnostics' '--package=boxes' '--package=minimal' '--package=minimald' '--package=minvmd' --locked` exited with code 101

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.
@coderabbitai
coderabbitai Bot commented Nov 27, 2026
Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot 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.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0845d74f-5de7-40ac-a989-b66f00d09c3d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@github-actions
Copy link
Copy Markdown
Contributor

Spec lint

docs/specs/08-spec-vm-ext4-volume/08-spec-vm-ext4-volume.md — 3 finding(s)

docs/specs/08-spec-vm-ext4-volume/08-spec-vm-ext4-volume.md:1: F004 frontmatter is missing `owner:`, `epic:`, `arch:`, `updated:`
docs/specs/08-spec-vm-ext4-volume/08-spec-vm-ext4-volume.md:1: S002 missing 6 required section(s): `## Users and stories`, `## Requirements`, `## Non-goals`, `## Design reasoning`, `## Security considerations`, `## Open questions`
docs/specs/08-spec-vm-ext4-volume/08-spec-vm-ext4-volume.md:58: S003 11 section(s) are not part of the spec format: `## Introduction/Overview`, `## Goals`, `## User Stories`, `## Demoable Units of Work`, `## Non-Goals`, `## Design Considerations`, `## Repository Standards`, `## Open Questions`, `## Technical Considerations`, `## Security Considerations`, `## Verification`

Advisory. None of this blocks the merge; the review decides.

Advisory, and never a merge gate. Linter: gominimal/foundry@8acb0663, spec format: How Minimal Writes Specs.

@minimal-foundry
minimal-foundry Bot commented Nov 27, 2026 •
Copy link
Copy Markdown
Contributor Author

Approved: no findings at e3b0aa96b58f.

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.

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

minimal-review — approved

Verdict APPROVE — No findings.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 27, 2026
@agent-137
Copy link
Copy Markdown
Member

/arch-review

@minimal-arch minimal-arch 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.

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.

@mitodrummer mitodrummer left a comment
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.

Approved.

@mitodrummer
mitodrummer added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit 82e17fb Nov 27, 2026
41 checks passed
@mitodrummer
mitodrummer deleted the agent/3843-a-newer-box-state-format-is-refused-before-any-w branch November 27, 2026 21:28
agent-137 pushed a commit that referenced this pull request Nov 27, 2026
#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

D3842 — A newer box-state format is refused before any write, with a message that names the next step, and min shows it on the host

2 participants

0