Skip to content

WSLC SDK install fallback uses repair#40908

Merged
JohnMcPMS merged 2 commits into
microsoft:masterfrom
JohnMcPMS:repair
Jun 25, 2026
Merged

WSLC SDK install fallback uses repair#40908
JohnMcPMS merged 2 commits into
microsoft:masterfrom
JohnMcPMS:repair

Conversation

@JohnMcPMS

@JohnMcPMS JohnMcPMS commented Jun 25, 2026

Copy link
Copy Markdown
Member

Summary of the Pull Request

Use repair semantics in the temporary WSLC SDK install API fallback to GitHub.

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Switch to repair semantics for this fallback path to prevent the SDK's version from being used as the current WSL install version:

if (!repair && ParseWslPackageVersion(version) <= wsl::shared::PackageVersion)

Also passes along the "we don't own the process" flag to DownloadFile to prevent progress output.

Validation Steps Performed

Manually confirmed that the latest GH release is installed when no DCAT is available.

@JohnMcPMS JohnMcPMS requested a review from a team as a code owner June 25, 2026 17:16
Copilot AI review requested due to automatic review settings June 25, 2026 17:16

Copilot AI 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.

Pull request overview

This PR adjusts the WSLC SDK’s temporary “fallback to GitHub” installation path (used when Windows Update finds no applicable WSL package update) to use repair semantics, avoiding an incorrect “update not needed” short-circuit caused by comparing against the SDK binary’s wsl::shared::PackageVersion.

Changes:

  • Switch the fallback install::UpdatePackage(...) call to Repair=true so the GitHub install path does not skip due to version filtering.
  • Add an inline comment documenting why pre-release builds + repair semantics are required in this SDK-driven fallback.

OneBlue
OneBlue previously approved these changes Jun 25, 2026
}
wsl::windows::common::install::UpdatePackage(true, false, false);
// Use pre-release builds and repair semantics (required since this function uses the SDK binary version as a filter).
wsl::windows::common::install::UpdatePackage(true, true, false);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we add test coverage for this ? We could do something similar to this test and validate that "a package" is installed (either via DCAT, or injected via the GH URL override).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For DCAT, we should be able to expect that short of publishing a version incongruent with its actual build number, no available package is newer than anywhere a test is running. However, the change here to force repair means that the code will attempt to install whatever latest version is presented to it. I suppose that an option for the test is to:

  1. expect no DCAT updates, but at least it ran the search
  2. return a url to the local server that doesn't exist
  3. have the test expect the install attempt that fails with a 404-type error

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We could also return a local server URL that actually serves package. If we uninstall it before running the test, we can validate that it was reinstalled once complete

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Although on top of all of that, the API isn't easily testable as we can't request what should be installed. If it can create a session manager, it won't attempt to update. Honestly that seems like a righteous change to the API, as currently you can:

  • Detect missing components (WslcGetMissingComponents)
  • Install missing components (WslcInstallWithDependencies)
  • Determine the installed WSL version (WslcGetVersion)

But you cannot attempt to update WSL after you have ensured that it is present but found that the installed version is too low for your scenario (3.0.0 adds support for feature X that you need, but 2.9.2 is installed).

Adding a WslcComponentFlags parameter to WslcInstallWithDependencies would allow that. The caller would decide what should be attempted, not us with an effective repeat of WslcGetMissingComponents. I think it would be wise then to also add an options parameter to provide the repair semantics (and potentially more later), as right now we force a DCAT update by overwriting the version.

On top of allowing all of that, it makes it much easier to test as we can directly request that code path be exercised rather than forcing a failed attempt to create a session manager.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Followup PR for no-update test and API changes.

@JohnMcPMS JohnMcPMS merged commit b1ad7f2 into microsoft:master Jun 25, 2026
9 checks passed
@JohnMcPMS JohnMcPMS deleted the repair branch June 25, 2026 21:15
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.

3 participants