Files
hermes-agent/scripts/windows_e2e_harness.ps1
yoniebans 49a5c440c5 fix(install-e2e): review follow-ups — harness needle, per-matrix cap wording, typo
The harness asserted the driver still throws 'not implemented yet' for
the desktop-installer@latest update route; that arm is implemented now
(Invoke-PhaseInstallGui -Mode "update"), so the check failed against
its own tree. It asserts the implemented contract instead.

The 256-job cap wording in the workflow comment and README now states
the scope GitHub applies it at: each per-OS matrix separately, not the
combined leg count. At the 10-tag bound the largest matrix is windows
at 180.

e2e-screen-record comment: hhttps -> https.
2026-09-03 10:15:53 +02: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 re-running the GUI installer).
$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',
'Invoke-PhaseInstallGui -Mode "update"'
)) {
if ($text.IndexOf($needle) -lt 0) { Write-Host "dispatch missing: $needle"; exit 1 }
}
Write-Host "dispatch arms: OK"
Write-Host "ALL HARNESS CHECKS PASSED"