Files
hermes-agent/scripts/windows_e2e_harness.ps1
T
ethernet adf7d55f4b ci(install-e2e): windows composes install x update - one driver, one job
windows-desktop-gui-e2e.ps1 and windows-installer-script-e2e.ps1 fold
into tests/install/windows-e2e.ps1 with orthogonal -InstallMethod and
-Route axes: the install phase dispatches on one, the update phase on
the other, and shared workroot state carries how OLD landed - so any
implemented update method can follow any implemented install method.
Implementing a new pair is now a driver function plus a gate edit,
never a new job.

The run workflow collapses to ONE inner job whose if: is the
implemented-pairs table. Newly cheap pairs go live with the merge:
  desktop-installer@latest -> hermes-update / installer-script /
    installer-script+desktop / hermes-desktop-app-update
  installer-script(+desktop) -> hermes-desktop-app-update
  installer-script+desktop -> open-app-update (the -IncludeDesktop
    install registers real Start Menu / Desktop shortcuts)
Only desktop-installer@latest as an UPDATE method stays a declared
TODO. scripts/windows_e2e_harness.ps1 executes the parse/parameter/
dispatch checks under pwsh before any Windows runner spins up.
2026-08-12 04:30:12 -04:00

49 lines
2.5 KiB
PowerShell

# Local harness for windows-e2e.ps1's non-GUI logic, runnable under linux
# pwsh (nix run nixpkgs#powershell). Exercises the pieces that cost CI
# round-trips when wrong: parameter surface, ref-flag probing, and the
# install/update dispatch reaching the right arm names.
param()
$ErrorActionPreference = "Stop"
$driver = Join-Path $PSScriptRoot "..\tests\install\windows-e2e.ps1"
# 1. Parse cleanly.
$tok = $null; $err = $null
[System.Management.Automation.Language.Parser]::ParseFile((Resolve-Path $driver), [ref]$tok, [ref]$err) | Out-Null
if ($err -and $err.Count) { $err | ForEach-Object { Write-Host $_.Message }; exit 1 }
Write-Host "parse: OK"
# 2. Parameter surface: both axes present with the generator's ids.
$ast = [System.Management.Automation.Language.Parser]::ParseFile((Resolve-Path $driver), [ref]$tok, [ref]$err)
$params = $ast.ParamBlock.Parameters
$byName = @{}
foreach ($p in $params) { $byName[$p.Name.VariablePath.UserPath] = $p }
foreach ($required in @("Phase", "InstallMethod", "Route", "InstallRef")) {
if (-not $byName.ContainsKey($required)) { Write-Host "missing param: $required"; exit 1 }
}
$imSet = ($byName["InstallMethod"].Attributes | Where-Object { $_.TypeName.Name -eq "ValidateSet" }).PositionalArguments.Value
foreach ($m in @("desktop-installer@latest", "installer-script", "installer-script+desktop")) {
if ($imSet -notcontains $m) { Write-Host "InstallMethod ValidateSet missing $m"; exit 1 }
}
$rSet = ($byName["Route"].Attributes | Where-Object { $_.TypeName.Name -eq "ValidateSet" }).PositionalArguments.Value
foreach ($m in @("open-app-update", "hermes-desktop-app-update", "hermes-update", "installer-script", "installer-script+desktop", "desktop-installer@latest")) {
if ($rSet -notcontains $m) { Write-Host "Route ValidateSet missing $m"; exit 1 }
}
Write-Host "parameter surface: OK"
# 3. Dispatch bodies reference the right arms (AST-level: the switch on
# InstallMethod contains the three arms; the switch on Route contains all
# six, with desktop-installer@latest throwing).
$text = Get-Content -LiteralPath $driver -Raw
foreach ($needle in @(
'function Invoke-PhaseInstall',
'function Invoke-PhaseUpdate',
'Invoke-RefInstaller $state.old "old" -IncludeDesktop',
'Invoke-HermesDesktopAppUpdate $state.current',
'Invoke-HermesUpdate',
"update method 'desktop-installer@latest' is not implemented yet"
)) {
if ($text.IndexOf($needle) -lt 0) { Write-Host "dispatch missing: $needle"; exit 1 }
}
Write-Host "dispatch arms: OK"
Write-Host "ALL HARNESS CHECKS PASSED"