Repository navigation
refactor: bundle repeated argument lists into named structs - #1553
Conversation
spawn and build took the same eleven positional arguments and spawn forwarded all of them unread. A HostParams struct removes both #[allow(clippy::too_many_arguments)] and the copy-paste-prone pass-through; the generic launcher stays a separate argument.
pgraph_copy_subset_for_node passed five invariant values through every recursive visit. SubsetCtx bundles them, so each visit names only the node it is on and the allow is gone.
Every one is a single-call-site constructor or forwarder where a parameter struct would exist only to be unpacked once, so each keep the allow with a one-line reason.
|
Warning Review paused — included plan limit reachedKeep your review moving with free on-demand reviews.
On-demand reviews are free for the next 2 days.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Promotion and pricing detailsOn-demand reviews are free for the next 2 days. After that, they cost $0.25 per reviewed file. Review limit detailsOr wait 18 minutes for your next included review. Limit details: You’ve used all 5 included reviews currently available. Your 15 included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (1)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (8)
Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. 📝 WalkthroughWalkthroughThe change bundles host and dependency traversal parameters into structs. It updates affected call sites and tests. Comments document why other positional interfaces remain unchanged. ChangesParameter refactors
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Refactor Suggested reviewers: Merge Risk: ⚪ Minimal · up to The parameter-bundling refactor has no identified behavior regression and is ready to merge. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
A rabbit reads each line, Comment |
There was a problem hiding this comment.
minimal-review — advisory review
Verdict COMMENT — COMMENT: policy.actions.request_changes is off; 1 finding(s) above severity 'nit' rule out APPROVE.
Scope matches the title: three commits bundling Host::spawn/Host::build's eleven positional args into HostParams, threading mip's package-graph walk through SubsetCtx, and a documentation commit for the remaining too_many_arguments sites. No dependency or lockfile movement; only the eight named files. Clobber none: git log on every touched file shows the PR commits at the top and no reverted fix. Correctness the refactors are faithful — I verified all eleven HostParams fields destructure in build and map 1:1 onto the original positional parameters (channel, control, delta, composition, session_id, archives_dir, ...), that every Host::build/Host::spawn caller (session.rs and the ten test sites) was updated, and that pgraph_copy_subset_for_node's body is unchanged apart from the ctx threading with sound borrow structure. The double /// doc on make_env is pre-existing (confirmed against the base). One finding below: the new // Left positional: comment on CheckCtx::new documents a rationale that does not hold, because that constructor has six call sites, not one. Not checked: compilation and the test suite, which would need a build (just clippy/just test per the PR body); the daemon-side change is claimed behavior-neutral and structurally appears so. The just e2e gap the author notes (no KVM host) is the right call for a signature-only refactor.
What ran
9 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. rg 'Host::build|Host::spawn' crates/ — exit 0 · self-reported
All 12 call sites (session.rs + 11 in session_host tests) are updated to the HostParams form; no stale positional callers.
2. rg -n 'CheckCtx::new' crates/ — exit 0 · self-reported
Six call sites: mctx/src/env.rs:187, mip/src/cmd_check.rs:95, check/src/outputs.rs:441, check/src/sources.rs:106, check/src/lib.rs:1361, minimald/src/session_sop.rs:604 — contradicts the 'one call site' claim in the new comment and PR body.
3. rg -n 'too_many_arguments' crates/ — exit 0 · self-reported
Six allow sites remain after the refactor, each carrying a new 'Left positional:' comment; the PR body says 'five sites' but mctx carries two of them.
4. rg -n 'run_in_session|run_one|new_orchestrator' crates/ — exit 0 · self-reported
Each of run_in_session (exec.rs:1308), run_one (hooks.rs:286), new_orchestrator (mctx/src/lib.rs:731) has exactly one call site, so those three comments are accurate.
5. git diff cb384e31 f46ced35 --name-only — exit 0 · self-reported
Eight source files only; no Cargo.toml/Cargo.lock/minimal.toml movement, so no supply-chain review needed.
6. git log --oneline -8 -- crates/minimald/src/session_host.rs crates/mip/src/cmd_pkg_dep.rs crates/check/src/lib.rs — exit 0 · self-reported
PR commits sit directly on the base (cb384e3); nothing recent reverted or overwritten.
7. git diff cb384e31 f46ced35 | grep -iE 'secret|password|token|api[_-]?key|BEGIN' — exit 1 · self-reported
No credential-like material in the diff.
8. read build() and pgraph_copy_subset_for_node() bodies — exit 0 · self-reported
Destructure and ctx-threading preserve every value and every branch; recursion guards (depth, already_exists) unchanged.
9. git show cb384e31:crates/mctx/src/lib.rs — exit 0 · self-reported
The double /// doc on make_env predates the PR; the comment-only commit merely inserts 'Left positional:' between existing doc comment and #[allow].
minimal-review · schema minimal-review/v1 · persona generalist · model claude-3-7-sonnet via claude-code · prompt review-prompt/v2 · head f46ced35a604 · verdict COMMENT · 1 finding(s), 1 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".
session_host.rs: take main's extracted mod tests; and reapply the HostParams update to the ten Host::build call sites in the moved session_host/tests.rs.
There was a problem hiding this comment.
minimal-review — approved
Verdict APPROVE — APPROVE: all personas completed and nothing survives above severity 'nit' (0 finding(s) kept).
Scope matches the title: two genuine param-struct conversions (HostParams for Host::spawn/build, SubsetCtx for the mip package-graph walk), rationale comments on the remaining too_many_arguments sites, and mechanical test updates. Nothing outside the stated intent. One metadata slip: the PR body and commit f46ced35 say "five sites left alone", but six sites carry // Left positional: comments.
Clobber none: the branch is three commits plus a merge of main; git log on every changed file shows no recent fix reverted, and the #1554 test-module split in base is intact.
Correctness — verified structurally, no defects found:
HostParamsfield set and order match the removed 11-positional signature one-for-one;builddestructures all 11 fields, and the comments from the oldsession.rscall site moved verbatim onto the matching fields.Host::spawnhas exactly one caller (session.rs:1987) andHost::buildexactly ten, all insession_host/tests.rs— every one converted; no missed sites.- Visibility is consistent:
Hostispub(crate)(session_host.rs:1538), sopub(crate) HostParamsin its signatures stays crate-visible. SubsetCtx: all threepgraph_copy_subset_for_nodecall sites (driver loop plus two recursive) now pass&mut SubsetCtx; the same five objects are threaded as before, so walk semantics are unchanged.- Five of the six
// Left positional:rationales check out against call-site counts (make_envandmake_env_with_networkare a public forwarder pair;run_in_session,run_one,new_orchestratoreach have a single caller).
Existing thread confirmed, not re-raised: the open thread at crates/check/src/lib.rs:355 is correct. CheckCtx::new is not a single-purpose constructor — it has six call sites (three production: mctx/src/env.rs:186, mip/src/cmd_check.rs:95, minimald/src/session_sop.rs:604; three test helpers: check/src/lib.rs:1361, check/src/outputs.rs:441, check/src/sources.rs:106). Its new comment states a false premise, and at eight args it is the only remaining over-threshold site that is multiply called — the one place the param-struct treatment the PR advocates would pay for itself. Since that thread is already open on the PR, this review does not duplicate it as a finding.
Not checked: builds, clippy, and e2e (out of bounds for this review, and the PR's own note that e2e needs a KVM host stands for a signature-only change).
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. rg -n 'CheckCtx::new' --type rust -g '!vendor' — exit 0 · self-reported
Six real call sites — mctx/src/env.rs:186, mip/src/cmd_check.rs:95, minimald/src/session_sop.rs:604 (production); check/src/lib.rs:1361, check/src/outputs.rs:441, check/src/sources.rs:106 (test helpers). Two further hits are doc mentions. The new comment's 'params type would exist only to feed this constructor' premise is false.
2. rg -n 'Host::spawn|Host::build' --type rust -g '!vendor' — exit 0 · self-reported
spawn has exactly one caller (session.rs:1987); build exactly ten, all in session_host/tests.rs. Every site converted to HostParams; no missed call sites.
3. compare HostParams field order against the removed 11-positional signature in pr.diff — self-reported
Field set and order match the old positional list one-for-one (name through connection_env); build destructures all 11 fields; the old call-site comments moved verbatim onto the matching fields.
4. rg -n 'pub(crate) struct Host|pub mod session_host' crates/minimald/src — exit 0 · self-reported
Host is pub(crate) (session_host.rs:1538) inside a pub mod, so pub(crate) HostParams in its pub fn signatures stays crate-visible; no private-type-in-public-interface hazard.
5. rg -n 'pgraph_copy_subset_for_node' crates/mip/src/cmd_pkg_dep.rs — exit 0 · self-reported
All three call sites (driver loop plus two recursive) now pass &mut SubsetCtx; the five invariant values thread the same objects as before, so walk semantics are unchanged.
6. git log --oneline -5 per changed file; git log --oneline 2da1c8fc..HEAD — exit 0 · self-reported
Branch is three commits (e90aab2, 7d0e25f, f46ced3) plus a merge of main; no recent fix reverted, and the #1554 test-module split in base is intact. Diff traces fully to the stated intent.
7. grep added diff lines for credential/token/key patterns — exit 0 · self-reported
No secrets in the diff; no dependency changes (Cargo.lock and Cargo.toml untouched), so no advisory scan needed.
8. rg -n 'too_many_arguments' --type rust -g '!vendor' plus call-site checks per remaining site — exit 0 · self-reported
Six remaining allow sites; five rationales verified accurate (make_env/make_env_with_network forwarder pair, run_in_session, run_one, new_orchestrator each single-caller). CheckCtx::new is the exception — see the first entry.
minimal-review · schema minimal-review/v1 · persona generalist · model claude-opus-4-5 via claude-code · prompt review-prompt/v2 · head 9c78a728c305 · verdict APPROVE · 0 finding(s), 0 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".
Summary
Host::spawnandHost::buildinminimaldtook the same eleven positionalarguments, and
spawnforwarded all of them tobuildwithout reading any.Two
#[allow(clippy::too_many_arguments)]attributes were the only thingkeeping the compiler quiet, and adding an argument meant editing both lists in
the same order.
A
HostParamsstruct now carries those eleven fields,spawnandbuildtakeit as one argument, and
builddestructures it. The generic launcher stays aseparate argument because it is the thing being abstracted over, not a
parameter.
mip's package-graph walk got the same treatment: five invariantvalues that every recursive visit passed along now travel in a
SubsetCtx, soa recursive call names only the node it is on.
The five sites left alone
The other
too_many_argumentssites stay positional. Each is a constructor orforwarder with one call site, where a parameter struct would exist only to be
unpacked once. That is ceremony, not clarity, so each keeps the allow with a
one-line comment stating why.
Testing
just e2ewas not run: it needs a KVM host, which this container does nothave. The daemon-side change is a signature refactor with no runtime behavior,
but the e2e proof still belongs on a KVM host before merge.
Checklist
BREAKING CHANGE:footer present if this is a breaking change (not breaking)Summary by CodeRabbit
Refactor
Documentation