Repository navigation
fix(mfile,minimal): a later minimal.toml layer that sets one network sub-table keeps the network - #3619
fix(mfile,minimal): a later minimal.toml layer that sets one network sub-table keeps the network#3619minimal-foundry[bot] wants to merge 22 commits into
Conversation
A later layer that set one network sub-table replaced the whole network table, so [defaults.network.egress] was lost under a [defaults.session.network.bep]. The report now records the layer of each key below network.
With network merged by key, a later egress_allow_dns must replace an earlier egress.allow_dns_hosts, not union with it.
min box spec now shows network.bep and network.egress from their own layers, and the start names the table that set network.egress.
NET-060 keeps a later egress table replacing an earlier one, so the merge goes by the keys of network, not by the keys inside a sub-table.
BOX-048 and the NET egress note said a later layer replaces the network table whole. The expansion now merges it by its keys.
…nimal-toml-layer-that-sets-one-network
|
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: |
|
Round 1 of 10 on a failed check suite: the coder changed nothing. Revise round 1: no change. The failed checks are the macOS 'unit' job and its aggregator 'ci-macos-success'. On macOS, 'just test' runs only -p minvmd -p boxes -p bep. cargo tree shows that none of those crates depends on mfile or minimal, and the branch changes no file in them. So this diff cannot change the result of that job. The log excerpt stops at "error: recipe |
|
Un-drafted: the failed job passed on a re-run of the same head (a timing flake in a test this diff does not touch), and every lane is now green. |
|
/review |
|
/arch-review |
|
Reviewed: 2 findings, none blocking at Address the comments on the diff. Clobber: none found in |
There was a problem hiding this comment.
arch-review: FAIL · the full ruling
This change makes the network table merge by sub-table across minimal.toml layers. The design forbids that. architecture.md line 1253 says a table is replaced wholesale, and it gives network as the example: a layer that sets only egress drops the earlier mode. The spec edits to BOX-048 and spec 18 move the spec away from the design, and rule 9 does not allow that. No code edit can make this merge rule conform, so do not revise the code now. The escalation asks for an owner ruling in gominimal/arch. Bring the change back when that ruling adds network as a merge exception, as arch#177 did for [env_vars].
Ruled at 31c6b77 against gominimal/arch@8b824707cde6 by claude-opus-5-5.
| value: &toml::Value, | ||
| origin: &Origin, | ||
| ) { | ||
| if key == NETWORK_KEY { |
There was a problem hiding this comment.
D3597/expand · This branch merges network key by key. architecture.md line 1253 says a table is replaced wholesale, and uses network as its example. An earlier mode must drop when a later layer sets only egress. Only an arch ruling can add this exception. See the escalation.
There was a problem hiding this comment.
Addressed in 7e880675b9ef: Reverted the per-sub-table merge. merge_value replaces network whole again, as on main. A later table that drops keys is now refused at load.
| verify: cargo nextest run -p mfile entry_name_invalid_exit3_names_entry | ||
|
|
||
| - **BOX-048** THE SYSTEM SHALL merge `[defaults]` into every entry and `[defaults.<type>]` into entries of that type, unioning lists and replacing scalars and tables with the more specific layer's, except `vars` and `vars_lenient`, which BOX-180 merges by name. | ||
| - **BOX-048** THE SYSTEM SHALL merge `[defaults]` into every entry and `[defaults.<type>]` into entries of that type, unioning lists and replacing scalars and tables with the more specific layer's, except `vars` and `vars_lenient`, which BOX-180 merges by name, and `network`, which merges by sub-table: each key below `network`, such as `mode`, `egress` or `bep`, comes whole from the most specific layer that sets it. |
There was a problem hiding this comment.
D3597/docs · This BOX-048 text adds a network exception that architecture.md lines 1223 and 1253 do not have. A spec does not move away from the design (rule 9). The property: line at 288 also still says other tables are replaced.
There was a problem hiding this comment.
Addressed in 7e880675b9ef: Reverted the BOX-048 text and its property: line to main's wording.
| verify: cargo nextest run -p minimald own_ip_default_deny_all | ||
| verify: cargo nextest run -p boxes absent_destination_lists_grant_nothing_once_merged | ||
| <!-- S9a/AC1; prose 47; feature+event; stated per list, not per section: an absent list in the expanded spec grants nothing (the architecture replaces a table wholesale between layers, so an absent list is simply absent), so a section that names only `allow_dns_hosts` reaches its names and no address directly, and allow-all is written out (`0.0.0.0/0` and `::/0` in `allow_subnets`), never left to an absent list; the per-list rule is not mode-qualified, as the architecture's default-deny rule is not: a declared section on a host-address box resolves the same, a host that decides per box reads the resolved shape (NET-079) and refuses a narrowing list it cannot enforce, and only the absent-section default is an own-address box's; `allow_protocols` is a filter over the reach the two destination lists grant and grants none itself, so its absence narrows nothing and `allow_subnets = ["0.0.0.0/0"]` alone is allow-all; `::/0` grants nothing until an IPv6 path exists (NET-082) and is written as the forward-compatible spelling; supersedes the shipped 03-spec R2.1 meaning of an absent `allow_subnets` or `allow_dns_hosts` list, allow-all, in a declared section, and with it R2.1's allow-all for an own-address box with no `egress` section; NET-076 binds the announcement window and NET-077 the opt-out --> | ||
| <!-- S9a/AC1; prose 47; feature+event; stated per list, not per section: an absent list in the expanded spec grants nothing (the `network` table merges by sub-table between layers, and a later layer's `egress` table replaces an earlier one whole, so an absent list is simply absent), so a section that names only `allow_dns_hosts` reaches its names and no address directly, and allow-all is written out (`0.0.0.0/0` and `::/0` in `allow_subnets`), never left to an absent list; the per-list rule is not mode-qualified, as the architecture's default-deny rule is not: a declared section on a host-address box resolves the same, a host that decides per box reads the resolved shape (NET-079) and refuses a narrowing list it cannot enforce, and only the absent-section default is an own-address box's; `allow_protocols` is a filter over the reach the two destination lists grant and grants none itself, so its absence narrows nothing and `allow_subnets = ["0.0.0.0/0"]` alone is allow-all; `::/0` grants nothing until an IPv6 path exists (NET-082) and is written as the forward-compatible spelling; supersedes the shipped 03-spec R2.1 meaning of an absent `allow_subnets` or `allow_dns_hosts` list, allow-all, in a declared section, and with it R2.1's allow-all for an own-address box with no `egress` section; NET-076 binds the announcement window and NET-077 the opt-out --> |
There was a problem hiding this comment.
D3597/docs · The old text said that the architecture replaces a table wholesale. That is still true at architecture.md line 1253. The new text states the opposite rule without a design line for it.
There was a problem hiding this comment.
Addressed in 7e880675b9ef: Restored main's spec 18 text that says the merge replaces the network table whole.
There was a problem hiding this comment.
arch-review: FAIL · the full ruling
This change makes network merge by sub-table across minimal.toml layers. The design says the opposite. architecture.md line 1253 says a table is replaced wholesale, and it uses network as the example: a later egress drops an earlier mode. The PR edits BOX-048 and the spec 18 note to match the code, but a spec cannot amend the design. The [env_vars] exception came through gominimal/arch#177 first, and this exception needs the same path. I filed the question as an escalation. Bring the change back after the design gives network a per-key merge.
Ruled at 31c6b77 against gominimal/arch@8b824707cde6 by claude-opus-5-5.
| origin: &Origin, | ||
| ) { | ||
| if key == NETWORK_KEY { | ||
| merge_network(spec, report, value, origin); |
There was a problem hiding this comment.
D3597 (expand): merge_value merges network by sub-table across layers · This branch gives network its own merge. architecture.md line 1253 says a table is replaced wholesale. It names network as the example: a later egress drops an earlier mode. The design must change first, as gominimal/arch#177 did for [env_vars].
There was a problem hiding this comment.
Addressed in 7e880675b9ef: Removed the network exception from merge_value. A dropped key now refuses the load with exit 3, with no design change.
| verify: cargo nextest run -p mfile entry_name_invalid_exit3_names_entry | ||
|
|
||
| - **BOX-048** THE SYSTEM SHALL merge `[defaults]` into every entry and `[defaults.<type>]` into entries of that type, unioning lists and replacing scalars and tables with the more specific layer's, except `vars` and `vars_lenient`, which BOX-180 merges by name. | ||
| - **BOX-048** THE SYSTEM SHALL merge `[defaults]` into every entry and `[defaults.<type>]` into entries of that type, unioning lists and replacing scalars and tables with the more specific layer's, except `vars` and `vars_lenient`, which BOX-180 merges by name, and `network`, which merges by sub-table: each key below `network`, such as `mode`, `egress` or `bep`, comes whole from the most specific layer that sets it. |
There was a problem hiding this comment.
D3597 (docs): BOX-048 and spec 18 state that network merges by sub-table · This BOX-048 text contradicts architecture.md line 1223 and line 1253. Those lines name [env_vars] as the only table that does not replace whole. A spec cannot add the network exception. The design must add it first.
There was a problem hiding this comment.
Addressed in 7e880675b9ef: BOX-048 and spec 18 are back to main's whole-table wording.
There was a problem hiding this comment.
The per-sub-table merge fixes the #3600 case, and the new tests cover it. It also has two side effects that this PR does not handle. First, an entry with mode = "none" now inherits an [defaults.network.egress] and fails with exit 3. Second, ProjectEgress.layer changed meaning while the ingress and task-mode refusals still read it, so those refusals can name the wrong table. Separately, the module doc at the top of crates/mfile/src/expand.rs (lines 6-16) still says that every table other than vars replaces wholesale. That is a low nit, and it is not in the diff. The minimal-arch threads already raise the architecture.md divergence and the stale BOX-048 property: line, so this review does not repeat them.
Generated by Claude Code
| report.network.remove(key); | ||
| } | ||
| } | ||
| for (sub, item) in add { |
There was a problem hiding this comment.
Medium: with the per-key merge, a more specific layer that sets mode = "none" now keeps an egress table it inherited, and network::canonicalize refuses that pair with exit 3. Before this PR the config below was valid, because the entry's network replaced the whole table:
[defaults.network.egress]
allow_dns_hosts = ["github.com"]
[tasks.offline]
network = { mode = "none" }Now the expanded spec holds mode = "none" and egress.allow_dns_hosts. entry_egress (and min box spec) call canonicalize, which returns ModeNoneWithEgress. The user sees [network] sets mode = "none" and network.egress.allow_dns_hosts... Remove the egress settings, or set mode to host_ip or own_ip. Neither remedy fits: removing [defaults.network.egress] strips egress from every other entry. The only working escape is an undocumented egress = {} in the entry. The same happens the other way round ([defaults.network] mode = "none" plus an entry that sets only egress), but the entry can fix that one by restating mode.
Suggested fix: when the merged mode comes from a later layer than egress and is "none", drop the inherited egress (and the flat egress_* keys) in merge_network, or have canonicalize refuse only when one layer sets both. Add a test for the [defaults.network.egress] + mode = "none" entry case.
Generated by Claude Code
There was a problem hiding this comment.
Addressed in 7e880675b9ef: The per-key merge is gone, so mode = none no longer keeps an inherited egress. The [defaults.network.egress] + mode = none entry case is now refused at load with a test, as the maintainer directed.
| .filter_map(|key| Some((expansion.report.network.get(key)?.layer, key))) | ||
| .max() | ||
| .map_or("egress", |(_, key)| key); | ||
| let layer = layer_of(egress_key); |
There was a problem hiding this comment.
Medium: ProjectEgress.layer now names the layer of network.egress. Two callers still read it as the layer of a different key, so their refusals name the wrong table:
refuse_file_ingress_off_own_ip(create.rs:176, called fromsession_box_network) treats it as the table that setnetwork.ingress. With[defaults.network.egress] allow_dns_hosts = ["a"]and[sessions.dev] network = { mode = "host_ip", ingress = [{ proto = "tcp", port = 8080 }] },min box start devprints[defaults] in minimal.toml sets network.ingress, but the box is host_ip ... Set network.mode = "own_ip" in [defaults].[sessions.dev]sets both keys, and setting the mode in[defaults] would not help, because the entry's modewins.task_box_network(task.rs:156) uses it asmode_layer. With[defaults.task.network] mode = "own_ip"and[tasks.build.network.egress] ...on a VM host, the refusal says[tasks.build] in minimal.toml sets network.mode = "own_ip", but[defaults.task]set it.
Before this PR one layer held the whole network table, so neither message could be wrong. The PR notes call task.rs out of scope, but this PR changes what the field means. Suggested fix: give ProjectEgress a layer for each key (mode_layer, ingress_layer, egress_layer), built with layer_of("mode") and layer_of("ingress"), and pass the right one to each refusal. Pin both messages in tests.
Per AGENTS.md "User-facing text": "Say only what the code can prove."
Generated by Claude Code
There was a problem hiding this comment.
Addressed in 7e880675b9ef: Reverted the ProjectEgress.layer change. One layer holds the whole network table again, so both refusals name the right table as on main.
| let all = | ||
| mfile::expand::ValueOrigin::List(expansion.report.network.values().cloned().collect()); |
There was a problem hiding this comment.
Low: report.network is a BTreeMap keyed by sub-key name, so this list is in key order (bep, egress, ingress, mode), not layer order. For the test case in this PR, the # network: source line reads [defaults.session], [defaults]. Every other multi-layer source in the render lists layers from least to most specific, so this one reads in the reverse order. network_sources already sorts each key's origins by origin.layer. Do the same here (collect, then sort_by_key(|o| o.layer)).
Generated by Claude Code
There was a problem hiding this comment.
Addressed in 7e880675b9ef: Reverted the per-sub-key network source line in box_spec.rs. The render names one network source, as on main.
|
/revise Change of approach, decided by the maintainer after the arch escalation: keep the design's whole-table merge and refuse at load instead. architecture.md lines 1223 and 1253 say every table except
Before you push, check that no checked-in |
…nimal-toml-layer-that-sets-one-network
Revert the per-sub-table network merge, the per-key origins and the spec text that described it. The merge replaces network whole again, as architecture.md says. Loading minimal.toml now refuses, with exit 3, a later network table that leaves out keys an earlier layer sets.
…nimal-toml-layer-that-sets-one-network
The NetworkTableDropsKeys variant made mfile::Error 128 bytes, so clippy's result_large_err failed every Result<_, Error> in mctx.
|
Round 2 of 10 on a /revise note, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
With [defaults.session.network.bep] and [defaults.network.egress] set, Notes from the agent: Round 2 follows the maintainer's change of approach. Reverted: the per-sub-table merge in expand.rs, the ProjectEgress.layer and box_spec.rs per-key origin changes, and the BOX-048 and spec 18 text. Those six files now match main, so create.rs, box_spec.rs and both spec files show no diff against main. New: expand() calls refuse_dropped_network_keys over [defaults], [defaults.] and the entry. Type defaults from [box_types], loadouts and command-line flags are not checked, as the directive names only those three layers. Out of layers: crates/mfile/src/error.rs gets a new variant, Error::NetworkTableDropsKeys (exit 3), because every expand error lives in that enum. Message wording: the directive's exact text is pinned in both tests. More than one dropped key prints as |
| } | ||
| ordered.push((Origin::of(Layer::Overrides), &layers.overrides)); | ||
| check_project_declarers(entry, &ordered)?; | ||
| refuse_dropped_network_keys(entry, layers)?; |
There was a problem hiding this comment.
MEDIUM · correctness · confidence 0.70 · in refuse_dropped_network_keys
The PR title, body and task say a later layer that sets one network sub-table must keep the earlier network keys, and min box spec dev must show both bep and egress. This change does the opposite. expand now fails with exit 3 for that file. The reproduce case from the issue becomes a hard error, and so does any existing file that sets mode in [defaults.network] and an inline network = {..} in an entry. Those files loaded before. The bug (#3600) is not fixed. The test names network_merges_by_sub_table_* and box_spec_keeps_earlier_network_egress assert a refusal, so the names say the reverse of what they check.
What the reviewer checked
expand.rs:415 refuse_dropped_network_keys(entry, layers)?; tests.rs: box_spec_keeps_earlier_network_egress expects_err exit_code Some(3)
Hand this to an agent
Act on a code-review finding.
File: crates/mfile/src/expand.rs
Lines: 415-415
Category: correctness
Severity: medium (reviewer confidence 0.70)
Finding:
The PR title, body and task say a later layer that sets one network sub-table must keep the earlier network keys, and `min box spec dev` must show both `bep` and `egress`. This change does the opposite. `expand` now fails with exit 3 for that file. The reproduce case from the issue becomes a hard error, and so does any existing file that sets `mode` in `[defaults.network]` and an inline `network = {..}` in an entry. Those files loaded before. The bug (#3600) is not fixed. The test names `network_merges_by_sub_table_*` and `box_spec_keeps_earlier_network_egress` assert a refusal, so the names say the reverse of what they check.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
There was a problem hiding this comment.
Addressed in e4ad786cf6f2: Removed refuse_dropped_network_keys and its error and tests. The file from the issue loads again as on main. The per-sub-table merge waits for the design owner, because BOX-064 replaces tables whole.
| "[defaults.{}]", | ||
| entry.box_type.as_deref().unwrap_or_default() | ||
| ); | ||
| let entry_header = EntryHeader(entry.table.key(), &entry.name).to_string(); | ||
| let ordered = [ | ||
| ("[defaults]".to_owned(), &layers.defaults), | ||
| (defaults_type, &layers.defaults_type), | ||
| (entry_header, &entry.body), | ||
| ]; | ||
| let mut earlier: Option<(&str, &toml::Table)> = None; | ||
| for (header, layer) in &ordered { | ||
| let Some(network) = layer.get("network").and_then(toml::Value::as_table) else { | ||
| continue; | ||
| }; | ||
| if let Some((earlier_header, earlier_network)) = earlier { | ||
| let dropped: Vec<String> = earlier_network | ||
| .keys() | ||
| .filter(|k| !network.contains_key(k.as_str())) | ||
| .cloned() | ||
| .collect(); |
There was a problem hiding this comment.
LOW · correctness · confidence 0.50 · in refuse_dropped_network_keys
The check reads only [defaults], [defaults.<type>] and the entry. The fold in layers_to_entry also merges type_defaults (custom box type defaults) and the overrides layer. A network table in those layers still drops earlier keys without a word. Also, when entry.box_type is None, the header becomes [defaults.].
What the reviewer checked
layers_to_entry pushes type_defaults, defaults, defaults_type, entry; expand pushes Overrides after. The new function lists three layers.
Hand this to an agent
Act on a code-review finding.
File: crates/mfile/src/expand.rs
Lines: 571-590
Category: correctness
Severity: low (reviewer confidence 0.50)
Finding:
The check reads only `[defaults]`, `[defaults.<type>]` and the entry. The fold in `layers_to_entry` also merges `type_defaults` (custom box type defaults) and the overrides layer. A `network` table in those layers still drops earlier keys without a word. Also, when `entry.box_type` is None, the header becomes `[defaults.]`.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
There was a problem hiding this comment.
Addressed in e4ad786cf6f2: The partial layer check and the [defaults.] header went away with the whole refusal, which this round removes.
There was a problem hiding this comment.
arch-review: FAIL · the full ruling
This PR refuses a minimal.toml file with exit 3 when a later network table leaves out a key from an earlier layer. The design says the later table replaces the earlier one wholesale and drops those keys (architecture.md line 1253). It gives the expansion no such refusal. BOX-048 says the same thing, and this PR does not amend it. The bug asks for an outcome that the design rules out, so no code edit can make this task conform. The escalation asks the design owner to decide the network merge rule. Park the task until that decision. Also, the PR title and Proof section say that min box spec dev shows both tables, but at this head the command exits 3.
Ruled at 7e88067 against gominimal/arch@8b824707cde6 by claude-opus-5-5.
| } | ||
| ordered.push((Origin::of(Layer::Overrides), &layers.overrides)); | ||
| check_project_declarers(entry, &ordered)?; | ||
| refuse_dropped_network_keys(entry, layers)?; |
There was a problem hiding this comment.
D3597 layer expand · This call makes the expansion fail with exit 3 when a later network table leaves out an earlier key. architecture.md line 1253 says the later table replaces the earlier one wholesale and drops that key. The design gives the expansion no such refusal. Do not change this rule in code. The escalation asks the design owner to decide it.
There was a problem hiding this comment.
Addressed in e4ad786cf6f2: Removed the refusal. Expansion replaces network whole again, as BOX-064 and architecture.md line 1253 state, until the design owner rules.
|
|
||
| [tasks.offline] | ||
| exec = ["true"] | ||
| network = { mode = "none" } |
There was a problem hiding this comment.
D3597 layer expand · This case shows the effect. A task that sets mode = "none" is refused because [defaults.network.egress] exists. Line 1253 says this entry expands, without the defaults' egress.
There was a problem hiding this comment.
Addressed in e4ad786cf6f2: Removed that test and the refusal. A task with mode = "none" expands again without the egress from [defaults].
| // of an earlier layer. `min box spec dev` and the start refuse the file | ||
| // with exit 3 and name both tables, rather than drop egress without a word. | ||
| #[tokio::test] | ||
| async fn box_spec_keeps_earlier_network_egress() { |
There was a problem hiding this comment.
D3597 layer cli · The test name says that the earlier egress is kept. The test asserts that min box spec dev and the start refuse the file. The PR title and Proof section say the same incorrect thing. Make the name, title and proof match the behaviour that the design owner decides.
There was a problem hiding this comment.
Addressed in e4ad786cf6f2: Removed box_spec_keeps_earlier_network_egress with the refusal. The title and proof come from the plan task, and the runner writes them. They need a re-cut task after the design owner rules.
…nimal-toml-layer-that-sets-one-network
Both reviewers reject the exit-3 refusal. BOX-064 replaces a table whole between layers, so the merge stays as on main until the design owner rules on a per-sub-table network merge.
|
Round 3 of 10 on a failed check suite, pushed as
Verify Review threads the coder judged:
The proof is not delivered. With [defaults.session.network.bep] and [defaults.network.egress] set, min box spec dev shows the same network table as on main: the later table replaces the earlier one whole, as BOX-064 states. The exit-3 refusal from round 2 is gone. Notes from the agent: This round reverts the round-2 refusal. After this round the branch has no diff against origin/main (merge base 9566c56). The task asks for a merge of |
|
Parked: both merge-by-sub-table and refuse-at-load contradict architecture.md line 1253, so this waits on a design ruling in https://github.com/gominimal/arch/issues/188. Task #3600 carries |
|
/revise
|
…nimal-toml-layer-that-sets-one-network
A later layer that set one network key, such as bep, replaced the whole network table, so an earlier layer's egress was lost. Each key below network now carries over unless a later layer sets it, as gominimal/arch#188 rules. A later mode = "none" clears the inherited egress and ingress. The report keeps the layer of each network key.
min box spec shows network.bep, network.egress and the other network keys each from the layer that set it, as gominimal/arch#188 composes them. The start names the table that set network.egress, and the ingress refusal names the tables of network.ingress and network.mode. task.rs reads the new mode_layer for the task run's mode notice.
BOX-048 and the spec 18 note now state the ruling of gominimal/arch#188: each key of network comes from the most specific layer that sets it, egress still replaces whole, and a later mode = "none" clears the inherited egress and ingress.
…nimal-toml-layer-that-sets-one-network
|
Round 4 of 10 on a /revise note, pushed as The coder ran out of its 7200s before it finished. If it left work uncommitted, its last commit is the runtime's snapshot of that work as it stood — the commit message says so — and not a finished step: it may not build or pass its tests.
Verify Outside the task's
Converted to a draft: verify exited 100; outside the task's With |
|
/arch-review |
There was a problem hiding this comment.
arch-review: FAIL · the full ruling
This change merges the network table by key across minimal.toml layers. The design of record says the opposite. architecture.md line 1294 says a table is replaced wholesale, and it uses network as the example. Line 1264 names [env_vars] as the only table that merges by name. The amended BOX-048 cites gominimal/arch#188, but the design checkout at 4f2eb87d does not contain that decision. No condition in this task can fix this, so the ruling is FAIL, as on the earlier heads. Land the #188 decision in architecture.md and example-minimal.toml first. Then push again for a new ruling.
Ruled at 8b16de3 against gominimal/arch@4f2eb87d5d12 by claude-opus-5-5.
| /// [`crate::network::canonicalize`] to refuse. Any other value replaces the | ||
| /// whole `network` value. The report keeps the layer of each key below | ||
| /// `network`. | ||
| fn merge_network( |
There was a problem hiding this comment.
D3597/expand · merge_network merges network by key. architecture.md line 1294 says a table is replaced wholesale, not merged key by key, and it uses network as the example. The design checkout at 4f2eb87d does not contain gominimal/arch#188.
There was a problem hiding this comment.
Disputed — not addressed: The maintainer approved the by-key network merge on this head and asked to keep it unchanged. gominimal/arch#200 now states that rule in the design, and the arch check waits for #200 to land. No code change this round.
| let egress_keys = || { | ||
| std::iter::once("egress").chain(crate::network::FLAT_EGRESS_KEYS.iter().map(|(f, _)| *f)) | ||
| }; | ||
| let mode_none = add |
There was a problem hiding this comment.
D3597/expand · The mode = "none" clearing of an inherited egress and ingress is a new merge rule. The design does not state it. Gominimal/arch#188 must decide it in architecture.md before code implements it.
There was a problem hiding this comment.
Disputed — not addressed: gominimal/arch#200 now states the mode = "none" clearing, and the maintainer approved this head. This round adds the same clearing for --network none, as #200 says. merge_network is unchanged.
| verify: cargo nextest run -p mfile entry_name_invalid_exit3_names_entry | ||
|
|
||
| - **BOX-048** THE SYSTEM SHALL merge `[defaults]` into every entry and `[defaults.<type>]` into entries of that type, unioning lists and replacing scalars and tables with the more specific layer's, except `env_vars`, which BOX-180 merges by name. | ||
| - **BOX-048** THE SYSTEM SHALL merge `[defaults]` into every entry and `[defaults.<type>]` into entries of that type, unioning lists and replacing scalars and tables with the more specific layer's, except `env_vars`, which BOX-180 merges by name, and `network`, which merges by key (gominimal/arch#188): each key below `network`, such as `mode`, `egress`, `ingress` or `bep`, comes whole from the most specific layer that sets it, and a layer that sets `mode = "none"` clears the `egress` and `ingress` that it inherits. |
There was a problem hiding this comment.
D3597/docs · BOX-048 now says network merges by key. architecture.md lines 1264 and 1294 name [env_vars] as the one table that merges, and they replace network whole. Amend the design first. A spec line cannot override it.
There was a problem hiding this comment.
Disputed — not addressed: The design amendment is gominimal/arch#200, which the maintainer says the arch check waits on. The maintainer approved this BOX-048 text and asked to keep it unchanged.
| **`env_vars` merge by name.** Decided on 2026-11-09: BOX-180 merges the variables by name, and every other table is still replaced whole. With a wholesale replace, an open entry that sets variables and a loadout that sets variables would lose the entry's variables, and the built-in default loadout sets variables. Up to the entry, the more specific layer wins on a name, as BOX-048 says for any value. A loadout adds names. A loadout that sets a name to a different value fails the expansion (BOX-183), which keeps the documented rule of docs/reference/loadouts.md: there is no override precedence between loadouts and the project. The alternative let a later layer win, so a loadout would override the entry silently. It was rejected because it changes shipped behaviour. A person who wants a loadout's value removes the project's declaration of that variable, and any lower layer's declaration that would then apply. The policy's `ignore` list drops every contributor of the variable, the loadout's included, so it resolves a conflict without keeping either value. | ||
| **`env_vars` merge by name.** Decided on 2026-11-09: BOX-180 merges the variables by name, and every other table except `network` is still replaced whole. With a wholesale replace, an open entry that sets variables and a loadout that sets variables would lose the entry's variables, and the built-in default loadout sets variables. Up to the entry, the more specific layer wins on a name, as BOX-048 says for any value. A loadout adds names. A loadout that sets a name to a different value fails the expansion (BOX-183), which keeps the documented rule of docs/reference/loadouts.md: there is no override precedence between loadouts and the project. The alternative let a later layer win, so a loadout would override the entry silently. It was rejected because it changes shipped behaviour. A person who wants a loadout's value removes the project's declaration of that variable, and any lower layer's declaration that would then apply. The policy's `ignore` list drops every contributor of the variable, the loadout's included, so it resolves a conflict without keeping either value. | ||
|
|
||
| **`network` merges by key.** Decided by gominimal/arch#188: a layer that sets a key of `network` replaces that key's value whole, and the keys it does not set carry over from earlier layers. So a `[defaults.session.network.bep]` does not drop a `[defaults.network.egress]` (#3597). Inside a sub-table nothing merges, so a later `egress` replaces an earlier `egress` whole, as NET-060 says. A later layer's `mode = "none"` clears the `egress` and the `ingress` that it inherits, because a box with no network has no use for them. A layer that sets `mode = "none"` and an `egress` together is still refused with exit 3 (BOX-080). |
There was a problem hiding this comment.
D3597/docs · This text says gominimal/arch#188 made the decision. The design of record at 4f2eb87d does not contain #188, and line 1294 still states the opposite rule.
There was a problem hiding this comment.
Disputed — not addressed: The maintainer approved this text and asked to keep the head unchanged until gominimal/arch#200 lands in the design of record. No change this round.
There was a problem hiding this comment.
Approved by the maintainer over the arch FAIL at 8b16de3. The FAIL is because the design of record still says network is replaced wholesale. The owner ruled on gominimal/arch#188 that it merges by key, and gominimal/arch#200 lands that text. The code here implements the ruling.
|
/revise
Keep the rest of this head unchanged. The maintainer has approved it, and the arch FAIL waits on gominimal/arch#200 landing. |
…nimal-toml-layer-that-sets-one-network
min session start and min box spec <entry> with --network none clear the network.egress and network.ingress that minimal.toml layers set, as a layer's mode = "none" does (gominimal/arch#200).
|
Round 5 of 10 on a /revise note, pushed as
Verify Outside the task's
Converted to a draft: verify exited 100; outside the task's Review threads the coder judged:
With Notes from the agent: Round 5 /revise note: the new helper clear_file_network_on_none_flag (create.rs) clears the file's egress, ingress and ingress layer when --network is none. session_box_network calls it, so the create path and the bare min box spec render get it. The entry render in box_spec.rs calls it for session entries and also removes the inherited network.ingress row and its source comment. The other network flags are unchanged. Task entries are not changed: min task run resolves its network in crates/minimal/src/task.rs, which is outside this task's layers. So the task branch of the render still matches what min task run does. If the arch#200 rule must apply to min task run --network none too, that needs a follow-up in task.rs and in the task branch of box_spec.rs. The rest of the head is unchanged, as the note asks. Docs keep their gominimal/arch#188 citations. A wider run (cargo test -p minimal -- network egress ingress) had one failure: tests::legacy_network_spellings_parse_with_hint, at tests.rs:4618. It also fails on the previous head when it runs alone. It captures process stderr, so this box is the probable cause, not this change. cargo clippy -p minimal --all-targets printed no warnings. |
|
The runtime will not revise this pull request again on its own: the diff is +719/-27 (746 lines), past 3x the plan's estimate of 230 lines (est: 120 code, 110 tests, as #3600 reads now), at round 5 (the last trigger was a /revise note). A person decides now. Remove |
|
Marked ready: CI is green at 6cea830. The only verify failure, |
There was a problem hiding this comment.
arch-review: FAIL · the full ruling
This change makes network merge by key between minimal.toml layers. The design of record says the opposite. architecture.md line 1294 says a later layer replaces the network table whole and must restate the keys it keeps. The spec edits cite gominimal/arch#188, but the design checkout does not contain that decision. No code edit can fix #3600 and also conform, so this PR waits for the design question in the escalation. When the design changes, push again for a new ruling.
Ruled at 6cea830 against gominimal/arch@4f2eb87d5d12 by claude-opus-5-5.
| value: &toml::Value, | ||
| origin: &Origin, | ||
| ) { | ||
| if key == NETWORK_KEY { |
There was a problem hiding this comment.
D3597 · This branch sends network to merge_network, which keeps the keys that a later layer does not set. architecture.md line 1294 says a table is replaced whole, not merged key by key, and names network as the example. This deviates until the design adopts a per-key merge.
| verify: cargo nextest run -p mfile entry_name_invalid_exit3_names_entry | ||
|
|
||
| - **BOX-048** THE SYSTEM SHALL merge `[defaults]` into every entry and `[defaults.<type>]` into entries of that type, unioning lists and replacing scalars and tables with the more specific layer's, except `env_vars`, which BOX-180 merges by name. | ||
| - **BOX-048** THE SYSTEM SHALL merge `[defaults]` into every entry and `[defaults.<type>]` into entries of that type, unioning lists and replacing scalars and tables with the more specific layer's, except `env_vars`, which BOX-180 merges by name, and `network`, which merges by key (gominimal/arch#188): each key below `network`, such as `mode`, `egress`, `ingress` or `bep`, comes whole from the most specific layer that sets it, and a layer that sets `mode = "none"` clears the `egress` and `ingress` that it inherits. |
There was a problem hiding this comment.
D3597 · BOX-048 now says network merges by key, and cites gominimal/arch#188. The design at 4f2eb87d does not have that decision. Line 1264 and line 1294 of architecture.md still replace the table whole. A spec must not move away from the design. Amend the design first.
| verify: cargo nextest run -p minimald own_ip_default_deny_all | ||
| verify: cargo nextest run -p boxes absent_destination_lists_grant_nothing_once_merged | ||
| <!-- S9a/AC1; prose 47; feature+event; stated per list, not per section: an absent list in the expanded spec grants nothing (the architecture replaces a table wholesale between layers, so an absent list is simply absent), so a section that names only `allow_dns_hosts` reaches its names and no address directly, and allow-all is written out (`0.0.0.0/0` and `::/0` in `allow_subnets`), never left to an absent list; the per-list rule is not mode-qualified, as the architecture's default-deny rule is not: a declared section on a host-address box resolves the same, a host that decides per box reads the resolved shape (NET-079) and refuses a narrowing list it cannot enforce, and only the absent-section default is an own-address box's; `allow_protocols` is a filter over the reach the two destination lists grant and grants none itself, so its absence narrows nothing and `allow_subnets = ["0.0.0.0/0"]` alone is allow-all; `::/0` grants nothing until an IPv6 path exists (NET-082) and is written as the forward-compatible spelling; supersedes the shipped 03-spec R2.1 meaning of an absent `allow_subnets` or `allow_dns_hosts` list, allow-all, in a declared section, and with it R2.1's allow-all for an own-address box with no `egress` section; NET-076 binds the announcement window and NET-077 the opt-out --> | ||
| <!-- S9a/AC1; prose 47; feature+event; stated per list, not per section: an absent list in the expanded spec grants nothing (the `network` table merges by key between layers, and a later layer's `egress` table replaces an earlier one whole, as gominimal/arch#188 rules, so an absent list is simply absent; a later layer's `mode = "none"` clears the inherited `egress` and `ingress`), so a section that names only `allow_dns_hosts` reaches its names and no address directly, and allow-all is written out (`0.0.0.0/0` and `::/0` in `allow_subnets`), never left to an absent list; the per-list rule is not mode-qualified, as the architecture's default-deny rule is not: a declared section on a host-address box resolves the same, a host that decides per box reads the resolved shape (NET-079) and refuses a narrowing list it cannot enforce, and only the absent-section default is an own-address box's; `allow_protocols` is a filter over the reach the two destination lists grant and grants none itself, so its absence narrows nothing and `allow_subnets = ["0.0.0.0/0"]` alone is allow-all; `::/0` grants nothing until an IPv6 path exists (NET-082) and is written as the forward-compatible spelling; supersedes the shipped 03-spec R2.1 meaning of an absent `allow_subnets` or `allow_dns_hosts` list, allow-all, in a declared section, and with it R2.1's allow-all for an own-address box with no `egress` section; NET-076 binds the announcement window and NET-077 the opt-out --> |
There was a problem hiding this comment.
D3597 · This comment replaces "the architecture replaces a table wholesale between layers" with a per-key merge. The architecture still says the wholesale replace (architecture.md line 1294). This edit depends on the same design decision as BOX-048.
| /// Merges a layer's `network` value into the spec (BOX-048, | ||
| /// gominimal/arch#188). A table onto a table merges by key: each key the | ||
| /// layer sets below `network`, such as `mode`, `egress`, `ingress` or | ||
| /// `bep`, replaces the spec's key whole, and the keys the layer does not | ||
| /// set stay. Inside a sub-table nothing merges, so a later `egress` | ||
| /// replaces an earlier one whole (NET-060). The flat `egress_*` keys and | ||
| /// `egress` spell one setting, so a layer that sets any of them replaces | ||
| /// all of them. A layer whose `mode` is `none` clears the egress and the | ||
| /// ingress it inherits. Its own egress or ingress stays, for | ||
| /// [`crate::network::canonicalize`] to refuse. Any other value replaces the | ||
| /// whole `network` value. The report keeps the layer of each key below | ||
| /// `network`. | ||
| fn merge_network( | ||
| spec: &mut toml::Table, | ||
| report: &mut ExpansionReport, | ||
| value: &toml::Value, | ||
| origin: &Origin, | ||
| ) { | ||
| report | ||
| .values |
There was a problem hiding this comment.
MEDIUM · correctness · confidence 0.55 · in merge_network
merge_network merges network by key. The architecture reviewer ruled that a table is replaced whole, and said only an arch ruling can add this exception. The foundry reply says it reverted the merge and now refuses a later table that drops keys. The current head still merges and does not refuse. An earlier mode now survives a later layer that sets only egress. Settle the ruling, or restore the whole-table replace, before merge.
What the reviewer checked
threads.json: minimal-arch 'Only an arch ruling can add this exception'; minimal-foundry 'Reverted the per-sub-table merge. merge_value replaces network whole again'. pr.diff still has
if key == NETWORK_KEY { merge_network(...).
Hand this to an agent
Act on a code-review finding.
File: crates/mfile/src/expand.rs
Lines: 1363-1382
Category: correctness
Severity: medium (reviewer confidence 0.55)
Finding:
`merge_network` merges `network` by key. The architecture reviewer ruled that a table is replaced whole, and said only an arch ruling can add this exception. The foundry reply says it reverted the merge and now refuses a later table that drops keys. The current head still merges and does not refuse. An earlier `mode` now survives a later layer that sets only `egress`. Settle the ruling, or restore the whole-table replace, before merge.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
| // gominimal/arch#200: as the start does, `--network none` drops the | ||
| // entry's `network.egress` and `network.ingress`. | ||
| none_flag_cleared = super::box_verbs::clear_file_network_on_none_flag( | ||
| &mut project_egress, | ||
| overrides.network, | ||
| ); |
There was a problem hiding this comment.
LOW · correctness · confidence 0.50 · in expand_entry
Only the session branch calls clear_file_network_on_none_flag. The task branch keeps the entry's egress under --network none. task_box_network in task.rs also does not clear and refuses egress on none (NET-065). A session and a task now treat --network none with file egress in different ways. Make the difference explicit or share the rule.
What the reviewer checked
rg clear_file_network_on_none_flag: callers are create.rs:155 and box_spec.rs:1184 only.
Hand this to an agent
Act on a code-review finding.
File: crates/minimal/src/cmd/box_spec.rs
Lines: 1182-1187
Category: correctness
Severity: low (reviewer confidence 0.50)
Finding:
Only the session branch calls `clear_file_network_on_none_flag`. The task branch keeps the entry's egress under `--network none`. `task_box_network` in `task.rs` also does not clear and refuses egress on `none` (NET-065). A session and a task now treat `--network none` with file egress in different ways. Make the difference explicit or share the rule.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
Follow-up
Fixes #3600
crates/mfile/src/expand.rscrates/minimal/src/cmd/boxes/create.rscrates/minimal/src/cmd/box_spec.rscrates/minimal/src/tests.rsdocs/specs/29-spec-box-local-first/29-spec-box-local-first.mddocs/specs/18-spec-box-networking/18-spec-box-networking.mdTask marker
Proof
With [defaults.session.network.bep] and [defaults.network.egress] set, min box spec dev now shows both bep and egress under [network]. It prints '# network.bep: from [defaults.session]' and '# network.egress: from [defaults]'. The start reads the [defaults.network.egress] hosts and names [defaults] as the table that set them.
Notes from the agent: Merge rule: each key below network (mode, egress, bep, ingress) comes whole from the most specific layer that sets it. A sub-table does not merge key by key. The first commit merged inside sub-tables, but task::tests::task_box_network_reads_the_task_egress_from_minimal_toml (NET-060) pins that a later egress table replaces an earlier one whole, so a later commit narrowed the merge. The flat egress_* keys and egress spell one setting, so a layer that sets any of them replaces all of them. ExpansionReport has a new field, network, with the origin of each key below network. values["network"] still names the last layer. ProjectEgress.layer now names the layer of network.egress, with the last layer that declares network as the fallback when there is no egress. task.rs (out of scope) still uses that one field for the mode layer. Commit 68275d3 also holds the first create.rs edit because of a commit -a. Pre-existing failure: tests::legacy_network_spellings_parse_with_hint fails on the base commit 84b257c too, because its stderr capture is empty. A filtered run of the box_spec/egress/network/ingress/bep tests in minimal otherwise passed (74 passed). just lint-prose did not run, because vale is not installed on this box.
Tests
cargo test -p mfile network_merges_by_sub_tablecargo test -p minimal box_spec_keeps_earlier_network_egresscargo test -p mfile network_merges_by_sub_tableVerify
min task run agent-verifyexited 100, so this PR is a draft.Base
The base branch moved while the coder worked; it was merged in before the tests ran.