fix(wslc): clarify WSL runtime prerequisite#656
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f46e1b1d-d428-4d1b-b9c3-b83ca7b35ec2
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
This PR clarifies WSLC prerequisite failures when WslcCanRun reports missing components, aligning runtime requirements (WSL runtime package minimum) with the getting-started documentation and adding a regression test for the new message.
Changes:
- Add a helper to produce a more specific WSLC prerequisite error when
WslcCanRunreportsWslPackagemissing, and add a unit test covering the message contents. - Update the WSLC getting-started guide to consistently document the minimum WSL runtime version (2.8.0+) and clarify that
wslcsdk.dllis a separate dependency.
Show a summary per file
| File | Description |
|---|---|
| src/backends/wslc/common/src/wsl_container_runner.rs | Improves prerequisite failure messaging from WslcCanRun and adds a unit test for the updated message. |
| docs/wsl/wsl-container-getting-started.md | Updates prerequisite and troubleshooting documentation to consistently state the WSLC minimum WSL runtime version and separate SDK DLL requirement. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Low
| fn wslc_prerequisite_error(missing: WslcComponentFlags) -> String { | ||
| if missing as u32 & WslcComponentFlags::WslPackage as u32 != 0 { | ||
| return format!( | ||
| "WSLC runtime not available. Missing components: {:?}. The installed WSL \ | ||
| package must be version 2.8.0 or newer. The WSLC SDK DLL is present, but \ | ||
| the WSL runtime is missing or too old. Update WSL with `wsl --update` \ | ||
| and verify the installed version with `wsl --version`.", | ||
| missing | ||
| ); | ||
| } | ||
|
|
||
| format!( | ||
| "WSLC runtime not available. Missing components: {:?}. Ensure WSL2 and the \ | ||
| WSLC SDK are installed.", | ||
| missing | ||
| ) | ||
| } |
| #[test] | ||
| fn wsl_package_prerequisite_error_explains_minimum_version() { | ||
| let message = wslc_prerequisite_error(WslcComponentFlags::WslPackage); | ||
|
|
||
| assert!(message.contains("2.8.0")); | ||
| assert!(message.contains("WSLC SDK DLL is present")); | ||
| assert!(message.contains("wsl --update")); | ||
| } | ||
| } |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f46e1b1d-d428-4d1b-b9c3-b83ca7b35ec2
| } | ||
|
|
||
| fn wslc_prerequisite_error(missing: WslcComponentFlags) -> String { | ||
| if missing as u32 & WslcComponentFlags::WslPackage as u32 != 0 { |
There was a problem hiding this comment.
WslcComponentFlags is a fieldless repr(u32) enum, but wslcsdk.h declares it as combinable flags. WslcCanRun can therefore return 3 when both components are missing, which is not a valid Rust enum discriminant and causes undefined behavior when read here. Please represent this FFI type as a transparent integer-backed bitmask and add coverage for combined values.
| fn wslc_prerequisite_error(missing: WslcComponentFlags) -> String { | ||
| if missing as u32 & WslcComponentFlags::WslPackage as u32 != 0 { | ||
| return format!( | ||
| "WSLC runtime unavailable. Missing components: {:?}. WSL 2.8.1 or newer \ |
There was a problem hiding this comment.
This string says 'runtime unavailable', the one at line 330 says 'runtime not available' as does line 241 of the .md file. Let's make them consistent.
| ScriptResponse::error(&msg) | ||
| } | ||
|
|
||
| fn wslc_prerequisite_error(missing: WslcComponentFlags) -> String { |
There was a problem hiding this comment.
The new helper has two user-facing message branches, but this PR adds no tests for either one. Please add table-driven tests covering WslPackage, VirtualMachinePlatform, and their combined value, asserting the version and remediation guidance selected for each case.
| fn wslc_prerequisite_error(missing: WslcComponentFlags) -> String { | ||
| if missing as u32 & WslcComponentFlags::WslPackage as u32 != 0 { | ||
| return format!( | ||
| "WSLC runtime unavailable. Missing components: {:?}. WSL 2.8.1 or newer \ |
There was a problem hiding this comment.
Jfyi, we are moving to the public release of 2.9 soon. That is the minimum publicly available version.
📖 Description
Clarifies the WSLC error when WSL is too old. The error now points users to WSL 2.8.1+ and
wsl --update; the getting-started guide is aligned.🔗 References
Resolves #553
🔍 Validation
cargo fmt --all -- --checkcargo test -p wslc_common(45 passed)✅ Checklist
Cargo.lock, thedependency-feed-checkcheck passes📋 Issue Type