This commit is contained in:
33333-33333 2026-08-23 17:12:29 +09:00
commit de177e8896
58 changed files with 3904 additions and 2847 deletions

View file

@ -0,0 +1,90 @@
param(
[Parameter(Mandatory=$true)][string]$NodePath,
[string]$NodeArchivePath,
[string]$OutputPath = 'audit/v23-browserless-baseline.json'
)
$ErrorActionPreference = 'Stop'
$workspace = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '..')).Path
$node = (Resolve-Path -LiteralPath $NodePath).Path
$expectedNodeArchiveSha256 = 'c95d8a7e1c99e669cc08c9f1176e068c1f50847c37908fcb8c35b62482366511'
function Run-PowerShellJson([string]$Path) {
$raw = & powershell.exe -NoProfile -ExecutionPolicy Bypass -File $Path
if ($LASTEXITCODE -ne 0) { throw "PowerShell gate failed: $Path" }
$raw | ConvertFrom-Json
}
function Run-NodeJson([string]$Path, [string[]]$Arguments = @()) {
$raw = & $node $Path @Arguments
if ($LASTEXITCODE -ne 0) { throw "Node gate failed: $Path" }
($raw | Select-Object -Last 1) | ConvertFrom-Json
}
$nodeVersion = (& $node --version | Select-Object -First 1)
if ($nodeVersion -ne 'v22.18.0') { throw "Expected Node v22.18.0, got $nodeVersion" }
$nodeArchive = $null
if ($NodeArchivePath) {
$archive = (Resolve-Path -LiteralPath $NodeArchivePath).Path
$actual = (Get-FileHash -LiteralPath $archive -Algorithm SHA256).Hash.ToLowerInvariant()
if ($actual -ne $expectedNodeArchiveSha256) { throw "Node archive SHA-256 mismatch: $actual" }
$nodeArchive = [ordered]@{
file=[System.IO.Path]::GetFileName($archive)
sha256=$actual
source='https://nodejs.org/dist/v22.18.0/node-v22.18.0-win-x64.zip'
}
}
$kernelContract = Run-PowerShellJson (Join-Path $workspace 'tests/kernel-source-contract.ps1')
$sourceContract = Run-PowerShellJson (Join-Path $workspace 'tests/source-contract.ps1')
$documentContract = Run-PowerShellJson (Join-Path $workspace 'tests/document-contract.ps1')
$tests = [ordered]@{}
foreach ($name in @('js-syntax.mjs','module-clone.mjs','precision-reference.mjs','analytic-interior.mjs','pixel-mapping.mjs','pixel-contract.mjs')) {
$tests[$name] = Run-NodeJson (Join-Path $workspace "tests/$name")
}
$runtimePath = Join-Path $workspace 'audit/v23-browserless-runtime.json'
$tests['runtime-budget.mjs'] = Run-NodeJson (Join-Path $workspace 'tests/runtime-budget.mjs') @('--out',$runtimePath)
$sourceBaseline = Get-Content -LiteralPath (Join-Path $workspace 'audit/v23-source-baseline.json') -Raw -Encoding UTF8 | ConvertFrom-Json
$report = [ordered]@{
format='mandelbrot-browserless-audit-v23'
generatedUtc=[DateTime]::UtcNow.ToString('o')
status='pass'
scope='browserless-current-artifacts'
fullAcceptance=$false
rendererVersion=23
node=[ordered]@{ version=$nodeVersion; archive=$nodeArchive }
contracts=[ordered]@{
kernel=$kernelContract
source=$sourceContract
document=$documentContract
}
executableTests=$tests
runtime=[ordered]@{
status='measured-not-acceptance'
report='audit/v23-browserless-runtime.json'
reason='Runtime values are environment/load dependent and no browser paint/input/GPU threshold is asserted.'
}
sourceWasmBuild=[ordered]@{
status=if ($sourceBaseline.sourceBuild.goldenStatus -eq 'pass') { 'prior-evidence-reused' } else { 'not-run' }
manifest=$sourceBaseline.sourceBuild.generatedManifest
reason=$sourceBaseline.sourceBuild.reason
}
v22Comparison=[ordered]@{
status='not-verifiable'
reason='No immutable v22 artifacts, hashes, or versioned baseline are present.'
}
browserAcceptance=[ordered]@{
status='not-run'
report='audit/v23-browser-baseline.json'
nonSubstitutable=@(
'actual DPR and visual output',
'transform-to-paint and Preview p95',
'long tasks and observed browser/GPU memory',
'download/cancel behavior',
'keyboard/focus/page-zoom/screen-reader behavior'
)
}
}
$target = Join-Path $workspace $OutputPath
$report | ConvertTo-Json -Depth 12 | Set-Content -LiteralPath $target -Encoding UTF8
Write-Output $target

