From 257486c68a2971d990a42915854215a591f9c84a Mon Sep 17 00:00:00 2001 From: luanmacea Date: Sun, 29 Nov 2026 16:10:22 -0300 Subject: [PATCH] Cleanup --- .github/scripts/boot-check.mjs | 28 +++++++++++++++++++++++++++- .github/scripts/boot-check.test.mjs | 16 ++++++++++++++++ .github/workflows/release-v4.yml | 23 +++++++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) diff --git a/.github/scripts/boot-check.mjs b/.github/scripts/boot-check.mjs index 4c21d303..3ada0c1a 100644 --- a/.github/scripts/boot-check.mjs +++ b/.github/scripts/boot-check.mjs @@ -152,6 +152,29 @@ function killTree(child) { } /** Abre o exe com a pasta de dados isolada e a porta do CDP. */ +/** A chave do registro com a versão do WebView2 Runtime instalada (`pv`). */ +export const WEBVIEW2_CLIENT_KEY = "SOFTWARE\\WOW6432Node\\Microsoft\\EdgeUpdate\\Clients\\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"; + +/** + * O que o Windows vê quando nenhuma página aparece (release da 3.0.1, 29/11/2026: 120 s sem página e sem pista): o + * processo do app e o título da janela dele (uma caixa de erro aparece aqui), os processos do WebView2 e a versão do + * runtime. Só leitura. + */ +export function diagnosticsScript(pid) { + return [ + `$p = Get-Process -Id ${Number(pid)} -ErrorAction SilentlyContinue`, + `if ($p) { Write-Output ("app process alive; window title: '" + $p.MainWindowTitle + "'") } else { Write-Output "app process gone" }`, + `Write-Output ("msedgewebview2 processes: " + @(Get-Process -Name msedgewebview2 -ErrorAction SilentlyContinue).Count)`, + `$pv = (Get-ItemProperty -Path "HKLM:\\${WEBVIEW2_CLIENT_KEY}" -Name pv -ErrorAction SilentlyContinue).pv`, + `Write-Output ("WebView2 runtime: " + $(if ($pv) { $pv } else { "not installed" }))`, + ].join("; "); +} + +function printDiagnostics(pid) { + const r = spawnSync("powershell", ["-NoProfile", "-Command", diagnosticsScript(pid)], { encoding: "utf8", windowsHide: true }); + for (const line of `${r.stdout ?? ""}`.split(/\r?\n/).filter(Boolean)) console.error(`boot-check: ${line}`); +} + export function spawnApp({ exe, port, dataDir }) { return spawn(exe, [], { env: bootEnv(process.env, { dataDir, port }), stdio: "ignore", windowsHide: true }); } @@ -178,7 +201,10 @@ export async function bootCheck({ exe, port, timeoutMs, settleMs }, { log = cons const deadline = Date.now() + timeoutMs; const page = await waitForPage(port, deadline, () => exitInfo !== undefined); if (exitInfo) return fail(`the app exited (code ${exitInfo.code}, ${exitInfo.signal ?? "no signal"}) before the WebView2 page came up (another instance already running?)`); - if (!page) return fail(`no WebView2 page on port ${port} after ${timeoutMs / 1000}s`); + if (!page) { + printDiagnostics(child.pid); + return fail(`no WebView2 page on port ${port} after ${timeoutMs / 1000}s`); + } log(`boot-check: CDP page ${page.url}`); cdp = await connect(page.webSocketDebuggerUrl, (m) => { const d = describeCdpEvent(m); diff --git a/.github/scripts/boot-check.test.mjs b/.github/scripts/boot-check.test.mjs index d2d566ef..81fa27af 100644 --- a/.github/scripts/boot-check.test.mjs +++ b/.github/scripts/boot-check.test.mjs @@ -8,10 +8,26 @@ import { bootEnv, bootVerdict, describeCdpEvent, + diagnosticsScript, + WEBVIEW2_CLIENT_KEY, parseArgs, pickMainPage, } from "./boot-check.mjs"; +// Release da 3.0.1 (29/11/2026): no runner do GitHub o app abriu e nenhuma página apareceu em 120 s, sem nenhuma pista +// no log. A falha agora diz o que o Windows vê: o processo, o título da janela (uma caixa de erro aparece aqui), os +// processos do WebView2 e a versão do runtime instalada. +describe("boot-check failure diagnostics", () => { + it("asks Windows about the app process, its window, the WebView2 processes and the runtime version", () => { + const script = diagnosticsScript(4242); + expect(script).toContain("Get-Process -Id 4242"); + expect(script).toContain("MainWindowTitle"); + expect(script).toContain("msedgewebview2"); + expect(script).toContain(WEBVIEW2_CLIENT_KEY); + expect(WEBVIEW2_CLIENT_KEY).toContain("{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"); + }); +}); + describe("boot-check arguments", () => { it("needs the exe and has defaults for the rest", () => { expect(() => parseArgs([])).toThrow(/--exe/); diff --git a/.github/workflows/release-v4.yml b/.github/workflows/release-v4.yml index 17c362f9..ea32f2d8 100644 --- a/.github/workflows/release-v4.yml +++ b/.github/workflows/release-v4.yml @@ -189,6 +189,29 @@ jobs: ConvertTo-Json $tauriConf -Depth 32 | Set-Content -LiteralPath $file -Encoding utf8 } + # O runner do GitHub não traz o WebView2 Runtime garantido (a imagem lista só o Edge): sem ele o exe abre e + # nenhuma página aparece (release da 3.0.1, 29/11/2026). O log diz se o runtime já estava lá; se não, o + # instalador oficial (evergreen) o instala em silêncio, antes dos boot checks. + - name: Ensure the WebView2 runtime + run: | + $keys = @( + "HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}", + "HKLM:\SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" + ) + function RuntimeVersion { foreach ($k in $keys) { $pv = (Get-ItemProperty -Path $k -Name pv -ErrorAction SilentlyContinue).pv; if ($pv -and $pv -ne "0.0.0.0") { return $pv } }; return $null } + $pv = RuntimeVersion + if ($pv) { + Write-Host "WebView2 runtime already installed: $pv" + } else { + Write-Host "WebView2 runtime not found; installing the evergreen bootstrapper" + $setup = Join-Path $env:RUNNER_TEMP "MicrosoftEdgeWebview2Setup.exe" + Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -OutFile $setup + Start-Process -FilePath $setup -ArgumentList "/silent", "/install" -Wait + $pv = RuntimeVersion + if (-not $pv) { throw "WebView2 runtime still missing after the install" } + Write-Host "WebView2 runtime installed: $pv" + } + - name: Build standard edition and create the draft release id: standard_build uses: tauri-apps/tauri-action@84b9d35b5fc46c1e45415bdb6144030364f7ebc5 # v0