Skip to content

[WSLC] Encapsulate ScriptResponse errors in a typed enum for the Rust SDK #794

Closed

Description

Description of the task

Today the WSLC backend surfaces SDK/HRESULT failures as free-text ScriptResponse errors. In src/backends/wslc/common/src/container_steps.rs the shared sdk_error() helper formats a string and calls ScriptResponse::error(&msg) (container_steps.rs:56-62), so callers and the Rust SDK only ever see an opaque message string with no machine-readable discriminant.

Follow-on from PR review feedback on PR #745 (reviewer Branden Bonaby (@bbonaby)):

question: I thought for ScriptResponse errors now we try to encapsulate the error in an enum error type since this would help the rust sdk. Could be wrong though but that seemed like a good error pattern.

Encapsulate WSLC error outcomes in a typed enum so the Rust SDK (and any other consumer) can match on the error kind instead of parsing strings.

Scope:

  • Introduce a typed error enum for the WSLC backend's failure modes (e.g. SDK/HRESULT failures, prerequisite-missing, validation/policy rejection, transport) rather than folding everything into a ScriptResponse message string.
  • Route sdk_error() and the other WSLC error construction sites through the typed enum, preserving the existing human-readable message via Display.
  • Map the typed enum to the SDK-facing error surface / ErrorCode so callers get a stable discriminant.
  • Preserve current behavior and messages — no functional change to what a user sees; validate with existing WSLC E2E on a live WSL host.

Additional context

Activity

  1. added
    Needs-TriageHas not yet been reviewed, classified, and routed.
    Issue-TaskEngineering, maintenance, or operational work that is not a bug or feature request.
    OS-WindowsApplies specifically to Windows hosts or Windows behavior.
    Backend-WSLCWindows WSL Container backend behavior or integration.
    on Aug 9, 2026
  2. github-actions commented on Aug 9, 2026

    @github-actions

    Triage summary

    • Labels added: Area-SDK-Api (in addition to existing OS-Windows, Container-WSLC)
    • Assigned: Soham Das (@SohamDas2021) (WSLC backend owner)

    This task targets the WSLC backend's error surface in src/backends/wslc/common/src/container_steps.rs, introducing a typed error enum and mapping it to the SDK-facing ErrorCode. Area-SDK-Api applies because the change is specifically about surfacing stable, machine-readable error discriminants to Rust SDK callers.

    Maintainers: Comment /investigate to check whether this issue or bug is valid against the most current code. Copilot will also produce a report with the changes that will be needed. For a small, unambiguous documentation or test fix, it may also create one draft PR.

    Generated by 🏷️ Issue Triage for #794 · 22.7 AIC · ⌖ 8.08 AIC · ⊞ 6.7K · ◷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Backend-WSLCWindows WSL Container backend behavior or integration.Issue-FeatureA request for new or expanded product functionality.Issue-TaskEngineering, maintenance, or operational work that is not a bug or feature request.OS-WindowsApplies specifically to Windows hosts or Windows behavior.Priority3Moderate or limited impact; address as capacity permits.

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions