fix(backend): avoid release age cutoff for dependency envs#9808
Conversation
Greptile SummaryThis PR fixes a bug in
Confidence Score: 5/5Safe to merge — the change is a single-line switch to offline resolution scoped exclusively to helper-tool PATH construction, with no impact on dependency installation. The change is minimal and well-contained: it only affects how already-configured helper tools are resolved for PATH entries, not how tools are installed. The No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "fix(backend): avoid release age cutoff f..." | Re-trigger Greptile |
There was a problem hiding this comment.
Code Review
This pull request updates the toolset resolution in src/backend/mod.rs to use offline mode for dependency environments, aiming to avoid network calls and release-age cutoffs. The reviewer pointed out that setting offline: true does not actually bypass the minimum_release_age logic for versions already in the cache. To fix this, it was suggested to explicitly set the before_date in ResolveOptions to the current timestamp, ensuring all available versions are considered valid regardless of their release age.
78e3173 to
a4f90df
Compare
Summary
Why this is a bug
dependency_toolset()is used by backends like npm to put already-available helper tools on PATH before running commands such asnpm view. When a globalminimum_release_ageis set, normal resolution applies that cutoff to every tool request, including configured helper tools likenode@latest.That can resolve
node@latestto an older Node release selected by the cutoff. If the user already has a newer Node installed, the dependency toolset no longer points at the installed helper, so the PATH used fornpm viewcan losenpmand backend version lookup fails. The release-age setting is meant to filter the target package version, not make helper tool discovery pick a different Node.Why this fix is safe
Dependency envs only need PATH entries for helper tools that are already available.
Toolset::list_paths()andToolset::which()both filter to installed/current versions, so resolving the dependency toolset offline only prevents remote release-age filtering from changing which installed helper is selected.This does not change dependency installation. Missing dependencies are installed by the install dependency graph (
ToolDeps) before dependents run. If a dependency is not installed and is not part of the install set,dependency_toolset()could not put it on PATH before this change either, because PATH generation already filtered out non-installed tools. Commands that need npm/node and do not have it installed still warn/fail the same way; once the dependency is installed, offline resolution can pick the installed version.Testing
git diff --checke2e/backend/test_npm_install_beforeexercises the npm release-age lookup that exposed this bug. Local execution was blocked by the shared Cargo build queue; CI should run it on this isolated branch.