Skip to content

Add unattended mode to SandboxTest.ps1 - #441419

Open
Kaleb Luedtke (Trenly) wants to merge 3 commits into
microsoft:masterfrom
Trenly:sandboxtest-unattended
Open

Kaleb Luedtke (Trenly) wants to merge 3 commits into
microsoft:masterfrom
Trenly:sandboxtest-unattended

Conversation

@Trenly

@Trenly Kaleb Luedtke (Trenly) commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

📖 Description

Adds an opt-in unattended mode to Tools\SandboxTest.ps1 so the output of the PowerShell session running inside Windows Sandbox can be read from the host. Today the script starts the Sandbox and returns immediately, which means scripted or automated manifest testing has no way to see whether the install succeeded.

A new -Unattended <minutes> parameter makes the script wait for the Sandbox session to finish and then write its output to the caller. The value is the timeout in minutes and is required, since PowerShell cannot make a parameter value optional. When the parameter is omitted the script behaves exactly as it does today.

Inside the Sandbox

  • Starts a transcript, and pipes the winget install output through Out-Host so Windows PowerShell 5.1 captures native command output
  • Writes metadata.json: WinGet version, OS build, manifest folder name, the winget install exit code in decimal and hexadecimal, the -Script exit status, and start/end timestamps
  • Copies the WinGet DiagOutputDir logs out
  • Writes a done marker from a finally block so it is always written
  • Leaves the Sandbox window open, as before

On the host

  • The mapped folder prompt becomes a plain warning instead of blocking on input
  • Polls for the done marker until the timeout, then writes the transcript, the result paths and the metadata to the output
  • Exits with the new code 5 on timeout, after writing whatever partial transcript exists

Results are written to %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\SandboxTest\Results as transcript.log, metadata.json, WinGetLogs\ and done.

Files changed

  • Tools/SandboxTest.ps1 - the new parameter and the unattended code paths
  • doc/tools/SandboxTest.md - the new option, an Unattended Mode section covering the results layout, and exit code 5
  • .github/actions/spelling/expect.txt - adds bbwe and wekyb, the tokens spell checking splits out of the WinGet package family name Microsoft.DesktopAppInstaller_8wekyb3d8bbwe used in the new documentation

Tools/PRTest.ps1 is unchanged.

Validation

PSScriptAnalyzer, Pester Tests and Spell Checking pass on the fork. Verified with real Sandbox runs on Windows 11 26100:

Scenario Result
-Unattended 15 with a manifest and a -Script exit 0, full transcript written to the host, InstallExitCode 0, script output captured, WinGet logs copied
A manifest with a deliberately corrupted InstallerSha256 InstallExitCode -1978335215 / 0x8A150011 captured in the metadata
-Unattended 1 against a script that sleeps past the timeout exit 5, partial transcript written
No -Unattended unchanged; returns immediately and writes no results folder

Copilot assisted with this change.

✅ Checklist

📦 Manifest Checklist

Not applicable; this PR does not modify any manifests.

* Add -Unattended <minutes> to wait for the sandbox run and surface its output on the host
* Write a transcript, metadata.json and WinGet logs to a Results folder inside the sandbox
* Document the new option, the results layout and exit code 5

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@wingetvalidator-prod wingetvalidator-prod Bot added the Project-File The pull request modifies repository project or configuration files. label Sep 26, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Changes to one or more files in your PR require authorization to modify. This PR has been assigned to our on call staff to evaluate.

Template: msftbot/requiresApproval/MSFT

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Needs-Attention This work item needs to be reviewed by a member of the core team. label Sep 26, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Validation Pipeline Badge Publish Pipeline Badge

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot removed the Needs-Attention This work item needs to be reviewed by a member of the core team. label Sep 26, 2026
@Trenly
Kaleb Luedtke (Trenly) marked this pull request as ready for review September 26, 2026 03:28
@microsoft-github-policy-service microsoft-github-policy-service Bot added the Moderator-Approved One of the Moderators has reviewed and approved this PR label Sep 26, 2026
@denelon

Copy link
Copy Markdown
Collaborator

Kaleb Luedtke (@Trenly) it looks like the script analyzer failed

@Trenly

Copy link
Copy Markdown
Contributor Author

Kaleb Luedtke (Kaleb Luedtke (@Trenly)) it looks like the script analyzer failed

It passed locally - thats not an error I've seen before. Will investigate

@microsoft-github-policy-service microsoft-github-policy-service Bot removed the Moderator-Approved One of the Moderators has reviewed and approved this PR label Sep 29, 2026
@Trenly

Copy link
Copy Markdown
Contributor Author

Demitrius Nelon (@denelon) - I've merged the upstream to see if that resolves the issue. Here's the confirmation of the workflow passing on by branch from the original commit: https://github.com/Trenly/winget-pkgs/actions/runs/36213753043

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

Labels

Project-File The pull request modifies repository project or configuration files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[New Feature]: Unattended mode for SandboxTest.ps1 so results can be read from the host

3 participants