Browse Source

runtime.cmd (ps1): cached sha1sums fallback backported to list -remote (punkshell 0.8.1)

- list -remote against an unreachable artifact server now warns and compares using the previously fetched sha1sums.txt instead of dying on an unhandled Invoke-WebRequest error (parity with the bash payload); no cached copy -> clear error + return
- the fetch path always fell through silently to a cached sha1sums.txt on download failure - it now announces "proceeding with cached copy" (behaviour unchanged, messaging explicit)
- fixed latent undefined-variable bug: the list -remote branch created the runtime folder with $container (only defined in the fetch branch) - now $archfolder
- bin/runtime.cmd regenerated (checkfile clean, roundtrip pin green 9 pass + 1 skip); verified live: unreachable PUNKBIN_URL -> cached-fallback table renders (tclsfe-x64 "Same version" against the punkbin pin), normal fetch path unchanged

Assisted-by: harness=claude; primary-model=claude-fable-5; api-location=anthropic.com
master
Julian Noble 4 days ago
parent
commit
f8793b308a
  1. 4
      CHANGELOG.md
  2. 27
      bin/runtime.cmd
  3. 2
      punkproject.toml
  4. 27
      src/scriptapps/bin/runtime.ps1

4
CHANGELOG.md

@ -5,6 +5,10 @@ The latest `## [X.Y.Z]` header must match the `version` field in `punkproject.to
Entries are newest-first; one bullet per notable change. See the root `AGENTS.md`
"Project Versioning" section for the bump policy.
## [0.8.1] - 2026-07-11
- untime.cmd powershell payload: cached sha1sums.txt fallback backported from the bash payload - list -remote against an unreachable server now warns and compares using the previously fetched copy instead of dying on an unhandled download error, and the etch path's pre-existing silent fall-through to a cached copy now announces itself. Also fixed a latent undefined-variable bug creating the runtime folder in the list -remote branch.
## [0.8.0] - 2026-07-11
- `runtime.cmd list -remote` parity for the unix (bash/zsh) payload: local-vs-server comparison table (Same version / UPDATE AVAILABLE / not-listed, plus remote-only entries), falling back to a cached `sha1sums.txt` with a warning when the server is unreachable. Both payloads gain a `PUNKBIN_URL` env override of the artifact server base url (mirrors/testing).

27
bin/runtime.cmd

@ -2147,6 +2147,10 @@ function psmain {
if ($_.Exception.Response) {
Write-Host "HTTP Status code: $($_.Exception.Response.StatusCode)"
}
if (Test-Path -Path $sha1local -PathType Leaf) {
#this path always fell through to the cached copy - now say so
Write-Host "WARNING: proceeding with cached copy at $sha1local"
}
}
if (Test-Path -Path $sha1local -PathType Leaf) {
$sha1Content = Get-Content -Path $sha1local
@ -2341,12 +2345,27 @@ function psmain {
$sha1url = "$archurl/sha1sums.txt"
if ( $PSBoundParameters.ContainsKey('remote') ) {
if (-not (test-path -Path $archfolder -Type Container)) {
new-item -Path $container -ItemType Directory -force #create with intermediary folders if not already present
new-item -Path $archfolder -ItemType Directory -force #create with intermediary folders if not already present
}
write-host "Checking for available remote runtimes for"
write-host "Checking for available remote runtimes for $arch"
Write-Host "Fetching $sha1url"
Invoke-WebRequest -Uri $sha1url -OutFile $sha1local -ErrorAction Stop
Write-Host "sha1 saved at $sha1local"
#cached fallback (parity with the bash payload): an unreachable server
#falls back to a previously fetched sha1sums.txt with a warning
try {
Invoke-WebRequest -Uri $sha1url -OutFile $sha1local -ErrorAction Stop
Write-Host "sha1 saved at $sha1local"
} catch {
if (Test-Path -Path $sha1local -PathType Leaf) {
Write-Host "WARNING: could not fetch ${sha1url}: $($_.Exception.Message)"
Write-Host "WARNING: using cached copy at $sha1local"
} else {
Write-Host "Unable to fetch $sha1url and no cached copy available: $($_.Exception.Message)"
if ($_.Exception.Response) {
Write-Host "HTTP Status code: $($_.Exception.Response.StatusCode)"
}
return
}
}
$sha1Content = Get-Content -Path $sha1local
$remotedict = @{}
foreach ($line in $sha1Content) {

2
punkproject.toml

@ -1,3 +1,3 @@
[project]
name = "punkshell"
version = "0.8.0"
version = "0.8.1"

27
src/scriptapps/bin/runtime.ps1

@ -211,6 +211,10 @@ function psmain {
if ($_.Exception.Response) {
Write-Host "HTTP Status code: $($_.Exception.Response.StatusCode)"
}
if (Test-Path -Path $sha1local -PathType Leaf) {
#this path always fell through to the cached copy - now say so
Write-Host "WARNING: proceeding with cached copy at $sha1local"
}
}
if (Test-Path -Path $sha1local -PathType Leaf) {
$sha1Content = Get-Content -Path $sha1local
@ -405,12 +409,27 @@ function psmain {
$sha1url = "$archurl/sha1sums.txt"
if ( $PSBoundParameters.ContainsKey('remote') ) {
if (-not (test-path -Path $archfolder -Type Container)) {
new-item -Path $container -ItemType Directory -force #create with intermediary folders if not already present
new-item -Path $archfolder -ItemType Directory -force #create with intermediary folders if not already present
}
write-host "Checking for available remote runtimes for"
write-host "Checking for available remote runtimes for $arch"
Write-Host "Fetching $sha1url"
Invoke-WebRequest -Uri $sha1url -OutFile $sha1local -ErrorAction Stop
Write-Host "sha1 saved at $sha1local"
#cached fallback (parity with the bash payload): an unreachable server
#falls back to a previously fetched sha1sums.txt with a warning
try {
Invoke-WebRequest -Uri $sha1url -OutFile $sha1local -ErrorAction Stop
Write-Host "sha1 saved at $sha1local"
} catch {
if (Test-Path -Path $sha1local -PathType Leaf) {
Write-Host "WARNING: could not fetch ${sha1url}: $($_.Exception.Message)"
Write-Host "WARNING: using cached copy at $sha1local"
} else {
Write-Host "Unable to fetch $sha1url and no cached copy available: $($_.Exception.Message)"
if ($_.Exception.Response) {
Write-Host "HTTP Status code: $($_.Exception.Response.StatusCode)"
}
return
}
}
$sha1Content = Get-Content -Path $sha1local
$remotedict = @{}
foreach ($line in $sha1Content) {

Loading…
Cancel
Save