Repository navigation
T17 — Accept the four egress fields on own-address and host-address boxes and show the effective rules - #1690
Conversation
…s boxes EgressPolicy gains deny_subnets, held to the same launch-time CIDR check as the allow list, and validate_policy accepts an egress declaration on a host-address (HostNet) box too: both modes carry a network the rules can bound, so only a none (NoNet) box still rejects one (NET-060, NET-065, NET-120). The host-address rejection test is replaced by the acceptance test it superseded.
…ects egress The session-created info line now carries the parsed rule count per egress field beside the record it stores, and the policy-incompatibility rejection test moves to the none box — the only mode that still refuses an egress declaration now that host-address boxes accept one.
…etail pane A host-address box now renders its egress in the Policy pane instead of the blanket no-policy note — its declaration is accepted since NET-120 — and the pane lists the box's denied subnets beside the allow rules. Ingress stays an own-address section, and a none box keeps the no-policy note under its own name.
…ession policy 'min session activate' gains --allow-subnets, --allow-dns-hosts, --allow-protocols and --deny-subnets, which build the session's egress declaration for an own-address or host-address box (a none box is rejected daemon-side). 'min session policy' renders the effective rules through format_policy — each egress dimension resolved to its list or default, the ingress mappings spelled out — instead of raw JSON, and the CLI test pins the rendering against a policy stored through the daemon.
The activate flag table gains the four egress flags and the session policy section now describes the rendered effective rules it prints.
…-four-egress-fields-on-own-address-and
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
norrietaylor
left a comment
There was a problem hiding this comment.
Reviewed against the T17 plan block on #1437. Taking it out of draft: the one file outside the layers, crates/minimal/src/cmd/list.rs:68-71, is bare_activate_args() building ActivateArgs by literal, and the four new Vec::new() fields are required to compile. Forced change, not scope. All seven commits are authored work; the last is a clean merge of main.
Plan compliance. All four layers plus docs delivered.
- schema (
crates/sessions/src/lib.rs):deny_subnetsadded, CIDR validation extended withInvalidDenySubnet,validate_policyrejects egress only onNoNetand runs the CIDR checks for own-ip and host-ip boxes; the old host-net rejection test becameegress_on_host_ip_box_accepted, plus two extra in-layer tests for an invalid deny subnet and for ingress mappings on a host-ip box. - daemon (
crates/minimald/src/rpc.rs):EgressRuleCountson thesession createdline covers the diagnostics and observability lines. - tui:
policy_linesshows host-net egress and a deny-subnets row, snapshot regenerated; the ingress section is hidden on host-net, small and coherent. - cli: the four flags on
ActivateArgs,parse_egress_protoaccepting icmp,format_policyshared with the test;min session policyoutput moved from JSON to text. - docs: flag table and the rewritten
session policysection in the CLI reference.
Test lines. All six present and at exit 0 in the task status, agent-verify exit 0; ci-success and ci-linux-native-success green, build-linux, artifacts and kani still running at review time.
One fix wanted (revise posted). The new flag help in crates/minimal/src/cli.rs:467-468 and the doc row at docs/reference/cli-min.md:103 cite --network own-ip and --network host-net, which the same file defines as the legacy spellings that print a rename hint. The current forms are own_ip and host_ip, as the adjacent --ingress help already uses.
Non-blocking.
docs/concepts/sessions.md:219still says the policy is shown as JSON; outside the layers, follow-up filed.- No script or test parses the old JSON output (grep clean), so the format change breaks nothing in-tree; the PR body flags it for external consumers.
- The regenerated TUI snapshot carries an
assertion_lineheader, the only one in the repo; brittle, optional to strip. create_session_withandcreate_session_with_policyin the CLI tests are two thin wrappers where one would do.
|
/revise The new flag help in crates/minimal/src/cli.rs:467-468 and the doc row at docs/reference/cli-min.md:103 cite |
|
Reviewed: 1 finding, none blocking at Address the comments on the diff. Clobber: none. The task warned that |
…-four-egress-fields-on-own-address-and # Conflicts: # crates/minimal/tests/cli.rs
|
/revise The new flag help in crates/minimal/src/cli.rs:467-468 and the doc row at docs/reference/cli-min.md:103 cite |
The --allow-subnets help text and its doc row named --network own-ip and --network host-net, which the CLI treats as legacy spellings that print a rename hint. Name the current own_ip and host_ip forms instead, matching the adjacent --ingress help and doc row.
min session policy printed 'ingress / deny all' for a host-address session, implying a per-session deny-rule exists. A host-address box shares its host's namespace, so minimald applies no per-session ingress to it at all — the TUI's detail pane already suppresses the block for exactly that reason, and the two renderers disagreed. format_policy now takes the session's network mode (resolved from the record the policy rides on) and skips the block for host-address sessions, matching the TUI; the effective-rules test pins both the own-address and the host-address renderings.
…-four-egress-fields-on-own-address-and
|
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:
A box spec with allow_subnets, allow_dns_hosts, allow_protocols and deny_subnets is accepted on an own-address or host-address box and rejected on a none box, and Notes from the agent: Revise round 2. Two directive items, both addressed; nothing else changed, and no file outside the task's layers was touched. (1) The /revise note: the --allow-subnets help in cli.rs and the flag row in docs/reference/cli-min.md now cite --network own_ip and --network host_ip instead of the legacy own-ip/host-net spellings (commit 18006e1). (2) The review thread at session.rs:947: format_policy now takes the session's NetworkMode and omits the ingress block for host-address sessions, matching the TUI; the finding held, since minimald rejects ingress on a HostNet box (PolicyError::IngressRequiresOwnIp) and the stored policy.ingress is therefore always None there, so the old 'deny all' row claimed a rule that does not exist (commit 4742b2f). Implementation detail worth knowing: the GetSessionPolicy reply carries only the rules, so cmd_session_policy now resolves the session record first (the existing resolve_session helper, one extra oneshot RPC) to read record.network — extending the minimald-rpc wire type was out of scope. All six plan test lines were re-run at the merged head 707049b plus these two commits, as were the pinned-test neighbours in the crates whose code I did not touch (sessions/minimald/minimal-tui lines pass unchanged). |
|
/revise Address the open review thread on crates/minimal-tui/src/render.rs:538: |
min session policy still printed 'egress / allow all' and 'ingress / deny all' for a none session, while the TUI's detail pane hides the whole policy for the same box: a none box has no network, so no rule there describes anything real and 'allow all' claims a reach it does not have. format_policy now renders the same special case the pane does — the one-line note, no egress or ingress block — and the effective-rules test pins the none rendering beside the own-address and host-address ones.
…-four-egress-fields-on-own-address-and
|
Round 3 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:
min session policy shows a box's effective rules: the four egress fields on an own-address or host-address box (the latter with no ingress block), and a none box now prints only the one-line no-network note the TUI's detail pane shows, instead of an 'egress / allow all' and 'ingress / deny all' a box with no network could not have. Notes from the agent: Revise round 3: the task's own layers were already committed by earlier rounds; this round addressed the single open thread. format_policy in crates/minimal/src/cmd/session.rs special-cases NoNet with the TUI's 'No network policy (NoNet)' note and prints no egress or ingress block, and policy_shows_effective_egress gained a none-session case next to the host-address one, pinned by exact output. docs/reference/cli-min.md was left unchanged because the directive said 'no other change'; its policy section still describes only the own-address and host-address renderings. Also ran cargo fmt and cargo clippy -p minimal --all-targets --locked -- -D warnings (both clean); the fmt pass landed as its own style commit. |
norrietaylor
left a comment
There was a problem hiding this comment.
Round 3 verified against the T17 plan block: format_policy prints the one-line NoNet note in place of both blocks, matching the TUI renderer on the same head, and policy_shows_effective_egress pins it. The only out-of-layer file, cmd/list.rs, carries the struct-literal fields the schema change requires (same as rounds 1–2, already judged in scope). All lanes green except build-linux, still running; auto-merge armed behind it.
T17 — Accept the four egress fields on own-address and host-address boxes and show the effective rules
slice: S4
kind: task
covers: NET-060, NET-061, NET-065, NET-120
size: L
est: 300 code, 400 tests
executor: agent
difficulty: routine
model: standard
diagnostics: the daemon log names the parsed rule counts per egress field at session start, beside the record it stores
observability: one info log line per session start with the rule counts per egress field
layers:
- schema:
- crates/sessions/src/lib.rs: EgressPolicy gains deny_subnets; the subnet check covers it; validate_policy accepts egress on a host-address box and rejects it only on a none box; the host-address rejection test is replaced
- crates/sessions/src/store.rs: its EgressPolicy literal gains the field
test: cargo nextest run -p sessions spec_accepts_egress_fields
test: cargo nextest run -p sessions egress_on_none_box_is_validation_error
test: cargo nextest run -p sessions egress_on_host_ip_box_accepted
- daemon:
- crates/minimald/src/rpc.rs: two EgressPolicy literals gain the field; the rejection test uses a none box
test: cargo nextest run -p minimald create_session_rejects_policy_incompatible_with_network_mode
- tui:
- crates/minimal-tui/src/render.rs: the detail pane shows host-address egress and deny_subnets
- crates/minimal-tui/tests/snapshots.rs: its EgressPolicy literal gains the field
- crates/minimal-tui/tests/snapshots/snapshots__detail_pane_with_policy.snap: the snapshot shows the new line
test: cargo nextest run -p minimal-tui detail_pane_with_policy
- cli:
- crates/minimal/src/cli.rs: ActivateArgs gains the egress flags
- crates/minimal/src/cmd/session.rs: activate builds egress from the flags; session policy renders the effective rules through a testable function
- crates/minimal/tests/cli.rs: hosts the effective-rules test
test: cargo nextest run -p minimal policy_shows_effective_egress
- docs:
- docs/reference/cli-min.md: documents the egress flags and the policy output
produces: none
consumes: none
proof: A box spec with allow_subnets, allow_protocols, allow_dns_hosts and deny_subnets is accepted on an own-address or host-address box, rejected on a none box, and
min session policyshows the effective rules.Proof
A box spec with allow_subnets, allow_protocols, allow_dns_hosts and deny_subnets is accepted on an own-address or host-address box and rejected on a none box (validation names the none box as the only refusing mode), the daemon logs the parsed rule count per egress field beside the record it stores at session start, the TUI detail pane renders host-address egress with its deny subnets, and
min session policyprints the effective rules — each egress dimension resolved to its list or default, deny subnets included, and the ingress mappings spelled out.Notes from the agent: Out-of-layer file: crates/minimal/src/cmd/list.rs —
bare_activate_argsconstructs ActivateArgs by literal and needed the four new empty fields to compile (EgressPolicy is deliberately not non_exhaustive, so every literal site must list the field). Two other notes for the next tasks: (1)min session policychanged from raw JSON to rendered text; scripts that parsed the JSON must adapt — the docs now describe the text form. (2) PolicyError::EgressRequiresOwnIp was renamed EgressRequiresNetwork and its message reworded, since the rejection now fires only for NoNet. The deny_subnets declaration is accepted and stored everywhere but enforced nowhere yet: enforcement is NET-062/064/067's, the deny-all default is NET-074/075's, and host-address enforcement is the classifier work under NET-079. The first minimal-tui run of detail_pane_with_policy failed before the regenerated snapshot was accepted; every line above was re-run to green afterwards, and clippy --all-targets plus cargo fmt are clean on sessions, minimald, minimal, minimal-tui (and minvmd still compiles over the widened EgressPolicy).Tests
cargo nextest run -p sessions spec_accepts_egress_fieldscargo nextest run -p sessions egress_on_none_box_is_validation_errorcargo nextest run -p sessions egress_on_host_ip_box_acceptedcargo nextest run -p minimald create_session_rejects_policy_incompatible_with_network_modecargo nextest run -p minimal-tui detail_pane_with_policycargo nextest run -p minimal policy_shows_effective_egressVerify
min task run agent-verifypassed ([tasks.verify]).Base
The base branch moved while the coder worked and was merged in before the tests ran. These files changed on BOTH sides since the branch point — read them first, because a rewrite from a stale reading can undo a merge without a conflict:
crates/minimal/src/cli.rscrates/minimal/src/cmd/session.rsdocs/reference/cli-min.mdOut of scope
These files are outside the task's
layers:, so this PR is a draft:crates/minimal/src/cmd/list.rsCloses #1617