Skip to content

Studio: test the Windows launcher shape, not just the path normalizer - #7969

Merged
danielhanchen merged 1 commit into
mainfrom
studio-windows-launcher-regression-test
Aug 6, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
studio-windows-launcher-regression-test

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

What is wrong

#7943 fixed the verbatim-path authorization failure and added a windows-unit-tests leg to studio-tauri-smoke.yml to keep it fixed. That leg runs, but the two tests it guards with are assertions over powershell_script_path as a pure function, and the regression that actually shipped is invisible to them.

#7819's entire install.rs diff was Bypass -> RemoteSigned. It never touched a path. So the failure mode is a change to the flags interacting with a path spelling that was already there, and neither a normalizer unit test nor any Linux job can see it.

Two mutations reintroduce a broken first-run install on every Windows bundle while leaving all of #7943's assertions green:

  1. swap the execution policy back, or to anything else
  2. delete the powershell_script_path(script) call from spawn_script and pass script raw

The fix

Lift the argument vector out of spawn_script into powershell_launch_args, so the call site is a value a test can look at rather than something built inline and immediately spawned. Then two tests:

  • powershell_runs_a_script_addressed_the_way_tauri_addresses_it runs the real powershell.exe, with the real flags, against a path from fs::canonicalize, which is what resolve(Resource) bottoms out in and which Rust documents as returning extended-length syntax. It asserts it actually got a \\?\ path before using it, so it cannot pass vacuously if canonicalize ever stops emitting one. A temp script has no Zone.Identifier, so RemoteSigned admits it unsigned; the path spelling and the flag set are what is under test, not signing.
  • powershell_launch_args_pin_the_defender_friendly_shape pins the flag vector, so a policy swap shows up as a diff rather than as silence, and asserts -WindowStyle / Bypass do not come back.

No behaviour change. The arguments spawn_script passes are byte for byte the ones it passed before.

Verification

Both legs of studio-tauri-smoke.yml on a disposable staging runner, since the Windows-only code is exactly what no local Linux build compiles:

Rust unit tests (windows) Tauri Linux debug build
this branch success, 127 passed (was 125) success
negative control failure, 125 passed / 2 failed success

The negative control is the part worth reading. It drops powershell_script_path from the call site, the mutation no existing test can see, and the new test reproduces the exact reported failure inside CI:

the launcher shape failed to authorize
  "\\?\C:\Users\runneradmin\AppData\Local\Temp\unsloth-launch-1992-1243\install.ps1"
    + FullyQualifiedErrorId : UnauthorizedAccess

Both powershell_script_path_* tests passed on that mutated tree, which is the gap this closes. The only two failures are the two tests added here.

Note

This is test coverage only, so it does not help anyone currently stuck. desktop-v0.1.521-beta targets a6ad2152, which predates #7943's merge by about four and a half hours, so all three current Windows betas (0.1.512, 0.1.52, 0.1.521) still fail on first run with AuthorizationManager check failed. A build cut from current main is the actual fix for users.

The windows-unit-tests leg added in #7943 pins powershell_script_path as a pure
function. That cannot see the regression that actually shipped: #7819's entire
install.rs diff was Bypass -> RemoteSigned, and dropping the
powershell_script_path call from spawn_script leaves every existing assertion
passing while first-run install is broken on every Windows bundle.

Lift the argument vector into powershell_launch_args so the call site itself is
testable, then run the real interpreter with those flags against a script
addressed the way Tauri addresses it (fs::canonicalize, which resource
resolution bottoms out in and which is documented to return extended-length
syntax). The test asserts it reproduced a verbatim path before using it, so it
cannot pass vacuously. A second test pins the flag set so a policy swap shows
up as a diff.

No behaviour change: the arguments spawn_script passes are byte for byte the
ones it passed before.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 3b8abda61f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 844244c into main Aug 6, 2026
51 checks passed
@danielhanchen
danielhanchen deleted the studio-windows-launcher-regression-test branch August 6, 2026 04:35
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