Skip to content

Commit b47cee7

Browse files
committed
diagnostic: probe Get-FileHash resolution on windows-latest (not for merge)
1 parent 83bbb17 commit b47cee7

1 file changed

Lines changed: 54 additions & 17 deletions

File tree

Lines changed: 54 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
1-
# Hand-authored (unlike release.yml, which is cargo-dist-generated and must not
2-
# be hand-edited). Exercises the real Windows rename-aside swap that the
3-
# `upgrade` fixture test performs — the-loop's own dev machines have no
4-
# Windows box, so this is the only place that leg runs.
5-
#
6-
# Pinned fact (design-time, cargo-dist 0.32.0): the PowerShell installer
7-
# performs no checksum verification at all (the-loop-installer.ps1) — only
8-
# the shell installer does. So this job proves the Windows rename-aside swap
9-
# works, not the sha256 checksum bar; the corrupt-archive case in
10-
# upgrade_fixture.rs asserts an unpack failure on Windows instead of a
11-
# checksum mismatch, for exactly that reason.
12-
#
13-
# This job's greenness is a release-gate ready check (see the Release
14-
# runbook in docs/architecture.md), not a validate-time assertion — it only
15-
# runs at workflow_dispatch or on push to main, never on feature-branch
16-
# pushes or pull requests.
1+
# TEMPORARY DIAGNOSTIC VERSION — branch diagnose/windows-fixture-hash.
2+
# Probes why `Get-FileHash` comes back CommandNotFoundException inside the
3+
# upgrade fixture. Not for merge; the real file lives on main.
174
name: upgrade-windows
185

196
on:
@@ -28,4 +15,54 @@ jobs:
2815
steps:
2916
- uses: actions/checkout@v6
3017
- uses: dtolnay/rust-toolchain@stable
31-
- run: cargo test --package the-loop --features upgrade --test upgrade_fixture
18+
19+
- name: A - what shell does a bare run step get
20+
continue-on-error: true
21+
run: |
22+
Write-Host "PSEdition=$($PSVersionTable.PSEdition) PSVersion=$($PSVersionTable.PSVersion)"
23+
Write-Host "--- parent PSModulePath ---"
24+
$env:PSModulePath -split ';' | ForEach-Object { Write-Host " $_" }
25+
Write-Host "--- Get-FileHash resolvable in parent? ---"
26+
Write-Host (Get-Command Get-FileHash -ErrorAction SilentlyContinue | Out-String)
27+
28+
- name: B - the exact failing call, powershell child inheriting parent env
29+
continue-on-error: true
30+
run: |
31+
Set-Content -Path probe.bin -Value 'hello'
32+
Write-Host "--- child powershell PSVersion ---"
33+
powershell -NoProfile -Command 'Write-Host $PSVersionTable.PSVersion'
34+
Write-Host "--- child powershell PSModulePath ---"
35+
powershell -NoProfile -Command '$env:PSModulePath -split ";" | ForEach-Object { Write-Host " $_" }'
36+
Write-Host "--- child powershell Get-FileHash (the failing call) ---"
37+
powershell -NoProfile -Command "(Get-FileHash -Algorithm SHA256 -LiteralPath 'probe.bin').Hash.ToLower()"
38+
Write-Host "exit=$LASTEXITCODE"
39+
40+
- name: C - candidate fix 1, pwsh child instead of powershell
41+
continue-on-error: true
42+
run: |
43+
pwsh -NoProfile -Command "(Get-FileHash -Algorithm SHA256 -LiteralPath 'probe.bin').Hash.ToLower()"
44+
Write-Host "exit=$LASTEXITCODE"
45+
46+
- name: D - candidate fix 2, powershell child with PSModulePath cleared
47+
continue-on-error: true
48+
run: |
49+
$env:PSModulePath = ''
50+
powershell -NoProfile -Command "(Get-FileHash -Algorithm SHA256 -LiteralPath 'probe.bin').Hash.ToLower()"
51+
Write-Host "exit=$LASTEXITCODE"
52+
53+
- name: E - candidate fix 3, powershell child with system module path restored
54+
continue-on-error: true
55+
run: |
56+
$env:PSModulePath = "$env:SystemRoot\system32\WindowsPowerShell\v1.0\Modules"
57+
powershell -NoProfile -Command "(Get-FileHash -Algorithm SHA256 -LiteralPath 'probe.bin').Hash.ToLower()"
58+
Write-Host "exit=$LASTEXITCODE"
59+
60+
- name: F - certutil as a shell-free fallback
61+
continue-on-error: true
62+
run: |
63+
certutil -hashfile probe.bin SHA256
64+
Write-Host "exit=$LASTEXITCODE"
65+
66+
- name: G - the actual suite, current state
67+
continue-on-error: true
68+
run: cargo test --package the-loop --features upgrade --test upgrade_fixture

0 commit comments

Comments
 (0)