8
scripts/build.mjs Normal file
View file

@ -0,0 +1,8 @@
import fs from 'node:fs/promises';
const root=new URL('../',import.meta.url),files=['index.html','gpu-kernels.js','script.js'];
for(const variant of ['standalone','hosted']){
const dir=new URL(`../dist/${variant}/`,import.meta.url);await fs.rm(dir,{recursive:true,force:true});await fs.mkdir(dir,{recursive:true});
for(const f of files)await fs.copyFile(new URL('../'+f,import.meta.url),new URL(f,dir));
}
await fs.writeFile(new URL('../dist/hosted/_headers',import.meta.url),`/*\n X-Content-Type-Options: nosniff\n Referrer-Policy: no-referrer\n`);
console.log(JSON.stringify({status:'pass',outputs:['dist/standalone','dist/hosted'],files},null,2));

View file

@ -75,8 +75,9 @@ $baseline = [ordered]@{
hosted = [ordered]@{
firstViewFiles = $hostedFiles
firstViewUncompressedBytes = ($hostedFiles | Measure-Object bytes -Sum).Sum
deepRequestsBeforeDeepView = 0
note = 'Transfer compression, parse, compile, and runtime timings require the fixed browser benchmark.'
deepRequestContractBeforeDeepView = 0
deepRequestMeasurementStatus = 'not-run'
note = 'The zero is a static loader contract, not a measured request count. Transfer compression, request count, parse, compile, and runtime timings require the fixed Hosted browser benchmark.'
}
standalone = [ordered]@{
files = $standaloneFiles

7
scripts/test-all.mjs Normal file
View file

@ -0,0 +1,7 @@
import {spawnSync} from 'node:child_process';
const commands=[
['node',['--check','script.js']],['node',['--check','gpu-kernels.js']],['node',['--check','tests/webgpu-acceptance.js']],
...['v24-wgsl-reserved.mjs','v24-source-contract.mjs','v24-index-contract.mjs','v24-tree-contract.mjs','v24-reference-worker.mjs','v24-direct-model.mjs','v24-cpu-numeric-model.mjs','v24-bla-model.mjs','v24-geometry-contract.mjs','v24-coordinate-format.mjs','v24-png-stream-model.mjs','v24-acceptance-contract.mjs'].map(f=>['node',['tests/'+f]])
];
for(const [cmd,args] of commands){const r=spawnSync(cmd,args,{stdio:'inherit'});if(r.status!==0)process.exit(r.status??1)}
console.log(JSON.stringify({status:'pass',suite:'v24-static-and-cpu-model',realWebGPU:'run tests/webgpu-acceptance.html in a WebGPU-capable browser'},null,2));

View file

@ -8,6 +8,7 @@ function Run-CheckedPowerShell([string]$Path) {
}
Run-CheckedPowerShell (Join-Path $workspace 'tests\kernel-source-contract.ps1')
Run-CheckedPowerShell (Join-Path $workspace 'tests\source-contract.ps1')
Run-CheckedPowerShell (Join-Path $workspace 'tests\document-contract.ps1')
$node = Get-Command node -ErrorAction SilentlyContinue
if ($node) {
@ -29,4 +30,12 @@ if ($clang -and $node -and ((& $clang.Source --version | Select-Object -First 1)
} elseif ($RequireToolchain) { throw 'clang 17.0.6 is required by -RequireToolchain.' }
else { Write-Warning 'clang 17.0.6 is unavailable; source-WASM build/golden was skipped.' }
[ordered]@{ status='pass'; nodeTests=[bool]$node; sourceWasmGolden=$sourceGolden } | ConvertTo-Json
$status = if ($node -and $sourceGolden) { 'pass' } else { 'partial' }
[ordered]@{
status=$status
sourceContracts=$true
documentContract=$true
nodeTests=[bool]$node
sourceWasmGolden=$sourceGolden
note=if ($status -eq 'partial') { 'Use -RequireToolchain for a full pass; skipped gates are not pass.' } else { $null }
} | ConvertTo-Json