Repository navigation
fix(boxes): a box store index written by a newer build stays readable by a 0.7.x guest minimald, and - #3567
Conversation
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.
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
|
Reviewed: no findings; approval withheld, 2 threads unresolved at 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. |
There was a problem hiding this comment.
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.
| } | ||
| // 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(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| 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" { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
/revise Arch ruling CONDITIONS on 8bd6915 (arch_rulings 1384). Apply both conditions as written:
Keep the |
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.
|
Round 1 of 10 on a /revise note, pushed as
Verify Review threads the coder judged:
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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).
Follow-up
Fixes #3554
crates/boxes/src/store.rsTask marker
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
cargo test -p boxes index_written_now_parses_with_the_legacy_index_shapecargo test -p boxes index_with_newer_format_version_is_refused_with_a_clear_errorVerify
min task run agent-verifypassed ([tasks.verify]).Closes #3060 (the original issue this task was triaged from).