Files
pebrel/scripts/tests/installer.tests.ps1
T
kuddev 95a79e7255 fix(gpui): 1.1.0 polish — SSH key dialog crash, GitHub HTML notes, package hardening
- SSH settings: the modal private-key file dialog now runs on a dedicated
  thread with results returned via oneshot and dropped when the editor
  generation changed. Running it inside the update borrow let the dialog's
  message pump re-enter the GPUI wndproc and panic the AppCell — the
  "click add private key, window vanishes" crash. Includes the reworked
  host editor panel and dialog owner-HWND plumbing (file_dialog, cli).
- Markdown reader: GitHub-flavored HTML semantics land in the local
  gpui-component fork (align="center" blocks, badge rows in one line,
  <br/> document order, <a><img/></a> badges keep image + link);
  changelog entries and the fork patch ledger recorded here.
- Packaging: freshness guards refuse binaries older than the newest
  source change, the staged exe must report the release version, all four
  ps1 carry a UTF-8 BOM, and the zip drops the 20MB fonts/ copy (the
  embedded font materializes on demand via ensure_bundled_font_on_disk).
- Size budget: release profile goes thin-LTO + codegen-units=1 +
  strip=symbols + opt-level=s with render/shaping/VT hot crates pinned at
  O3 — nebula.exe 136MB → 93MB, both packages 54.4MB → 28.6MB.
- Tab row: width no longer tracks content (w_full rows shipped in a fresh
  binary), tab bar collapse behavior tuned; probe/packaging scratch dirs
  ignored.
2026-08-18 19:30:35 +08:00

76 lines
3.8 KiB
PowerShell

$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
$repo = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
$installerPath = Join-Path $repo 'scripts\installer.iss'
$builderPath = Join-Path $repo 'scripts\build-installer.ps1'
$installer = Get-Content -LiteralPath $installerPath -Raw -Encoding UTF8
$requiredPatterns = [ordered]@{
'per-user installation' = 'DefaultDirName=\{localappdata\}\\Programs\\Nebula Terminal'
'non-admin installation' = 'PrivilegesRequired=lowest'
'Windows 10 1809 floor' = 'MinVersion=10\.0\.17763'
'application closing' = 'CloseApplications=yes'
'no application restart during uninstall' = 'RestartApplications=no'
'desktop shortcut task' = 'Tasks: desktopicon'
'login startup task' = '\{userstartup\}\\Nebula Terminal'
'hook cleanup command' = 'Parameters: "setup-ai --remove"'
'gpui start-menu shortcut' = 'Parameters: "--gpui"'
'idempotent cleanup entry' = 'RunOnceId: "RemoveNebulaAiHooks"'
'hook helper payload' = 'nebula-hook\.exe'
'ConPTY payload' = 'conpty\.dll'
'ConPTY host payload' = 'OpenConsole\.exe'
'font payload' = 'MapleMonoNormal-NF-CN-Regular\.ttf'
'optional font installation task' = 'Tasks: installfont'
'pinned Chinese language file' = 'target\\installer-tools\\ChineseSimplified\.isl'
'localized context menu label' = 'english\.OpenInNebula=Open in Nebula'
'localized Chinese context menu label' = 'chinesesimplified\.OpenInNebula=\S.+'
'directory background context menu' = 'Software\\Classes\\Directory\\Background\\shell\\NebulaTerminal'
'selected directory context menu' = 'Software\\Classes\\Directory\\shell\\NebulaTerminal'
'context menu executable icon' = 'ValueName: "Icon"; ValueData: "\{app\}\\nebula\.exe,0"'
'background working-directory command' = '--gpui --working-directory ""%V""'
'selected directory working-directory command' = '--gpui --working-directory ""%1""'
'PATH task' = 'Name: "addtopath"; Description: "\{cm:AddToPath\}"'
'PATH registry entry' = 'Subkey: "Environment"; ValueType: expandsz; ValueName: "Path"'
'PATH ownership marker' = 'ValueName: "InstallerAddedToPath"'
'Win+R App Paths registration' = 'App Paths\\nebula\.exe'
'environment change notification' = 'ChangesEnvironment=yes'
'PATH uninstall cleanup' = 'CurUninstallStepChanged\(CurUninstallStep: TUninstallStep\)'
}
foreach ($entry in $requiredPatterns.GetEnumerator()) {
if ($installer -notmatch $entry.Value) {
throw "Installer is missing $($entry.Key): $($entry.Value)"
}
}
$uninstallRun = $installer.IndexOf('[UninstallRun]', [System.StringComparison]::Ordinal)
$cleanup = $installer.IndexOf('setup-ai --remove', [System.StringComparison]::Ordinal)
if ($uninstallRun -lt 0 -or $cleanup -lt $uninstallRun) {
throw 'Hook cleanup must be an [UninstallRun] action so it executes before installed files are deleted.'
}
$contextMenuRoots = @(
'Software\Classes\Directory\Background\shell\NebulaTerminal'
'Software\Classes\Directory\shell\NebulaTerminal'
)
foreach ($root in $contextMenuRoots) {
$escapedRoot = [regex]::Escape($root)
if ($installer -notmatch "Subkey: `"$escapedRoot`";.*Flags: uninsdeletekey") {
throw "Context-menu key must be removed during uninstall: $root"
}
}
& $builderPath -SkipBuild -AllowStale -ValidateOnly
$builder = Get-Content -LiteralPath $builderPath -Raw -Encoding UTF8
if ($builder -notmatch 'Stale binary') {
throw 'build-installer.ps1 must refuse stale binaries (freshness guard missing).'
}
if ($builder -notmatch 'c495623a97376d524f298b1b160e8fd612375c62' -or
$builder -notmatch '6753BE2C5E2740D859900FD902824DB2EC568DA5C5B52486524C9762D778B0B0') {
throw 'The Chinese installer translation must use a pinned source commit and SHA-256.'
}
Write-Output "installer.tests.ps1: PASS ($($requiredPatterns.Count) invariants)"