Skip to content

Apply recent "pub get" workspace improves to "pub upgrade" - #6000

Merged
DanTup merged 1 commit into
masterfrom
apply-pub-get-fixes-to-pub-upgrade
Mar 24, 2026
Merged

DanTup merged 1 commit into
masterfrom
apply-pub-get-fixes-to-pub-upgrade

Conversation

@DanTup

@DanTup DanTup commented Mar 24, 2026

Copy link
Copy Markdown
Member

Fixes #5997

@DanTup DanTup added this to the v3.132.0 milestone Mar 24, 2026
@DanTup
DanTup requested a review from Copilot March 24, 2026 11:29
@DanTup DanTup added is enhancement An enhancement or improvement that should be listed in release notes but is not a bug fix. in commands Relates to commands (usually invoked from the command Palette) labels Mar 24, 2026
@codecov

codecov Bot commented Mar 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 67.91%. Comparing base (73490f8) to head (7fcd91c).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/extension/commands/packages.ts 94.44% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6000      +/-   ##
==========================================
+ Coverage   67.82%   67.91%   +0.08%     
==========================================
  Files         170      170              
  Lines       13008    12994      -14     
  Branches     2580     2574       -6     
==========================================
+ Hits         8823     8825       +2     
+ Misses       3725     3707      -18     
- Partials      460      462       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Copy link
Copy Markdown

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 refactors the pub get and pub upgrade commands to share common logic, significantly reducing code duplication. A new generic runPackageCommand method has been introduced to handle workspace detection, progress reporting, and batching for both commands. This correctly applies the recent workspace-aware improvements from pub get to pub upgrade, fixing the issue where pub upgrade would not run on the workspace root. The tests have also been refactored to be more concise and now cover both commands, ensuring the new shared logic works as expected for various scenarios.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR aligns the "pub upgrade" command behavior with the recent "pub get" workspace handling improvements, ensuring upgrades operate on Pub workspace roots (when applicable) rather than individual workspace projects. This addresses #5997.

Changes:

  • Refactors package command execution into shared helpers so both pub get and pub upgrade share the same workspace/target resolution logic.
  • Exposes upgradePackagesForUri via the internal test API and adds tests validating invocation paths for both get/upgrade commands.
  • Increases tryDelete() delete retry count to reduce flaky Windows test cleanup failures.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/extension/commands/packages.ts Extracts shared command runner logic and applies workspace mapping to pub upgrade (matching pub get).
src/shared/vscode/interfaces.ts Extends the internal test API surface with upgradePackagesForUri.
src/test/dart/pub/packages.test.ts Refactors tests to cover both dart.getPackages and dart.upgradePackages invocation path behavior.
src/test/helpers.ts Improves Windows reliability by increasing fs.rmSync retry count.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/test/dart/pub/packages.test.ts

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@DanTup
DanTup merged commit 421a081 into master Mar 24, 2026
30 checks passed
@DanTup
DanTup deleted the apply-pub-get-fixes-to-pub-upgrade branch March 24, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in commands Relates to commands (usually invoked from the command Palette) is enhancement An enhancement or improvement that should be listed in release notes but is not a bug fix.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recent changes to "Pub Get" to handle workspaces should apply equally to "Pub Upgrade"

2 participants