Skip to content

fix(backend): avoid release age cutoff for dependency envs#9808

Merged
jdx merged 1 commit into
jdx:mainfrom
risu729:fix-dependency-toolset-release-age
May 17, 2026
Merged

fix(backend): avoid release age cutoff for dependency envs#9808
jdx merged 1 commit into
jdx:mainfrom
risu729:fix-dependency-toolset-release-age

Conversation

@risu729

@risu729 risu729 commented May 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • resolve dependency toolsets in offline mode when building backend helper PATH/envs
  • keep global/per-command release-age cutoffs scoped to the tool being resolved, not helper tools used to query it

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 as npm view. When a global minimum_release_age is set, normal resolution applies that cutoff to every tool request, including configured helper tools like node@latest.

That can resolve node@latest to 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 for npm view can lose npm and 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() and Toolset::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 --check
  • Existing coverage: e2e/backend/test_npm_install_before exercises 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.

@greptile-apps

greptile-apps Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a bug in dependency_toolset() where a globally configured minimum_release_age was incorrectly applied to helper tools (e.g., node/npm) used by backends like npm when querying package metadata. The fix resolves the dependency toolset in offline mode so that already-installed helpers are selected without remote release-age filtering.

  • src/backend/mod.rs: Replaces ts.resolve(config) with ts.resolve_with_opts(config, &ResolveOptions { offline: true, ..Default::default() }) in dependency_toolset(), preventing the global release-age cutoff from choosing a different installed Node version for PATH construction.
  • The offline flag is additive (as documented on ResolveOptions::offline), and list_paths()/which() already filter to installed versions, so this change does not affect dependency installation — only which already-installed version is selected for the helper PATH.

Confidence Score: 5/5

Safe 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 offline: true flag is documented as additive to the global setting and simply skips remote version listing — list_paths() and which() already filter to installed versions, so the worst outcome of an offline resolution miss is the same as before (tool absent from PATH). The PR description provides a clear before/after analysis, and the existing e2e test test_npm_install_before covers the affected code path.

No files require special attention.

Important Files Changed

Filename Overview
src/backend/mod.rs Switches dependency_toolset from resolve to resolve_with_opts with offline: true, preventing global release-age cutoffs from affecting helper-tool resolution.

Reviews (2): Last reviewed commit: "fix(backend): avoid release age cutoff f..." | Re-trigger Greptile

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/backend/mod.rs
@risu729 risu729 force-pushed the fix-dependency-toolset-release-age branch from 78e3173 to a4f90df Compare May 13, 2026 14:31
@risu729 risu729 marked this pull request as ready for review May 14, 2026 00:11
@jdx jdx merged commit a392669 into jdx:main May 17, 2026
32 checks passed
@risu729 risu729 deleted the fix-dependency-toolset-release-age branch May 17, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants