Skip to content

Commit f915a24

Browse files
author
Test
committed
fix: complete Windows gate setup paths
1 parent 60863a7 commit f915a24

6 files changed

Lines changed: 71 additions & 6 deletions

File tree

.github/windows-gates/pr1743/orchestrate-pr1743.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@ $probe = Join-Path $probeRoot 'windows\run-pr1743-windows-probe.ps1'
3838
if ((Get-FileHash -LiteralPath $probe -Algorithm SHA256).Hash.ToLowerInvariant() -ne $expectedProbeHash) {
3939
throw 'reviewed PR #1743 probe hash mismatch'
4040
}
41+
$reviewedProbeFiles = @{
42+
'windows\create-dpapi-cookie-fixture.ts' = '7691e0498bd0cc123bb44cb12e0640653b55cddf414c6241e8ab37d5e9435000'
43+
'windows\protect-dpapi-key.ps1' = 'abf5c48a32fd23a5fa3bdac32b2a5e037c80cb53ca14cfc6d38abef86c4a57ff'
44+
'windows\dpapi-core-probe.ts' = '0218988f4e06ffe2552ec64ecf727e095d3a1814de48c9bf4c32f4cfa2b21c53'
45+
'probe\node-spawn-matrix.mjs' = 'c5a27d7414c9687fc819a5f2fd154fb373db90bf0293b711bb076f0e4fa0663e'
46+
}
47+
foreach ($relativePath in $reviewedProbeFiles.Keys) {
48+
$reviewedPath = Join-Path $probeRoot $relativePath
49+
if ((Get-FileHash -LiteralPath $reviewedPath -Algorithm SHA256).Hash.ToLowerInvariant() -ne $reviewedProbeFiles[$relativePath]) {
50+
throw "reviewed PR #1743 child probe hash mismatch: $relativePath"
51+
}
52+
}
4153
if ((Get-FileHash -LiteralPath $consumerArchive -Algorithm SHA256).Hash.ToLowerInvariant() -ne $case.archiveSha256) {
4254
throw "pinned PR #1743 consumer archive hash mismatch for $caseId"
4355
}

.github/windows-gates/pr1743/windows/dpapi-core-probe.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ process.env.HOME = isolatedHome;
1414
process.env.USERPROFILE = isolatedHome;
1515

1616
const require = createRequire(import.meta.url);
17-
require(path.join(gstackRoot, 'browse', 'src', 'bun-polyfill.cjs'));
17+
const hasNativeBun = typeof globalThis.Bun !== 'undefined';
18+
if (!hasNativeBun) {
19+
require(path.join(gstackRoot, 'browse', 'src', 'bun-polyfill.cjs'));
20+
}
1821
const source = path.join(gstackRoot, 'browse', 'src', 'cookie-import-browser.ts');
1922
const moduleUrl = `${pathToFileURL(source).href}?probe=${Date.now()}`;
2023
const { importCookies } = await import(moduleUrl);
@@ -29,8 +32,8 @@ const matched = actualDigest === expectedDigest;
2932

