8000 fix(boxes): a box store index written by a newer build stays readable by a 0.7.x guest minimald, and by minimal-foundry[bot] · Pull Request #3567 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(boxes): a box store index written by a newer build stays readable by a 0.7.x guest minimald, and - #3567

Merged
mitodrummer merged 2 commits into
mainfrom
agent/3554-a-box-store-index-written-by-a-newer-build-stays
Nov 19, 2026
Merged

mitodrummer merged 2 commits into
mainfrom
agent/3554-a-box-store-index-written-by-a-newer-build-stays

Conversation

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

Follow-up

Fixes #3554

Task marker
### D3060 — A box store index written by a newer build stays readable by a 0.7.x guest minimald, and a store that is too new fails with a clear message
  kind: task
  size: S
  est: 60 code, 70 tests
  executor: agent
  origin: bug
  epic: 2236
  layers:
    - boxes:
      - crates/boxes/src/store.rs: Index writes a compat name_to_id map from names and a format_version. DiskLoader::new and DirHandle::find refuse a newer format_version with a message that names it.
      test: cargo test -p boxes index_written_now_parses_with_the_legacy_index_shape
      test: cargo test -p boxes index_with_newer_format_version_is_refused_with_a_clear_error
  proof: A data volume that 0.8.0-dev used boots under 0.7.3-rc1 with no missing field name_to_id error, and a store with a newer format version reports that version.

Proof

index.json now holds a name_to_id map and a format_version beside short_to_id and names. The test index_written_now_parses_with_the_legacy_index_shape parses an index from this build with the 0.7.x shape, where name_to_id is required. So a data volume that this build used does not fail under 0.7.3-rc1 with the missing field name_to_id error. A store whose index has a newer format_version fails DiskLoader::new and BoxDir::find with an InvalidData error. The error names the path, the version found and the version this build reads: ' has format version 2. This minimald reads format version 1 or older. A newer minimald wrote this file.'

Notes from the agent: The task names DirHandle::find. In this tree that function is BoxDir::find, and I changed it. Both open paths now share read_index(). An index with no format_version is version 0, and this build writes version 1. A name can alias many boxes, but the legacy name_to_id map holds one id for each name. For a shared name, the highest id is written. 0.7.x self-heal reconciles names from the records in any case. Two existing tests in store.rs changed. unqualified_name_resolves_running_else_latest_after_a_legacy_index asserted that a rewritten index has no name_to_id. It now asserts that names was rebuilt. The BOX-143 proptest nothing_keys_on_box_name checked that every index map is keyed on a short or an id. It now skips format_version and the compat name_to_id map. This build never reads that map, so no lookup keys on a name. The on-disk index still has one name-keyed map, which the reviewer must accept against BOX-143. I did not run the proof end to end with a real 0.7.3-rc1 guest boot. The evidence is the serde-shape test only. The full boxes suite passed after the commit (612 + 15 + 25 tests). cargo clippy -p boxes --all-targets is clean.

Tests

line exit tail
cargo test -p boxes index_written_now_parses_with_the_legacy_index_shape 0 running 1 test test store::tests::index_written_now_parses_with_the_legacy_index_shape ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 611 filtered out; finished in 0.01s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; finished in
cargo test -p boxes index_with_newer_format_version_is_refused_with_a_clear_error 0 running 1 test test store::tests::index_with_newer_format_version_is_refused_with_a_clear_error ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 611 filtered out; finished in 0.00s runni 8000 ng 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; fin

Verify

min task run agent-verify passed ([tasks.verify]).

Closes #3060 (the original issue this task was triaged from).

The index now also writes a name_to_id map derived from names, which
0.7.x builds require, plus a format_version. Opening a store whose
index carries a newer format_version fails with an error that names
the version found and the version this build reads.
@coderabbitai
coderabbitai Bot commented Nov 18, 2026 •
Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

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: 5cff39a2-007e-4bcf-912c-72b5f97b3038

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

Use the checkbox below for a quick retry:

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

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

Reviewed: no findings; approval withheld, 2 threads unresolved at 7b494a52acd4.

APPROVE withheld: 2 unresolved threads — minimal-arch[bot] crates/boxes/src/store.rs, minimal-arch[bot] crates/boxes/src/store.rs. Resolving the last thread releases the approval on this head.

Resolve the open threads. Resolving the last one releases the approval on this head; no new review is required.

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-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: CONDITIONS · 2 conditions · the full ruling

The format_version gate is correct. It refuses a newer index on both open paths, and the error names both versions. The compat name_to_id map is keyed on the box name, and the BOX-143 proptest now skips it. Design line 500 says that ids, never names, key every record. 0.7.3 rebuilds name_to_id from the records each time it opens the store, so an empty map is enough for a 0.7.x guest. Write an empty map (C1), and remove the skip from the gate (C2).

Ruled at 8bd6915 against gominimal/arch@327e1b57d16b by claude-opus-5-5.

Comment thread crates/boxes/src/store.rs Outdated
}
// A name can alias many boxes, and the legacy map holds one id per
// name. The highest id wins, so the map is deterministic.
let mut name_to_id = BTreeMap::new();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

C1 · This loop writes a map keyed on the box name. Design line 500 says that ids, never names, key every record. The 0.7.3 heal_reconcile_index inserts each record's name on open, so 0.7.x needs only the field. Write an empty map and remove this loop.

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.

Addressed in 7b494a52acd4: Index::serialize now writes name_to_id as an empty map. The loop that filled it from names is gone, the doc comment says the map is always empty, and the legacy-shape test asserts it is empty.

Comment thread crates/boxes/src/store.rs Outdated
for (field, map) in maps {
// `name_to_id` is written only for builds before 0.8 to read.
// This build never reads it, so no lookup keys on a name.
if field == "format_version" || field == "name_to_id" {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

C2 · This skip relaxes the BOX-143 gate so that a name-keyed map passes. Skip only format_version. When C1 makes name_to_id empty, the gate passes and still proves that no map is keyed on a name.

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.

Addressed in 7b494a52acd4: nothing_keys_on_box_name now skips only format_version. The name_to_id skip and its comment are gone, and the gate passes with the empty map.

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

APPROVE withheld: 2 unresolved threads — minimal-arch[bot] crates/boxes/src/store.rs:1122, minimal-arch[bot] crates/boxes/src/store.rs:5529.

minimal-review — advisory review

Verdict COMMENT — No findings.

Panel: 2 of 3 personas ran (correctness, supply-chain); did not complete: security.

@agent-137
Copy link
Copy Markdown
Member

/revise

Arch ruling CONDITIONS on 8bd6915 (arch_rulings 1384). Apply both conditions as written:

  • C1: crates/boxes/src/store.rs impl Serialize for Index: write name_to_id as an empty map (BTreeMap<&str, SessionId>::new()), and remove the loop that fills it from names. The 0.7.3 DiskLoader::new self-heal (heal_reconcile_index, ReconcileFix::UpdateName) inserts each record's name, so 0.7.x still parses and resolves names. Update the Index doc comment (lines 1098-1102) to say the map is always empty. In index_written_now_parses_with_the_legacy_index_shape, assert legacy.name_to_id.is_empty().
  • C2: crates/boxes/src/store.rs proptest nothing_keys_on_box_name: skip only format_version (it is not a map), and remove || field == "name_to_id" and its comment. The empty name_to_id map from C1 then passes the gate as it stands, and the gate again proves that no map in index.json is keyed on a name.

Keep the format_version gate as it is: the ruling says it conforms.

A 0.7.x minimald heals name_to_id from the records on open, so it
needs only the field. No map in index.json now keys on a name, and
the nothing_keys_on_box_name gate checks name_to_id again.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on a /revise note, pushed as 7b494a52acd4.

line exit tail
cargo test -p boxes index_written_now_parses_with_the_legacy_index_shape 0 running 1 test test store::tests::index_written_now_parses_with_the_legacy_index_shape ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 611 filtered out; finished in 0.01s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; finished in
cargo test -p boxes index_with_newer_format_version_is_refused_with_a_clear_error 0 running 1 test test store::tests::index_with_newer_format_version_is_refused_with_a_clear_error ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 611 filtered out; finished in 0.00s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; fin

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👍 valid — crates/boxes/src/store.rs:1122: Index::serialize now writes name_to_id as an empty map. The loop that filled it from names is gone, the doc comment says the map is always empty, and the legacy-shape test asserts it is empty.
  • 👍 valid — crates/boxes/src/store.rs:5529: nothing_keys_on_box_name now skips only format_version. The name_to_id skip and its comment are gone, and the gate passes with the empty map.

index.json written by this build carries format_version and an empty name_to_id map, so a 0.7.x minimald parses it with no missing field name_to_id error and heals the names from the records on open. A store with a newer format_version is refused with a message that names that version and the path.

Notes from the agent: Revise round 1: applied arch conditions C1 and C2. I also ran cargo test -p boxes nothing_keys_on_box_name (1 passed) and cargo clippy -p boxes --all-targets (clean). This session did not run a 0.7.3 guest boot. The 0.7.x self-heal comes from the arch ruling and was not checked here.

@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

C1 and C2 from the ruling on 8bd6915a are met at this head. The index writes name_to_id as an empty map, and the proptest gate exempts only format_version. No map in index.json keys on a name now, as architecture.md line 500 requires. The 0.7.3 source heals an empty name_to_id from the records on open, so a 0.7.x guest still resolves names. A newer format_version fails closed on both open paths.

Ruled at 7b494a5 against gominimal/arch@327e1b57d16b by claude-opus-5-5.

@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 — approval withheld

Verdict COMMENT — APPROVE withheld: 2 unresolved threads — minimal-arch[bot] crates/boxes/src/store.rs, minimal-arch[bot] crates/boxes/src/store.rs. No findings.

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

@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 18, 2026
Merged via the queue into main with commit 84b257c Nov 19, 2026
40 checks passed
@mitodrummer
mitodrummer deleted the agent/3554-a-box-store-index-written-by-a-newer-build-stays branch November 19, 2026 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants

0