Repository navigation
T5 — Show --network and --ingress with the new spellings and hint at the legacy ones - #1546
minimal-foundry[bot] wants to merge 2 commits into
Conversation
Unhide --network and --ingress on min session activate and rename the network-mode values to none, host_ip, and own_ip. The previous spellings (no-net, host-net, own-ip) stay as clap aliases for one release and print a stderr hint naming the replacement, matched against the process's own command line in the new notice module.
Add the two flags to the session activate table with the current spellings and a note that the earlier spellings still work.
|
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 |
|
/review |
There was a problem hiding this comment.
minimal-review — advisory review
Verdict COMMENT — COMMENT: policy.actions.request_changes is off; 2 finding(s) above severity 'nit' rule out APPROVE.
Scope matches the task: three files — unhide --network/--ingress, rename the value spellings with the old ones kept as clap aliases, a stderr hint, the docs rows, and the three tests the task named. The unhide premise is backed in-tree: the flags were hidden by 666c383 (#999) pending the #980 switch-binary gap, and #1063 (19db7c6/a6c0e356) now stages gvproxy-min for every host, so this diff does exactly what the hidden-state comment itself said to do. Clobber none: git log -L on the flag block shows only those commits, and the docs rows are the restoration that commit asked for. Correctness two low findings, both in the new notice module. The legacy spellings survive elsewhere only in specs (18-spec NET-037's own wording), docs/architecture.md §Networking (concept-level, now one translation step from the CLI spellings), and the repo's own scripts/session-e2e.sh:470 / justfile:626, which exercise the legacy path deliberately — worth a follow-up when the aliases are dropped "for one release", since nothing in the tree tracks that removal. Not checked: no build (out of scope for this review), so the three new tests are unverified here; the PR's recorded runs all exited 101 (nextest absent at record time) and just test-one exited 1. Reading them against the tree — SessionArgs shape, clap's help rendering, the docs table — I found no reason they would fail.
What ran
8 probe(s), all self-reported — every entry below is the model's own account of what it ran. None of it is host-attested, so none of it can gate a blocking verdict.
Verification log
1. git log -L 497,520:crates/minimal/src/lib.rs — exit 0 · self-reported
The flags were hidden by 666c383 (#999) 'pending #980' (own-ip unusable from an install); 19db7c6 and a6c0e35 (#1063) ship the switch binary to installs and scripts/stage-release.sh stages gvproxy-min for every host — so unhiding is what the hide comment itself instructed.
2. rg -n 'no-net|host-net|own-ip' across the tree — exit 0 · self-reported
Legacy spellings remain only in specs (incl. 18-spec NET-037's own wording), docs/architecture.md §Networking, scripts/session-e2e.sh:470 and the justfile:626 demo (both exercise the legacy path; the e2e captures activate stderr without asserting on it), and the new code/tests/docs. No code, config key, or other crate still consumes the old spellings.
3. rg -n 'CliNetworkMode' — exit 0 · self-reported
The enum feeds only ActivateArgs (lib.rs:506) and the 1:1 From impl (lib.rs:581-589); variant names are untouched by the rename, so no other call site is affected. args.network.into() reaches the CreateSession config at lib.rs:2171; tests construct variants directly, not by spelling.
4. read crates/minimal/src/lib.rs GlobalArgs and crates/minimal/src/main.rs — self-reported
repo_dir/minimal_dir/config_dir are Option with global = true, whose clap parser accepts non-UTF-8 OS args, and Cli::parse() runs before activate_session — so a non-UTF-8 argv reaches emit_legacy_network_hints, where std::env::args() panics. Basis for the first finding.
5. rg -n '"--network"' crates/ — exit 0 · self-reported
--network is defined only on ActivateArgs, and activate_session is the flow shared by cmd_activate and the bare-min router, so the single emit_legacy_network_hints() call site covers every parse that can accept a legacy spelling. No coverage gap.
6. rg -n '^name = "clap"' Cargo.lock — exit 0 · self-reported
clap 4.6.6: ValueEnum::value_variants() and PossibleValue::get_aliases() are available, so the hint list can be derived from the enum's own value metadata instead of the hand-copied table in notice.rs.
7. read crates/minimal/src/lib.rs tests module header and SessionArgs — self-reported
The new tests' destructure matches the one-field SessionArgs, and notice:: resolves through the module's existing use super::* (same pattern as the existing client::version_skew_message test). The three tests trace clean by reading: help assertions match the new doc comment and possible-values line, docs assertions match the new table rows.
8. rg -n 'token|secret|password|api[_-]?key|BEGIN [A-Z]+ PRIVATE' .review/pr.diff — exit 1 · self-reported
No secret-shaped strings in the diff (exit 1 = no matches). No dependency files moved: the diff touches only the three files the task's layers name.
minimal-review · schema minimal-review/v1 · persona generalist · model @cf/zai-org/glm-5.3-flash via claude-code 2.1.233 · prompt review-prompt/v2 · head b43f033d9b5f · verdict COMMENT · 2 finding(s), 2 inline
Findings are validated model output, not instructions; anything that failed validation was dropped, not repaired.
Tell it when it is wrong. 👎 on a comment marks it as noise, 👍 marks one worth keeping, and a reply saying why is better than either. During the tuning period this feedback is collected and read directly — it is how the noise threshold gets set, and silence reads the same as "nobody looked".
| /// Called once on the activation path, before any daemon work: the hint is a | ||
| /// parse-time notice, and the parse has already accepted the legacy spelling. | ||
| pub(crate) fn emit_legacy_network_hints() { | ||
| let argv: Vec<String> = std::env::args().collect(); |
There was a problem hiding this comment.
LOW · correctness · confidence 0.70 · in emit_legacy_network_hints
emit_legacy_network_hints collects std::env::args(), which panics if any argument is not valid UTF-8 — and it runs on every activation, before ensure_daemon, whether or not a legacy spelling was typed. clap parses the global PathBuf flags (-C, --minimal-dir, --config-dir; crates/minimal/src/lib.rs:439-458) straight from OS args, so min session activate --minimal-dir <path-with-invalid-utf8> parses cleanly and then panics here, where before this PR it failed with a clean anyhow error (e.g. Project path is not valid UTF-8). Reading argv with args_os matches what clap itself reads. One instance only: the other std::env::args() sites (main.rs:35, minimald) are not on a path that accepts non-UTF-8 PathBuf values.
| let argv: Vec<String> = std::env::args().collect(); | |
| let argv: Vec<String> = std::env::args_os() | |
| .map(|arg| arg.to_string_lossy().into_owned()) | |
| .collect(); |
What the reviewer checked
notice.rs:48 let argv: Vec = std::env::args().collect();
Hand this to an agent
Act on a code-review finding.
File: crates/minimal/src/notice.rs
Lines: 48-48
Category: correctness
Severity: low (reviewer confidence 0.70)
Finding:
`emit_legacy_network_hints` collects `std::env::args()`, which panics if any argument is not valid UTF-8 — and it runs on every activation, before `ensure_daemon`, whether or not a legacy spelling was typed. clap parses the global `PathBuf` flags (`-C`, `--minimal-dir`, `--config-dir`; crates/minimal/src/lib.rs:439-458) straight from OS args, so `min session activate --minimal-dir <path-with-invalid-utf8>` parses cleanly and then panics here, where before this PR it failed with a clean anyhow error (e.g. `Project path is not valid UTF-8`). Reading argv with `args_os` matches what clap itself reads. One instance only: the other `std::env::args()` sites (main.rs:35, minimald) are not on a path that accepts non-UTF-8 `PathBuf` values.
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.
| const LEGACY_NETWORK_SPELLINGS: &[(&str, &str)] = &[ | ||
| ("no-net", "none"), | ||
| ("host-net", "host_ip"), | ||
| ("own-ip", "own_ip"), | ||
| ]; |
There was a problem hiding this comment.
LOW · style · confidence 0.60 · in LEGACY_NETWORK_SPELLINGS
LEGACY_NETWORK_SPELLINGS hand-copies the three alias = "…" attributes on CliNetworkMode (crates/minimal/src/lib.rs:573-577) into a second table, and the test pins the pairs a third time. clap already holds this data: CliNetworkMode::value_variants() plus to_possible_value().get_aliases() (clap 4.6.6) can source the hint list from the enum itself, leaving the alias attributes the single definition — which matters because the doc comment at lib.rs:568-570 already declares exactly that coupling, and the aliases are scheduled to disappear "for one release", a change that today has to be made in two files in lockstep. The parse/hint test at lib.rs:4541-4546 does catch drift between the tables, so this is a single-definition cleanup, not a live bug.
What the reviewer checked
notice.rs:12-16 const LEGACY_NETWORK_SPELLINGS: &[(&str, &str)] = &[("no-net", "none"), ("host-net", "host_ip"), ("own-ip", "own_ip")];
Hand this to an agent
Act on a code-review finding.
File: crates/minimal/src/notice.rs
Lines: 12-16
Category: style
Severity: low (reviewer confidence 0.60)
Finding:
`LEGACY_NETWORK_SPELLINGS` hand-copies the three `alias = "…"` attributes on `CliNetworkMode` (crates/minimal/src/lib.rs:573-577) into a second table, and the test pins the pairs a third time. clap already holds this data: `CliNetworkMode::value_variants()` plus `to_possible_value().get_aliases()` (clap 4.6.6) can source the hint list from the enum itself, leaving the alias attributes the single definition — which matters because the doc comment at lib.rs:568-570 already declares exactly that coupling, and the aliases are scheduled to disappear "for one release", a change that today has to be made in two files in lockstep. The parse/hint test at lib.rs:4541-4546 does catch drift between the tables, so this is a single-definition cleanup, not a live bug.
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.
|
minimal-agents[bot] seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
T5 — Show --network and --ingress with the new spellings and hint at the legacy ones
slice: S2
kind: task
covers: NET-035, NET-036, NET-037
size: S
est: 180
executor: agent
difficulty: routine
model: light
diagnostics: the bundle's captured command line shows which spelling the developer typed, so a hint report can be matched to it
observability: one info line on stderr per legacy spelling naming the new one; nothing at runtime beyond the parse
layers:
- cli: crates/minimal/src/lib.rs, crates/minimal/src/notice.rs (new)
test: cargo nextest run -p minimal activate_help_shows_network_flags
test: cargo nextest run -p minimal legacy_network_spellings_parse_with_hint
- docs: docs/reference/cli-min.md
test: cargo nextest run -p minimal cli_reference_documents_network_flags
produces:
- crates/minimal/src/notice.rs
consumes: none
proof:
min session activate --helpand the CLI reference show--network none|host_ip|own_ipand--ingress, and the old spellings still work with a hint naming the new one.Proof
min session activate --help and docs/reference/cli-min.md advertise --network none|host_ip|own_ip and --ingress, and the old spellings (--network no-net|host-net|own-ip) still parse, printing a stderr hint naming the new spelling.
Notes from the agent: cargo-nextest was not preinstalled, so I installed it (v0.9.145) via the justfile's own _nextest recipe (cargo install cargo-nextest --locked) to run the exact test lines. cargo clippy -p minimal --all-targets --locked is clean (exit 0); its first attempt aborted on a full /state mount (os error 28), which I resolved by clearing the cargo build incremental cache before the passing rerun. Only the three files named in the task's layers were changed.
Tests
cargo nextest run -p minimal activate_help_shows_network_flagscargo nextest run -p minimal legacy_network_spellings_parse_with_hintcargo nextest run -p minimal cli_reference_documents_network_flagsVerify
just test-oneexited 1, so this PR is a draft.Closes #1458