Your CI was green yesterday. Today a Dependabot PR, a cargo update, or a fresh install bumped 15 packages at once and your test suite went red.
git bisect can't help you here: your code didn't change — your lockfile did.
So you end up doing the dreaded manual loop: pinning packages one by one, fighting half-broken transitive dependency graphs, waiting on rebuilds, and wondering if a test failure is a real regression or just an invalid package combination.
I built whichdep (v0.1.0, Apache-2.0) to automate that loop across Cargo, uv, pip, npm, and pnpm.
Try it in one command
whichdep is written in Rust with zero external runtime dependencies, and ships prebuilt native binaries for Linux, macOS, and Windows across all three registries:
# Node.js / npm (no install needed)
npx whichdep --good HEAD -- npm test
# Python (PyPI / uv)
uvx whichdep --good HEAD -- pytest
# or: pip install whichdep
# Rust (crates.io)
cargo install whichdep
You run it in your repo with the failing lockfile checked out and point --good at a working git revision (or lockfile path). Every trial runs in an isolated copy of your project, and build caches live outside your source tree — your working directory is never modified.
Why naive binary search breaks on lockfiles
At first glance, bisecting a lockfile diff sounds like a textbook binary search. In practice, three real-world constraints break naive bisection immediately:
1. Invalid lockfile mixes must not be blamed
If you apply half of a Cargo.lock or package-lock.json diff, you often produce a lockfile that cannot legally exist (a crate upgraded to a new major version without its updated transitive dependency, or a removed package still required by an un-upgraded parent).
If a tool treats "the package manager refused to install this mix" as "test failed", it confidently blames an innocent package.
whichdep uses three-valued outcomes (Pass, Fail, Unresolved) combined with Zeller's delta debugging (ddmin) and an adaptive binary-search strategy:
- Each adapter parses the lockfile dependency graph and builds a dependency closure (
up/down), so the search only proposes structurally closed configurations. - Before running your test command,
whichdepverifies that the package manager kept the rendered lockfile as written (e.g.,cargo fetch,npm ci,pnpm install --frozen-lockfile,uv sync --frozen,pip check). - Anything that cannot be resolved or built is classified
Unresolvedand skipped — never blamed.
2. True interactions vs. required companion updates
This was my favorite bug to catch right before v0.1.0.
When I tested whichdep against a live crates.io diff bumping rand from 0.8.5 to 0.9.5 (with RUSTFLAGS="-D warnings" turning the thread_rng deprecation into a failure), whichdep isolated the failure in 6 trials — and printed:
Cause: these updates break the tests together
getrandom 0.2.17 → 0.3.4
rand 0.8.5 → 0.9.5
rand_chacha 0.3.1 → 0.9.0
rand_core 0.6.4 → 0.9.5
And then suggested four separate cargo update ... --precise commands, starting with getrandom — which fails because rand 0.9.5 still requires getrandom 0.3!
The algorithm wasn't wrong — those four crates had to move together in the closure — but the explanation was misleading. They aren't four independent packages interacting; rand is the single root change and the other three are required companions.
Adding Closure::roots fixed both the diagnosis and the revert command:
Root cause
rand 0.8.5 → 0.9.5
Required companion updates:
getrandom 0.2.17 → 0.3.4
rand_chacha 0.3.1 → 0.9.0
rand_core 0.6.4 → 0.9.5
Verified: The bad lockfile without this cause passes the tests again.
To put it back to the good version:
cargo update rand@0.9.5 --precise 0.8.5
Now "these updates break the tests together" is reserved exclusively for genuine multi-root interactions (when two independent packages pass individually and only fail when upgraded together).
3. Flaky tests and "never confidently wrong"
A single flaky failure can derail a bisection and point at an innocent package. Passing --repeat 3 makes whichdep run each trial multiple times and treat any disagreement as Unresolved instead of Fail.
In our seeded flakiness benchmark (tests/flakiness_e4.rs, 300 rounds per cell, n = 20, adaptive strategy):
Flake rate p
|
--repeat 1 false causes |
--repeat 3 false causes |
|---|---|---|
| 5% | 0.7% | 0.0% |
| 10% | 1.3% | 0.0% |
| 20% | 8.7% | 0.0% |
And when a failure doesn't reproduce at all (for example, running the rand 0.9 test without RUSTFLAGS="-D warnings"), whichdep prints No result with the tail of the trial log — and even hints to try RUSTFLAGS="-D warnings" when Cargo emits compiler warnings on a passing run.
Early live-registry validation results
Before benchmarking large upstream repositories, I validated whichdep end-to-end against real PyPI, npm, and crates.io lockfiles using minimal synthetic reproducer harnesses for three well-known upstream breaking releases:
| Ecosystem | Breaking update | Changes | Trials | Unresolved | Wall time | Result |
|---|---|---|---|---|---|---|
Python (pip) |
httpx 0.27.2 → 0.28.1 (proxies= removed) |
7 | 7 | 1 | 36s | Exact root cause |
Node (npm) |
chalk 4.1.2 → 6.0.1 (CJS → ESM) |
14 | 7 | 0 | 4.2s | Exact root cause · Verified |
Rust (cargo) |
rand 0.8.5 → 0.9.5 (thread_rng under -D warnings) |
9 | 6 | 0 | 6.0s | Exact root cause + companions · Verified |
Every one of those three live runs caught a real edge case that offline unit tests missed:
- The
httpxrun revealed thatpipneeded reverse# viaclosure edges for removed transitive dependencies (sniffio) so revert verification passes cleanly. - The
chalkrun validated reverse closure restoration of 7 removed transitive packages in ~560ms per trial. - The
randrun exposed the root-vs-companion UX bug and led to the-D warningshint.
Running it automatically on Dependabot / Renovate PRs
whichdep also ships with a composite GitHub Action, sticky PR comments, $GITHUB_STEP_SUMMARY, and a machine-readable JSON format (whichdep-report-v2):
- uses: devel0mer/whichdep@v0.1.0
with:
good: origin/${{ github.base_ref }}
strategy: adaptive
test-command: cargo test -q
format: json
out: whichdep-report.json
github-summary: "true"
(See docs/PLATFORM.md in the repo for the recommended two-job workflow so untrusted PR code never gets write permissions to comment on PRs.)
What's next — and help wanted!
The three runs above are live-registry synthetic validations — real packages and lockfiles, minimal harnesses. My next milestone (E1 in PLAN.md) is building a public regression corpus of real upstream repository breakages (e.g., Bevy #12044, real Dependabot/Renovate PRs across Cargo, uv, npm, and pnpm) and comparing ddmin vs. adaptive trial counts.
If you've recently hit a gnarly lockfile update or Dependabot PR that broke CI in a public repo, drop a link in the comments — I'd love to add it to the corpus and test whichdep against it!

Top comments (10)
The detail I keep coming back to is the "No result" case — printing the tail of the trial log and actually hinting to try RUSTFLAGS="-D warnings" when Cargo emits warnings on a passing run. Most tools would just say "couldn't reproduce" and leave you to figure out that your test command was missing the precondition. That's the kind of UX that only comes from having been bitten by it yourself.
Also appreciate the honesty in the validation section: calling the three runs live-registry synthetic validations instead of dressing them up as real upstream breakages, and then making the real-world corpus the explicit next milestone. For the E1 comparison of ddmin vs adaptive trial counts, will you run it with --repeat 3 on? Flaky upstream suites would otherwise poison the comparison, and the repeat cost is exactly the kind of thing the corpus would quantify.
Thank you — that -D warnings hint really did come straight from getting bitten by it during the rand 0.9 validation!
Good timing too: I just landed the first two real upstream E1 reproductions in v0.1.1 (Bevy #12044 — 590-crate workspace, async-executor 1.8.0 → 1.9.0 deadlock, isolated & verified in 8 trials / 18s warm; and Synapse AI v1.8.6 — 31-change Python diff, mcp 1.30.0 → 2.3.0, which also pushed me to add dynamic pip check edge learning so even plain pip freeze lockfiles converge).
Great point on --repeat 3. For these first two I ran --repeat 1 to get a clean deterministic baseline (both oracles are deterministic, though Bevy #12044 is a timeout-based deadlock), and you're completely right that real upstream CI suites are rarely that clean. Adding a --repeat 3 column to the E1 corpus — especially to quantify the actual wall-time overhead vs. trial count on real repos — is a great idea, and I'll include that as I expand the corpus.
Congrats on landing those two — Bevy #12044 in a 590-crate workspace, isolated in 8 trials / 18s warm, is a much stronger proof point than a toy repro, and the Synapse one is a nice catch too, especially the plain pip freeze lockfile converging after the dynamic pip check. The --repeat 3 wall-time column is the number I'd actually want to see next: if the overhead stays modest on real repos, repeating becomes an easy default; if it balloons on timeout-based cases like Bevy, that's the honest trade-off to surface. Looking forward to seeing the corpus grow.
The three-valued outcome is the right call, but ddmin leans on monotonicity — a failing set stays failing under supersets — and dependency bumps break that constantly. Dropping one of two coupled bumps fixes the build, dropping a different one doesn't, so the granularity the search starts at decides whether the minimal cause is even reachable. Do you re-run ddmin at 1-minimal granularity after the adaptive pass lands on a candidate, or stop at the first verified set?
One thing that cut our trial time a lot: most Unresolved mixes don't need an install to detect.
npm install --package-lock-only --dry-run(orcargo metadata --offlineagainst the rendered lockfile) tells you the graph doesn't resolve in a few hundred ms, so the expensive test command only runs on mixes that actually install. And I'd keep the build cache per-configuration rather than shared — a staletarget/left by an earlier trial's passing build can make a broken mix look like Pass when incremental artifacts get reused.Great points — all three hit real failure modes I ran into while building this:
Adaptive + 1-minimality:
adaptiveonly stops on binary halving when it reduces all the way to a single unit (delta.len() <= 1). Whenever halving stalls on a set of size > 1 (interaction, closure coupling, or unresolved boundary), it hands off toddmin(minimize) on the warm cache and runs down togranularity == delta.len()for 1-minimality. For genuinely non-monotone failures where halving can still jump over a unit, there's also--strategy one-by-onewhich probes single units and single-unit reverts linearly.Fast pre-install
Unresolveddetection: For Cargo,whichdepalready verifies that the lockfile resolves without rewriting before running the test command (so unresolvable mixes never runcargo test). Adding a fastnpm install --package-lock-only --dry-runpre-check beforenpm ciis a great idea though — skippingnode_modulesunpacking on invalid mixes would save a ton of time on large JS repos. Definitely adding that to the list!Shared vs. per-configuration
CARGO_TARGET_DIR: Completely agree that stale incremental artifacts can be a footgun (especially withbuild.rs/ proc-macros). Right nowwhichdepshares an externalCARGO_TARGET_DIRper experiment by default for speed, and exposes--isolate-targetto isolate the target directory per rendered lockfile hash when you want strict hermeticity.Really appreciate the detailed feedback!
The root-versus-companion distinction is the part that makes this more than a faster bisect — blaming four packages when rand was the single root change and the rest were required companions is exactly the kind of confident-but-wrong answer that wastes an afternoon. Same with treating an unresolvable lockfile mix as Unresolved instead of a failure. The flakiness table is convincing too: at a 20% flake rate, --repeat 3 taking false causes from 8.7% to 0.0% is a real reason to pay for the extra trials. I have hit the 15-packages-at-once Dependabot version of this, pinning one by one, so a tool that only proposes structurally closed configurations is a welcome one.
Thank you so much — really glad those design choices resonated!
Catching the
randroot-vs-companion issue right beforev0.1.0was honestly the biggest UX win for me too. Without it, the tool was technically right about the minimal closed set, yet still handing the user a brokencargo update getrandom@...command.If you ever hit another 15-package Dependabot PR (or happen to have a public one from the past), I'd love to hear how
whichdephandles it — or add it to the real-world regression corpus!The root versus companion distinction is the whole tool. Blaming four packages when one moved and three followed is the kind of wrong answer that wastes an afternoon.
100% - catching that on the
rand 0.9test right beforev0.1.0completely changed how useful the output actually is. Knowing which one to revert instead of getting four conflictingcargo updatecommands is the whole point!Knowing which one to revert is the whole point. A list of cargo update commands never tells you that.