feat(minimal2): add --network and --ingress flags to activate - #570
feat(minimal2): add --network and --ingress flags to activate#570norrietaylor wants to merge 2 commits into
Conversation
`minimal activate` hardcoded NetworkMode::default() (HostNet) with empty policy, so NoNet/OwnIp and ingress port mappings had no CLI surface and were reachable only via the netns proofs constructing a Record directly. - `--network <no-net|host-net|own-ip>` (default host-net; no-flag behavior unchanged) via a local CliNetworkMode ValueEnum, keeping the sessions crate free of a clap dependency. - `--ingress EXT:INT[/PROTO]` (repeatable; PROTO defaults tcp) parsed into sessions::PortMapping; non-tcp/udp and malformed specs rejected at parse time. - Surface the daemon's typed CreateSession validation error (e.g. ingress on a non-own-ip session) instead of a generic failure line. Daemon-side validate_policy is unchanged and remains the enforcement point. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0143kv2BRrRqGxmVwwHskQtS
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe ChangesMinimal activate networking
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
minimal activatehardcodedNetworkMode::default()(HostNet) and an empty policy, soNoNet/OwnIpand ingress port mappings had no CLI surface — they were reachable only via the netns proofs that construct aRecorddirectly (crates/minimald/src/rpc.rs:675). This adds the activate flags.Changes
crates/minimal2/src/main.rs:--network <no-net|host-net|own-ip>(defaulthost-net; no-flag behavior unchanged) via a localCliNetworkModeValueEnum+From<CliNetworkMode> for sessions::NetworkMode, keeping thesessionscrate free of a clap dependency.--ingress EXT:INT[/PROTO](repeatable; PROTO defaultstcp) parsed intosessions::PortMapping. Malformed specs and non-tcp/udp protocols are rejected at parse time.CreateSessionvalidation error (e.g. ingress on a non-own-ipsession, privileged host port) instead of the genericreturned an error from the daemonline.Scope
minimal activatestill creates aHostNetsession with empty policy.Record::validate_policyis the enforcement point and is unchanged — the CLI builds theRecordand surfaces the daemon's verdict.--ingresssets staticport_mappingsonly, notdynamic_allowed_range.Verification
Docker
rust:1.95+protobuf-compiler,--locked,CARGO_INCREMENTAL=0:cargo fmt --all -- --check— cleancargo clippy -p minimal2 --all-targets -- -D warnings— cleancargo test -p minimal2— 6 passed (3 new parser tests: tcp default, explicit proto, malformed/bad-proto rejection)minimal activate --helprenders the flags above🤖 Generated with Claude Code
Summary by CodeRabbit
minimal activate.--ingress EXT:INT[/PROTO]flag, including protocol selection.