Enhance sorting of installable files to prioritize shallower paths in getProjectInstallable function#1428
Open
eleanorjboyd wants to merge 5 commits intomicrosoft:mainfrom
Open
Enhance sorting of installable files to prioritize shallower paths in getProjectInstallable function#1428eleanorjboyd wants to merge 5 commits intomicrosoft:mainfrom
eleanorjboyd wants to merge 5 commits intomicrosoft:mainfrom
Conversation
… getProjectInstallable function
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Improves the ordering of detected installable files so that shallower (more top-level) dependency files are prioritized, addressing sorting issues in getProjectInstallable (helps with #1429).
Changes:
- Add depth-based sorting for matched installable URIs in
getProjectInstallable. - Add a unit test validating shallower paths are ordered before deeper ones.
Show a summary per file
| File | Description |
|---|---|
| src/managers/builtin/pipUtils.ts | Replaces default sort with a comparator that prioritizes shallower filesystem paths. |
| src/test/managers/builtin/pipUtils.unit.test.ts | Adds a regression test ensuring shallower requirements files appear first. |
Copilot's findings
Comments suppressed due to low confidence (1)
src/managers/builtin/pipUtils.ts:337
- The new depth sort implies the returned
installablesorder matters, but this block mutatesinstallablefrom concurrent async tasks. If any.tomlentries are present,await tomlParse(...)can cause laterpush(...)calls to occur out of the sorted order, making the finalinstallablesordering nondeterministic. To keep ordering deterministic, build per-URI results (e.g., return anInstallable[]from each mapper) and then flatten infilteredorder, or processfilteredsequentially when ordering is required.
await Promise.all(
filtered.map(async (uri) => {
if (uri.fsPath.endsWith('.toml')) {
const toml = await tomlParse(uri.fsPath);
// Validate pyproject.toml
if (!validationError) {
const error = validatePyprojectToml(toml);
if (error) {
validationError = {
message: error,
fileUri: uri,
};
}
}
installable.push(...getTomlInstallable(toml, uri));
} else {
const name = path.basename(uri.fsPath);
installable.push({
name,
uri,
displayName: name,
group: 'Requirements',
args: ['-r', uri.fsPath],
});
}
}),
);
- Files reviewed: 2/2 changed files
- Comments generated: 2
StellaHuang95
approved these changes
May 6, 2026
Contributor
|
looks good. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
helps with #1429