Skip to content

Commit 6d2de35

Browse files
committed
fix(BG0575): the Windows control reads its own fixture, so the PowerShell half can actually be verified
The `windows-smoke` step added for BG0575 failed on its first real run, in the green control: Failed to reach .../v9.9.9/sdlc-studio-v9.9.9.zip - a transport error, not a missing asset. Refusing to fall back to an unverified download. Cannot bind argument to parameter 'Path' because it is null. The function shadow worked - `install.ps1` did call the stub rather than the real `Invoke-WebRequest`. What did not work is `$script:`: once `install.ps1` is invoked with `&` it is its own script, and the stub's `$script:AssetZip` resolved against THAT scope rather than the step's, so it read null, `Copy-Item` threw, and `install.ps1` correctly reported a transport error. The installer behaved exactly as designed; the fixture was lying to it. Rescoped to `$global:`, which is unambiguous across an invoked script boundary. Worth recording rather than fixing quietly: the fix review predicted this exact area and asked whether the shadow would apply. It does. I checked the half that was raised and not the half beside it - the variables - which is the shape of LL0052. BG0575 stays OPEN until this step reports green. Its Verification depth says the PowerShell half must be demonstrated green-and-red in CI before the bug closes, and a bug closed against its own recorded criterion is worth less than one left open. Refs: BG0575
1 parent 23501bc commit 6d2de35

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

.github/workflows/lint.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,16 +230,16 @@ jobs:
230230
# survive this whole job while breaking every real verified install on Windows.
231231
$digest = (Get-FileHash -Path $zip -Algorithm SHA256).Hash.ToLower()
232232
233-
$script:ServedDigest = $digest
234-
$script:AssetZip = $zip
233+
$global:ServedDigest = $digest
234+
$global:AssetZip = $zip
235235
236236
function Invoke-WebRequest {
237237
param([string]$Uri, [string]$OutFile, [switch]$UseBasicParsing)
238238
if ($Uri -like '*/releases/download/*sdlc-studio-v9.9.9.zip.sha256') {
239-
return [pscustomobject]@{ Content = "$script:ServedDigest sdlc-studio-v9.9.9.zip" }
239+
return [pscustomobject]@{ Content = "$global:ServedDigest sdlc-studio-v9.9.9.zip" }
240240
}
241241
if ($Uri -like '*/releases/download/*sdlc-studio-v9.9.9.zip') {
242-
Copy-Item $script:AssetZip $OutFile -Force; return
242+
Copy-Item $global:AssetZip $OutFile -Force; return
243243
}
244244
# Anything else is "not there". install.ps1 reads the status off
245245
# $_.Exception.Response.StatusCode, so the thrown exception must actually CARRY one -
@@ -261,7 +261,7 @@ jobs:
261261
Pop-Location
262262
263263
# RED control: corrupt the sidecar. The install must abort before extraction.
264-
$script:ServedDigest = 'deadbeef'
264+
$global:ServedDigest = 'deadbeef'
265265
$proj2 = Join-Path $work 'proj2'
266266
New-Item -ItemType Directory -Force $proj2 | Out-Null
267267
Push-Location $proj2
@@ -279,8 +279,7 @@ jobs:
279279
# 404 branch, so without it the fallback install.ps1 gained for BG0575 is exercised by
280280
# nothing. The tag must fall back to the source archive, find no digest there, and
281281
# refuse under REQUIRE_CHECKSUM rather than invent verification.
282-
$script:NoAsset = $true
283-
function Invoke-WebRequest {
282+
function Invoke-WebRequest {
284283
param([string]$Uri, [string]$OutFile, [switch]$UseBasicParsing)
285284
$m = [System.Net.Http.HttpResponseMessage]::new([System.Net.HttpStatusCode]::NotFound)
286285
throw [Microsoft.PowerShell.Commands.HttpResponseException]::new('404 Not Found', $m)

0 commit comments

Comments
 (0)