8000
`mip dump --stacks` and any package with a `HostPath` build dep both reached `todo!()` macros in `cmd_dump` and panicked at runtime, even though the flag parses and the dependency is valid. Implement the `--stacks` output branch: collect stacks from the graph, filter them by the shared `--name`/`--exact` query, and sort by name so the JSON dump is stable across runs (stacks live in a `HashMap`). The `DumpKind` clap group is `required = true, multiple = false`, so the remaining match arm is genuinely unreachable. Map `BuildDep::HostPath` to a new `PkgRef::HostPath` variant in `pkg_ref_from_input`, making the match exhaustive over every `BuildDep` variant so a future addition fails to compile rather than panic.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
…iant The `HostPath` build-dep was `#[allow(dead_code)]` throughout, was never materialized into a build sandbox, and only ever reached a `todo!()` when a package carrying one was dumped. Rather than handle that panic (as the previous commit did for `mip dum 8000 p`), remove the variant outright: - Drop the `HostPath` type and its `BuildDep` contract arm from the Nickel stdlib (and `'Path` from `Tys`). - Remove `ObjTy::Path` and `from_term_hostpath` from decode. - Remove the `BuildDep::HostPath` variant and every match arm across graph (loader, spec_hasher, transitives, planner, graph, wire). - Remove `NodeData::HostPath` and the `--hostpath-deps` flag from `mip dep`, and revert the `PkgRef::HostPath` mapping in `mip dump` (the match over `BuildDep` is now exhaustive without it). The two golden-hash tests in `graph::spec_hasher` that used a HostPath dep as filler now build their spec in Rust, so the hash is deterministic across architectures and no longer needs the `arch_hash!` macro. BREAKING CHANGE: the `HostPath` build-dep type is removed from the Nickel stdlib; a config using `| HostPath` no longer parses. It was non-functional (never built; dumping it panicked), so no working configuration is affected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fixes #838
Routing-Key: inbox-route/I_kwDOSUhdos8AAAABJPmOPg
Problem
crates/mip/src/cmd_dump.rshad two reachabletodo!()macros that panicked at runtime on advertised flag combinations:cmd_dump()only handledDumpKind { packages: true, stacks: false };mip dump --stacks(the required-group alternative to-p/--packages) fell through totodo!("output not implemented: {:?}", args.kind).pkg_ref_from_input()matched onlyBuild,Local,Subset, andSource, so aBuildDep::HostPath— the one remainingBuildDepvariant — hit_ => todo!("bsi variant {:?}", i). Any package with a host-path build dep panicked the dump.Fix
This PR is two commits:
1.
fix(mip): dump --stacks and HostPath deps instead of panickingAdds a
--stacksoutput branch that collects stacks viagraph.iter_stacks(), applies the same--name/--exactfilter the packages path uses, and sorts by name (stacks live in aHashMap, so deterministic ordering matters). The filtering/sorting is factored into a small pureselect_stackshelper — mirroring how #146 extractedresolve_targetsocmd_dumpinternals stay unit-testable without aContext.2.
refactor(decode,graph,mip)!: remove the unused HostPath build dep variantRather than handle the
HostPathpanic, this removes the variant entirely.BuildDep::HostPathwas#[allow(dead_code)]throughout, was never materialized into a build sandbox, and only ever reached atodo!()when dumped — aspirational, never-functional surface. Removing it:HostPathtype and itsBuildDepcontract arm from the Nickel stdlib (and'PathfromTys).ObjTy::Pathandfrom_term_hostpathfrom decode.BuildDep::HostPathvariant and every match arm across graph (loader, spec_hasher, transitives, planner, graph, wire). The matches overBuildDepare now exhaustive without a wildcard, so a future variant fails to compile instead of reintroducing a runtime panic.NodeData::HostPathand the--hostpath-depsflag frommip dep, and reverts thePkgRef::HostPathmapping added in commit 1.The two golden-hash tests in
graph::spec_hasherthat used a HostPath build dep as filler now construct their spec in Rust instead of via Nickel, so the hash is deterministic across architectures and no longer needs thearch_hash!macro.BREAKING CHANGE: the
HostPathbuild-dep type is removed from the Nickel stdlib; a.nclusing| 8000 HostPathno longer parses. It was non-functional (never built; dumping it panicked), so no working configuration is affected.Verification
All commands run from the workspace root:
cargo fmt --all— clean, no drift.cargo clippy --workspace --all-targets -- -D warnings— exit 0, no warnings.cargo test --workspace— exit 0; every test binary passed. The rewrittenattrs_hash/subset_hashgolden-hash tests pass with single architecture-independent hashes.