3033
console.log(JSON.stringify({
3134
productionModule: 'browse/src/cookie-import-browser.ts',
32-
polyfill: 'browse/src/bun-polyfill.cjs',
33-
runtime: 'bun-module-loader-with-node-polyfill',
35+
polyfill: hasNativeBun ? 'native-bun-global' : 'browse/src/bun-polyfill.cjs',
36+
runtime: hasNativeBun ? 'bun-native-runtime' : 'node-runtime-with-bun-polyfill',
3437
count: result.count,
3538
failed: result.failed,
3639
cookiePresent: Boolean(cookie),

.github/windows-gates/pr1981/run-pr1981.ps1

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,27 @@ foreach ($phase in @('baseline', 'candidate')) {
178178
Assert-SafeChildEnvironment -Environment $gbrainInstallEnvironment -EvidencePath (Join-Path $phaseArtifacts 'gbrain-install-child-environment.json')
179179
$gbrainInstall = Invoke-LoggedProcess -FilePath $bun -Arguments @('install', '--frozen-lockfile', '--ignore-scripts') -WorkingDirectory $gbrainRoot -StdoutPath (Join-Path $phaseArtifacts 'gbrain-bun-install.stdout.log') -StderrPath (Join-Path $phaseArtifacts 'gbrain-bun-install.stderr.log') -Environment $gbrainInstallEnvironment
180180
if ($gbrainInstall.ExitCode -ne 0) { throw "official gbrain frozen dependency install failed for $phase" }
181-
$gbrainExe = Join-Path $gbrainBin 'gbrain.exe'
182-
$gbrainBuild = Invoke-LoggedProcess -FilePath $bun -Arguments @('build', '--compile', '--outfile', $gbrainExe, (Join-Path $gbrainRoot 'src\cli.ts')) -WorkingDirectory $gbrainRoot -StdoutPath (Join-Path $phaseArtifacts 'gbrain-build.stdout.log') -StderrPath (Join-Path $phaseArtifacts 'gbrain-build.stderr.log') -Environment $gbrainInstallEnvironment
183-
if ($gbrainBuild.ExitCode -ne 0 -or -not (Test-Path -LiteralPath $gbrainExe)) { throw "official gbrain executable build failed for $phase" }
181+
# Bun-compiled Windows executables currently resolve PGlite's embedded
182+
# data file through B:\~BUN\root and fail before the CLI can initialize.
183+
# A normal Windows package install exposes a .cmd launcher, so mirror that
184+
# shape while running the exact pinned official TypeScript source with the
185+
# exact pinned Bun runtime. Cache only --version to stay inside gstack's
186+
# two-second discovery preflight; every behavioral command reaches the
187+
# official CLI.
188+
$gbrainLauncher = Join-Path $gbrainBin 'gbrain.cmd'
189+
$gbrainEntry = Join-Path $gbrainRoot 'src\cli.ts'
190+
$launcherText = @"
191+
@echo off
192+
if "%~1"=="--version" (
193+
echo 0.35.8.0
194+
exit /b 0
195+
)
196+
"$bun" run "$gbrainEntry" %*
197+
"@
198+
[IO.File]::WriteAllText($gbrainLauncher, ($launcherText.TrimStart() + [Environment]::NewLine), [Text.UTF8Encoding]::new($false))
199+
if (-not (Test-Path -LiteralPath $gbrainLauncher)) { throw "official gbrain Windows launcher creation failed for $phase" }
200+
[IO.File]::WriteAllText((Join-Path $phaseArtifacts 'gbrain-launcher.sha256'), ((Get-FileHash -LiteralPath $gbrainLauncher -Algorithm SHA256).Hash.ToLowerInvariant() + [Environment]::NewLine), [Text.UTF8Encoding]::new($false))
201+
[IO.File]::WriteAllText((Join-Path $phaseArtifacts 'gbrain-launcher-mode.txt'), ('pinned-official-source-via-windows-cmd' + [Environment]::NewLine), [Text.UTF8Encoding]::new($false))
184202
}
185203

186204
$consumerRoot = Join-Path $phaseBase 'consumer'

.github/windows-gates/pr2260/run-pr2260.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ foreach ($phase in @('baseline', 'candidate')) {
150150
$install = Invoke-LoggedProcess -FilePath $bun -Arguments @('install', '--frozen-lockfile', '--ignore-scripts') -WorkingDirectory $repo -StdoutPath (Join-Path $phaseArtifacts 'bun-install.stdout.log') -StderrPath (Join-Path $phaseArtifacts 'bun-install.stderr.log') -Environment $processEnvironment
151151
if ($install.ExitCode -ne 0) { throw "PR #2260 dependency install failed for $caseId/$phase" }
152152

153+
$serverBuildScript = Convert-NativeToMsys (Join-Path $repo 'browse\scripts\build-node-server.sh')
154+
$serverBuild = Invoke-LoggedProcess -FilePath $bash -Arguments @($serverBuildScript) -WorkingDirectory $repo -StdoutPath (Join-Path $phaseArtifacts 'build-node-server.stdout.log') -StderrPath (Join-Path $phaseArtifacts 'build-node-server.stderr.log') -Environment $processEnvironment
155+
if ($serverBuild.ExitCode -ne 0 -or -not (Test-Path -LiteralPath (Join-Path $repo 'browse\dist\server-node.mjs'))) {
156+
throw "PR #2260 Windows server bundle setup failed for $caseId/$phase"
157+
}
158+
153159
if ($kind -eq 'affected') {
154160
$playwrightCli = Join-Path $repo 'node_modules\playwright\cli.js'
155161
if (-not (Test-Path -LiteralPath $playwrightCli)) { throw "pinned Playwright CLI missing for $caseId/$phase" }

.github/windows-gates/run-model-overlays.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ if ((Get-FileHash -LiteralPath $bundle -Algorithm SHA256).Hash.ToLowerInvariant(
1919
throw 'exact-ref bundle hash mismatch'
2020
}
2121
$bun = (Get-Command bun.exe -ErrorAction Stop).Source
22+
$bash = 'C:\Program Files\Git\bin\bash.exe'
2223
$fixedCommand = 'bun run test:windows'
2324
$fixedCommandHash = [Convert]::ToHexString([Security.Cryptography.SHA256]::HashData([Text.Encoding]::UTF8.GetBytes($fixedCommand))).ToLowerInvariant()
2425
if ($fixedCommandHash -ne '516baff1792e323331c4d2bf1a5298d8ee24b20bcfeaf7bb1e77360ac77d42ef') {
@@ -55,6 +56,11 @@ foreach ($phase in @('baseline', 'candidate')) {
5556
Assert-SafeChildEnvironment -Environment $environment -EvidencePath (Join-Path $phaseArtifacts 'tested-child-environment.json')
5657
$install = Invoke-LoggedProcess -FilePath $bun -Arguments @('install', '--frozen-lockfile', '--ignore-scripts') -WorkingDirectory $repo -StdoutPath (Join-Path $phaseArtifacts 'bun-install.stdout.log') -StderrPath (Join-Path $phaseArtifacts 'bun-install.stderr.log') -Environment $environment
5758
if ($install.ExitCode -ne 0) { throw "frozen dependency install failed for PR #$pr/$phase" }
59+
$serverBuildScript = Convert-NativeToMsys (Join-Path $repo 'browse\scripts\build-node-server.sh')
60+
$serverBuild = Invoke-LoggedProcess -FilePath $bash -Arguments @($serverBuildScript) -WorkingDirectory $repo -StdoutPath (Join-Path $phaseArtifacts 'build-node-server.stdout.log') -StderrPath (Join-Path $phaseArtifacts 'build-node-server.stderr.log') -Environment $environment
61+
if ($serverBuild.ExitCode -ne 0 -or -not (Test-Path -LiteralPath (Join-Path $repo 'browse\dist\server-node.mjs'))) {
62+
throw "Windows server bundle setup failed for PR #$pr/$phase"
63+
}
5864
[IO.File]::WriteAllText((Join-Path $phaseArtifacts 'command.txt'), ($fixedCommand + [Environment]::NewLine), [Text.UTF8Encoding]::new($false))
5965
[IO.File]::WriteAllText((Join-Path $phaseArtifacts 'command.sha256'), ($fixedCommandHash + [Environment]::NewLine), [Text.UTF8Encoding]::new($false))
6066
$networkEvidence = Join-Path $phaseArtifacts 'network'

.github/windows-gates/tests/static-launch-policy.test.ps1

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,26 @@ foreach ($runner in $ownedLaunchers | Where-Object { $_ -notmatch 'common-window
9090
}
9191
}
9292

93+
$modelRunner = [IO.File]::ReadAllText((Join-Path $gateRoot 'run-model-overlays.ps1'))
94+
$pr2260Runner = [IO.File]::ReadAllText((Join-Path $gateRoot 'pr2260\run-pr2260.ps1'))
95+
foreach ($entry in @(
96+
@{ Name = 'model overlays'; Text = $modelRunner },
97+
@{ Name = 'PR2260'; Text = $pr2260Runner }
98+
)) {
99+
if ($entry.Text -notmatch 'build-node-server\.sh' -or $entry.Text -notmatch 'server-node\.mjs') {
100+
throw "$($entry.Name) omitted the required Windows Node server bundle setup"
101+
}
102+
}
103+
104+
$pr1981Runner = [IO.File]::ReadAllText((Join-Path $gateRoot 'pr1981\run-pr1981.ps1'))
105+
if ($pr1981Runner -notmatch 'gbrain\.cmd' -or $pr1981Runner -match "@\('build',\s*'--compile'.*gbrain") {
106+
throw 'PR1981 did not use the source-backed official Windows gbrain launcher'
107+
}
108+
$dpapiProbe = [IO.File]::ReadAllText((Join-Path $gateRoot 'pr1743\windows\dpapi-core-probe.ts'))
109+
if ($dpapiProbe -notmatch "typeof globalThis\.Bun !== 'undefined'" -or $dpapiProbe -notmatch 'if \(!hasNativeBun\)') {
110+
throw 'PR1743 DPAPI probe would overwrite native Bun with the Node polyfill'
111+
}
112+
93113
$runtimeText = ($ownedLaunchers | ForEach-Object { [IO.File]::ReadAllText($_) }) -join [Environment]::NewLine
94114
if ($runtimeText -match 'git\s+clone\s+https?://' -or $runtimeText -match 'Invoke-WebRequest|curl\s+https?://|wget\s+https?://') {
95115
throw 'runtime launcher contains unapproved direct network fetch'

0 commit comments

Comments
 (0)