You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
API: Advertise EnvironmentManager and PackageManager capabilities - #1874
Adds manager-agnostic feature detection for environment and package managers, with flat capability keys exposed through EnvironmentCapability and PackageCapability.
Managers may advertise contextual, read-only checks returning Support: supported, or unsupported with a reason. Support is advisory; unexpected probe failures reject rather than being treated as unsupported.
Capability maps are optional for legacy compatibility. Omitted maps use the new method-presence inference helpers and return isLegacy: true. Supplied maps must advertise every catalog key; missing keys return unsupported without legacy inference.
Adds public getEnvironmentManagerCapability and getPackageManagerCapability queries. Queries use currently registered providers without activation, registration waits, or prompts. Package queries honor project-bound routing; unregistered explicit projects return unavailable rather than using a containing project's provider.
Built-in managers advertise extension-supported behavior, including inline-script creation requirements, Poetry project binding, pip version-lookup support, and the Python 2 restriction on pip installation, uninstallation, and upgrades.
Adds capability-query telemetry with the routed manager, tool version, outcome, and legacy flag. Version collection runs asynchronously with a one-second timeout and cannot delay support results or probe errors.
Bumps @vscode/python-environments to 1.7.0 and updates public exports, package source copying, API-change checks, and documentation.
Validation
Lint and TypeScript checks passed.
Extension and API package builds passed; modern and legacy API consumer type-checks passed.
2,883 unit tests passed, with 7 pending.
2 capability integration tests passed, including production nested-project routing coverage.
The reason will be displayed to describe this comment to others. Learn more.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Contributes to #1837
As part of the efforts to streamline the API and simplify feature
detection (#1874), environment managers should have a mechanism to
advertise their versions. `PackageManager`'s already do this with a
`async getVersion()` method.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Exact URI comparison can incorrectly reject registered projects on Windows, and one capability reason misclassifies system-owned environments.
0 open findings
Files not reviewed (1)
api/package-lock.json: Generated file
Previously missed (2)
In code that hasn't changed since last review
Normalize file URI paths before project comparison
src/extensionApi.ts:205
This exact-URI comparison can reject a registered file project on Windows when the caller supplies an equivalent URI with different path casing or separators, returning unavailable before routing. Exact project checks elsewhere normalize fsPath (src/features/envManagers.ts:1070-1075); use the same normalized path comparison here (while preserving scheme/authority as needed).
Avoid misclassifying SysPythonManager environments as global
src/managers/builtin/sysPythonManager.ts:48
This reason incorrectly assumes every environment owned by SysPythonManager is a global installation. The manager also resolves arbitrary unknown interpreters and registers them under itself (sysPythonManager.ts:295-303, utils.ts:257-273), so a local virtual environment can receive this message. Describe the unsupported manager operation without classifying the environment as global.
Verification: Isolated verification failed: Consumer fixture type-checks using built declarations and locked dependencies. The relevant tests could not be fully run in the isolated environment; this review is not fully verified.
Summary: Targeted unit and regression runs passed: **442 passing, 5 pending**. TypeScript test compilation and the API package build also passed. However, both consumer fixtures failed type-checking: `api/test/consumer.ts:65` references `PackageCapability.ListAvailableVersions`, while the implementation exports `FetchAvailableVersions`. Full package validation was blocked by an uncached dependency, and Electron integration tests were not run, so the PR's validation claims are not fully confirmed.
Test runs: 4 passed, 1 failed, 2 not run
⚠️Not run | API build and packaged-consumer validation | npm run copy:sources && npm run compile && npm_config_offline=true npm_config_audit=false npm_config_fund=false npm run test:package
⚠️Not run | Manager capabilities integration | npm run integration-test -- --grep 'Manager capabilities integration'
✅ Passed | Dependency and test discovery | printf 'Sandbox profile: %s\n' "$AUTOMATION_SANDBOX_PROFILE"; node --version; npm --version; git status --short; git log -1 --format='%h %s'; node -e "const fs=require('fs'); for (const p of ['package.json','api/package.json']) { const j=require('./'+p); console.log(p, JSON.stringify(j.scripts,null,2)); } for(const p of ['node_modules','api/node_modules','out/test','build/.mocha.unittests.json','build/ci/unittest.js']) console.log(p,fs.existsSync(p));"; git diff HEAD^ HEAD --stat; find build src/test api/test -maxdepth 3 -type f ( -iname 'mocha' -o -iname 'capabilit' -o -name 'unittests.ts' ) -print
✅ Passed | Offline locked dependency preparation | npm ci --offline --ignore-scripts --no-audit --no-fund && npm ci --offline --ignore-scripts --no-audit --no-fund --prefix api
⚠️API build and packaged-consumer validation diagnostic output
Source copying and declaration, ESM, and CommonJS compilation completed successfully.
Package validation stopped during dependency preparation:
npm error code ENOTCACHED
npm error request to https://packagefeedproxy.microsoft.io/npm/@types/vscode/-/vscode-1.140.0.tgz failed: cache mode is 'only-if-cached' but no cached response is available.
Requires an Electron/VS Code extension host and downloaded extensions; unsupported by this offline verification environment.
❌ Consumer fixture type-checks using built declarations and locked dependencies diagnostic output
Both modern and legacy consumers failed with:
consumer.ts(59,7): error TS2741: Property '"packages.fetchversions"' is missing ... but required in type 'Readonly<Record<PackageManagerCapability, CapabilityCheck>>'.
consumer.ts(65,24): error TS2551: Property 'ListAvailableVersions' does not exist ... Did you mean 'FetchAvailableVersions'?
modern consumer exit=2
legacy consumer exit=2
Verification: The relevant tests could not be fully run in the isolated environment; this review is not fully verified.
Summary: Targeted capability tests passed: 41 tests covering legacy inference, provider probes, routing, telemetry timeouts, and built-in restrictions. Existing API, routing, and manager regression tests also passed. TypeScript compilation, lint, the extension build, and API package compilation succeeded. Packaged consumer validation was blocked by an uncached offline dependency; the two new Electron integration tests were not run. Verification is therefore partial.
Test runs: 5 passed, 2 not run
⚠️Not run | API build and packaged consumer validation | npm run copy:sources && npm run compile && npm_config_offline=true npm_config_audit=false npm_config_fund=false npm run test:package
⚠️Not run | Manager capabilities Electron integration tests
✅ Passed | Dependency and test discovery | pwd; printf '\nSandbox profile: '; printenv AUTOMATION_SANDBOX_PROFILE; printf '\nGit state\n'; git status --short; printf '\nRoot scripts and dependencies\n'; node -e 'const p=require("./package.json");console.log(JSON.stringify({scripts:p.scripts,devDependencies:p.devDependencies},null,2))'; printf '\nAPI scripts\n'; node -e 'console.log(JSON.stringify(require("./api/package.json"),null,2))'; printf '\nDependency and runner availability\n'; for p in node_modules node_modules/mocha/bin/mocha.js node_modules/typescript/bin/tsc api/node_modules .mocharc.json .mocharc.js; do if test -e "$p"; then ls -ld "$p"; fi; done; printf '\nTest entrypoints\n'; git ls-files 'mocha' 'unit' 'testconfig*' 'testsetup*' 'api/test/*' | head -90
✅ Passed | Offline dependency preparation | npm ci --offline --ignore-scripts --no-audit --no-fund && npm --prefix api ci --offline --ignore-scripts --no-audit --no-fund
✅ Passed | Lint and extension build | npm run lint > /tmp/capability-lint.log 2>&1; lint_status=$?; tail -n 20 /tmp/capability-lint.log; printf '\nLint exit: %s\n' "$lint_status"; npm run compile > /tmp/capability-build.log 2>&1; build_status=$?; tail -n 30 /tmp/capability-build.log; printf '\nExtension build exit: %s\n' "$build_status"; if test "$lint_status" -ne 0; then exit "$lint_status"; fi; exit "$build_status"
⚠️API build and packaged consumer validation diagnostic output
Source copying and declaration, ESM, and CommonJS compilation succeeded.
Packaged consumer tests could not start:
npm error code ENOTCACHED
npm error request to https://packagefeedproxy.microsoft.io/npm/@types/vscode/-/vscode-1.140.0.tgz failed: cache mode is 'only-if-cached' but no cached response is available.
[container exit=1]
⚠️Manager capabilities Electron integration tests diagnostic output
Two new integration tests require a VS Code Electron extension host and the Python extension. Electron tests requiring downloaded VS Code are unsupported in this verification environment; no integration command was invoked.
Verification: Isolated verification observed failures that were not classified as caused by this PR: Dependency and runner discovery. The relevant tests could not be fully run in the isolated environment; this review is not fully verified.
Summary: Ran 63 targeted unit tests in the disposable container; all passed, covering capability resolution, legacy inference, routing, telemetry timeouts, built-in managers, and existing API behavior. TypeScript compilation, extension and API builds, and linting of changed TypeScript files passed. Packaged-consumer validation was blocked by an uncached offline dependency, and the two new integration tests were not run because they require a VS Code extension host. Verification is therefore partial; no executed test failed.
Test runs: 4 passed, 1 failed, 2 not run
⚠️Not run | API build and packaged-consumer validation | npm run copy:sources && npm run compile && npm_config_offline=true npm_config_audit=false npm_config_fund=false npm run test:package
⚠️Not run | Manager capabilities integration tests
❌ Failed | unrelated to this PR | Dependency and runner discovery | printf 'PROFILE=%s\n' "$AUTOMATION_SANDBOX_PROFILE"; node --version; npm --version; git diff --stat; node -e "const p=require('./package.json'); console.log(JSON.stringify({scripts:p.scripts,devDependencies:p.devDependencies},null,2)); const fs=require('fs'); for (const x of ['node_modules','node_modules/mocha/bin/mocha.js','node_modules/typescript/bin/tsc','api/node_modules','out/test','build/testSettings.js']) console.log(x,fs.existsSync(x));"; ls build; ls -a | grep mocha
✅ Passed | Capability and pip unit tests | npm run compile-tests && node ./node_modules/mocha/bin/mocha.js --no-config --ui tdd --require source-map-support/register --require ./out/test/unittests.js --timeout 30000 out/test/capabilities.unit.test.js out/test/legacyCapabilities.unit.test.js out/test/extensionApi.capabilities.unit.test.js out/test/managers/builtinCapabilities.unit.test.js out/test/managers/builtin/pipPackageManager.unit.test.js
⚠️API build and packaged-consumer validation diagnostic output
Source copying and declaration, ESM, and CommonJS builds passed. Consumer validation stopped during dependency installation, before type-checking or runtime assertions:
npm error code ENOTCACHED
npm error request to https://packagefeedproxy.microsoft.io/npm/@types/vscode/-/vscode-1.140.0.tgz failed: cache mode is 'only-if-cached' but no cached response is available.
Not attempted: these two tests require a VS Code extension host and the Python extension. Electron tests requiring a downloaded VS Code instance are unsupported in this verification environment.
❌ Dependency and runner discovery diagnostic output
PROFILE=typescript
v22.21.1
10.9.4
warning: Not a git repository.
node_modules false
node_modules/mocha/bin/mocha.js false
node_modules/typescript/bin/tsc false
api/node_modules false
out/test false
The container lacks Git metadata; the final grep also found no root-level Mocha filename. Manifest and dependency discovery completed.
The reason will be displayed to describe this comment to others. Learn more.
Approved via Review Center.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
debtCode quality issuesno-mergePR is currently blocked from mergingreview-auto:approvedAutomated review: no blocking findings (approval posted).
4 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contributes to #1837.
Summary
Adds manager-agnostic feature detection for environment and package managers, with flat capability keys exposed through
EnvironmentCapabilityandPackageCapability.Support: supported, or unsupported with a reason. Support is advisory; unexpected probe failures reject rather than being treated as unsupported.isLegacy: true. Supplied maps must advertise every catalog key; missing keys return unsupported without legacy inference.getEnvironmentManagerCapabilityandgetPackageManagerCapabilityqueries. Queries use currently registered providers without activation, registration waits, or prompts. Package queries honor project-bound routing; unregistered explicit projects return unavailable rather than using a containing project's provider.@vscode/python-environmentsto 1.7.0 and updates public exports, package source copying, API-change checks, and documentation.Validation