Skip to content

feat(wsl): auto-terminate distros instead of prompting (SC-017)#74

Merged
xxthunder merged 3 commits into
developfrom
sc-017-auto-terminate-distros
May 5, 2026
Merged

feat(wsl): auto-terminate distros instead of prompting (SC-017)#74
xxthunder merged 3 commits into
developfrom
sc-017-auto-terminate-distros

Conversation

@xxthunder

@xxthunder xxthunder commented May 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace user-facing "please run wsl --terminate" messages and running-state guard rails (in update, clone, remove, repair-interop, setup-user) with automatic Stop-WslDistro calls — actions complete without manual intervention.
  • Auto-terminate after setup-proxy so a fresh shell loads the updated ~/.profile; auto-shutdown after configure-wsl so the new .wslconfig settings take effect.
  • Consistency pass on setup-docker/setup-podman pre-config restart: replace Invoke-CommandLine wsl.exe --terminate + Start-Sleep with Stop-WslDistro to gain verification + retry.

Closes

  • SC-017

Test plan

  • Unit tests pass (testrunner.ps1 -Unit): 997/997
  • Integration tests pass for the SC-017 scope: WSL Manager Docker + Podman idempotency suites both green on rerun
  • New auto-terminate integration test (Should auto-terminate the distribution and complete update when running) passes
  • CI green

Notes

  • During testing, two unrelated DevPod tests in the Podman suite flaked once on a transient curl: (7) Failed to connect to github.com — the immediately-following idempotency test in the same context downloaded the same 81.9 MB binary successfully. Not caused by SC-017; CI rerun should clear it.
  • SC-016e (which adds Read-SpectreConfirm for the explicit destructive commands remove/terminate/shutdown) is intentionally kept separate. SC-017 removes prompts on side-effect terminations; SC-016e adds confirmations on user-invoked destructive commands. They don't overlap.

🤖 Generated with Claude Code

Replace user-facing "please run wsl --terminate" messages and
running-state guard rails with automatic Stop-WslDistro calls so
update/clone/remove and the various setup-* actions succeed without
manual intervention. Invoke-ConfigureWsl now auto-shuts down WSL when
.wslconfig changed, since the new global settings only take effect
after a subsystem restart.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@codecov

codecov Bot commented May 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.00%. Comparing base (5ec3078) to head (f8728be).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #74      +/-   ##
===========================================
- Coverage    86.07%   86.00%   -0.07%     
===========================================
  Files           22       22              
  Lines         1917     1908       -9     
===========================================
- Hits          1650     1641       -9     
  Misses         267      267              
Flag Coverage Δ
PS7 86.00% <100.00%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@xxthunder

Copy link
Copy Markdown
Owner Author

@claude opus review thoroughly. In addition check if code coverage can be increased by this pull request.

@claude

claude Bot commented May 3, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

xxthunder and others added 2 commits May 4, 2026 17:02
…-017)

A post-merge review of SC-017 (auto-terminate distros) surfaced an
incomplete migration (New-WslUser still uses raw wsl.exe --terminate),
a regression in Install-WslProxy that mis-reports termination failures
as proxy failures, dropped integration coverage for clone/remove, and
stale doc references. Reopen SC-017 with new ACs covering each gap, and
add SC-037 for the unrelated WSL Manager unit test coverage gaps found
during the review.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…tion coverage, docs (SC-017)

Address the four post-merge review gaps that re-opened SC-017:

- New-WslUser: replace raw wsl.exe --terminate + Start-Sleep with
  Stop-WslDistro; add user.Tests.ps1 assertion for the auto-terminate
  call.
- Install-WslProxy: wrap Stop-WslDistro in its own try/catch so a
  termination failure no longer mis-reports a successful proxy
  configuration as failed; emit Write-Warning instead. Add Pester test.
- manager.docker.Integration.Tests.ps1: add clone and remove auto-
  terminate integration tests paralleling the existing update test, with
  try/finally cleanup of the temp distros.
- docker.ps1 .NOTES and docs/wsl-manager.md: drop stale manual-terminate
  instruction; clarify that configure-wsl terminates ALL running
  distributions (a wsl --shutdown is required to apply .wslconfig).

Unit tests: 744 passed (was 742). Integration tests not re-run locally.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

@xxthunder xxthunder left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

🚀

@xxthunder xxthunder merged commit 318a57a into develop May 5, 2026
5 checks passed
@xxthunder xxthunder deleted the sc-017-auto-terminate-distros branch May 5, 2026 15:42
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.

1 participant