8000 Merge remote-tracking branch 'origin/main' into agent/2702-egress-rules-in-minimal-toml-reach-the-box · gominimal/minimal@ca8c95f · GitHub
[go: up one dir, main page]

Skip to content

Merge remote-tracking branch 'origin/main' into agent/2702-egress-rul…

Minimal Arch / arch-review failed Nov 7, 2026 in 0s

CONDITIONS

Governs: architecture.md (arch 7a86ec7b). Box Spec [network.egress] lines 905–937: egress is default-deny (906), the keys are the ones NET-060 binds, the flat keys get a one-release hint (916–919), and deny_subnets is never reached (937). minimal.toml layout lines 1172–1173 ([default 44AF s] and [defaults.<type>]), line 1178 (the implicit default entry is retired when the file declares a session entry) and Expansion lines 1196–1202 (one layer order, scalars and tables replaced, lists unioned, command-line overrides last). Exit codes line 364 (3 is an invalid minimal.toml). NET-060 itself is in docs/specs/18-spec-box-networking line 506. The flag semantics are in docs/specs/28-spec-box-cli line 442 (each egress flag "adds one item") and BOX-064 (29-spec, line 334, "unioning lists in that order").

Ruling: the placement conforms. create.rs is the task's only layer, and it reads the file through mfile::expand and mfile::network::canonicalize, the owners the task names. The four fields reach BoxPolicy.egress and the stored spec, and the flat keys get the hint that the design requires. Three deviations remain, and each has a condition. (C1) effective_egress replaces a file list with the flag's list field by field. Line 1196 and BOX-064 union lists through every layer, the command-line layer included, and BCLI line 442 says a flag adds an item. The replace has a fail-open edge: --deny-subnets X drops every deny range that the project declares (line 937). The task text says "replaces", and rubric rule 9 makes the plan change. (C2) A canonicalize error and a bad egress value exit 1, but line 364 requires 3. The NetworkError type already says "Each one exits 3". (C3) The read always takes [sessions.default]. In a file with only [sessions.dev.network.egress], that table is dropped without a message, and the box starts with an absent (allow-all) policy. That uses an implicit entry that line 1178 retires, and it fails open against line 906. (C4) The diagnostics line of the task (min session policy shows each field's source) is not met, and no issue names the gap.

Line 1202 and C1: line 1202 replaces a table wholesale. A flag writes one list item, not a network table, so the list-union clause of line 1196 governs it. No departure from precedent.

Not checked: no build, as the instructions require. I did not verify that toml::Value::try_into returns toml::de::Error in the pinned toml version, which C2 depends on. I did not verify the coder's claim that the 31 create tests pass. The PR's verify run failed on an unrelated resolver test under an unpinned rustc. The notes also say that [network] mode in minimal.toml does not set the box's mode. That gap is not NET-060's, and this ruling does not require it.

Conditions

  • C1: crates/minimal/src/cmd/boxes/create.rs effective_egress(): the command-line layer unions its lists with the file's lists. It does not replace them (line 1196). For each of allow_subnets, allow_dns_hosts, allow_protocols and deny_subnets, the result is the file's items followed by the flag's items, with duplicates dropped. Replace flags.x.or(project.x). When both set a field, sources records ProjectFile and Flag for it. --deny-all-egress keeps the three allow lists present and empty (NET-140). It keeps the file's deny_subnets with source ProjectFile, and records no Flag source for deny_subnets, because EgressPolicy::deny_all() leaves that field None. Rename egress_flag_replaces_the_project_field to egress_flag_adds_to_the_project_field. Assert allow_subnets == ["10.0.0.0/8", "192.168.0.0/16"], and assert that a --deny-subnets flag keeps the file's deny ranges. Change the call-site comment ("replaced by the flag") and the T122 layer text "a flag replaces the file's value" to "a flag adds to the file's value" (rubric rule 9).
  • C2: crates/minimal/src/cmd/boxes/create.rs project_egress_from(): every refusal of the project's minimal.toml ends with exit 3 (line 364). The try_into error of [network.egress] (a toml::de::Error) returns ProjectFileInvalid { error: mfile::Error::Format(error) }. Do not use anyhow::anyhow! there. The mfile::network::canonicalize error returns the mfile::network::NetworkError unwrapped. failure_exit_code in crates/minimal/src/main.rs gets one arm: a downcast mfile::network::NetworkError returns its exit_code() (3). This one arm is outside the task's layers, and the condition admits it. Add a test that an unknown allow_protocols value and a wrong-shape network.egress both reach exit 3.
  • C3: crates/minimal/src/cmd/boxes/create.rs project_egress_from(): do not read [sessions.default] when the file declares other session entries. Take the entry body that a bare min session start picks (line 1178, BCLI-071). Read the entries with mfile::entry::read_entries. Use [sessions.default] when it is declared, else the only entry whose box_type is session. When the file declares two or more session entries, none of them default, and one of them carries network, refuse the start: name the entries and min session start <entry>. Do not fall back to [defaults] and [defaults.session] alone. A declared egress table is never dropped without a refusal. In project_egress_table_reaches_box_policy, add a file whose only session entry is [sessions.dev.network.egress], and assert that its rules reach the policy.
  • C4: File an issue for the T122 diagnostics line that this head does not meet: min session policy prints each egress field with its source, minimal.toml or a flag (crates/minimal/src/cmd/boxes/policy.rs, outside the task's layers). Line 1178 gives the same provenance for every value to the min box spec render. Name the issue URL in a Residuals section of the PR body. The PR body states the gap but names no issue (rubric rule 6). The debug line "the create request's effective egress" records the sources, and stays.

Ruled at ca8c95f against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5; arch_rulings 1038, job e37ec2b2-a7f0-4bff-a877-9b533af6764b.

0