Files
ARCADIA-Studio/harness/experiments/text-diagnostics-20260913/notices/notices-actual-2/run.ps1
T
sorokin.oleg.edu 9fd76aef3a Add current-draft diagnostic underlines and passive hover
Preserve raw include diagnostic provenance and derive bands from the existing shaped editor. Retain deferred tooltip paragraphs through rendering. Include source, regression, failure and native-trial evidence; corrected native acceptance remains pending.
2026-09-13 01:43:22 -07:00

71 lines
6.3 KiB
PowerShell

$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
$taskRepo = 'C:/ar-text-9e8r6t'
$taskMain = 'C:/Users/User/Documents/Git/ARCADIA-Studio'
$taskOutput = $PSScriptRoot
$taskEncoding = New-Object Text.UTF8Encoding($false)
function Task-Write($Name, $Value) {
$path = Join-Path $taskOutput $Name
$stream = [IO.File]::Open($path, [IO.FileMode]::CreateNew)
$writer = New-Object IO.StreamWriter($stream, $taskEncoding)
try { $writer.Write(($Value | ConvertTo-Json -Depth 24) + "`n") } finally { $writer.Dispose() }
}
function Task-Hash($Path) { (Get-FileHash -LiteralPath $Path -Algorithm SHA256).Hash.ToLowerInvariant() }
function Task-Require([bool]$Condition, [string]$Message) { if (-not $Condition) { throw $Message } }
$taskInputs = [ordered]@{}
foreach ($relative in @('scripts/windows-notices.ps1', 'scripts/windows-notices/manifest.json', 'Cargo.toml', 'Cargo.lock')) {
$taskInputs[$relative] = Task-Hash (Join-Path $taskRepo $relative)
}
$taskEnv = Join-Path $taskMain '.local/toolchain/env.ps1'
$taskVendorRoot = Join-Path $taskRepo 'crates/vendor/iced_widget'
$taskVendorBefore = [ordered]@{}
foreach ($file in Get-ChildItem -LiteralPath $taskVendorRoot -Recurse -File | Sort-Object FullName) {
$relative = $file.FullName.Substring($taskVendorRoot.Length + 1).Replace('\', '/')
$taskVendorBefore[$relative] = Task-Hash $file.FullName
}
Task-Write 'inputs.json' ([ordered]@{ startedUtc = [DateTime]::UtcNow.ToString('o'); repository = $taskRepo; target = 'x86_64-pc-windows-gnullvm'; helperSha256 = (Task-Hash $PSCommandPath); environmentScriptSha256 = (Task-Hash $taskEnv); files = $taskInputs; vendorFiles = $taskVendorBefore })
$taskStarted = [DateTime]::UtcNow
$taskWatch = [Diagnostics.Stopwatch]::StartNew()
try {
. $taskEnv
. (Join-Path $taskRepo 'scripts/windows-notices.ps1')
$taskNotices = Get-ArcadiaNotices $taskRepo 'x86_64-pc-windows-gnullvm' (Join-Path $taskRepo 'scripts/windows-notices/manifest.json') (Join-Path $taskMain '.local/toolchain/llvm-mingw-20260826-ucrt-x86_64')
$taskVendors = @($taskNotices.Inventory.packages | Where-Object { $_.name -eq 'iced_widget' })
Task-Require ($taskVendors.Count -eq 1) 'Expected exactly one resolved iced_widget package'
$taskVendor = $taskVendors[0]
Task-Require ($taskVendor.version -eq '0.14.2' -and $taskVendor.local_path -eq 'crates/vendor/iced_widget') 'Wrong vendor identity/path'
Task-Require ($null -eq $taskVendor.source -and $null -eq $taskVendor.registry_checksum) 'Vendor attributed to registry source'
Task-Require ($taskVendor.license -eq 'MIT') 'Unexpected vendor license declaration'
Task-Require ($taskVendor.local_source_sha256.Count -eq $taskVendorBefore.Count) 'Vendor file inventory differs'
foreach ($relative in $taskVendorBefore.Keys) {
Task-Require ($taskVendor.local_source_sha256.Contains($relative)) "Vendor input not inventoried: $relative"
Task-Require ($taskVendor.local_source_sha256[$relative] -eq $taskVendorBefore[$relative]) "Vendor source inventory differs: $relative"
Task-Require ((Task-Hash (Join-Path $taskVendorRoot $relative)) -eq $taskVendorBefore[$relative]) "Vendor source changed: $relative"
}
$taskExpected = @('licenses/dependencies/iced_widget-0.14.2/ARCADIA-PATCH.md', 'licenses/dependencies/iced_widget-0.14.2/LICENSE')
$taskActual = @($taskVendor.notices | ForEach-Object { $_.path } | Sort-Object)
Task-Require (($taskActual -join '|') -ceq ($taskExpected -join '|')) 'Vendor notice membership differs'
foreach ($notice in $taskVendor.notices) {
$relative = [IO.Path]::GetFileName($notice.path)
Task-Require ($notice.sha256 -eq $taskVendorBefore[$relative]) "Vendor notice source hash differs: $relative"
Task-Require ((Task-Hash $taskNotices.Inputs[$notice.path]) -eq $notice.sha256) "Vendor notice input differs: $relative"
Task-Require ($taskNotices.Hashes[$notice.path] -eq $notice.sha256) "Vendor notice recorded hash differs: $relative"
}
foreach ($relative in $taskInputs.Keys) {
Task-Require ((Task-Hash (Join-Path $taskRepo $relative)) -eq $taskInputs[$relative]) "Input changed: $relative"
}
Task-Require ((Task-Hash $taskEnv) -eq (Get-Content -LiteralPath (Join-Path $taskOutput 'inputs.json') -Raw | ConvertFrom-Json).environmentScriptSha256) 'Environment script changed'
Task-Write 'vendor.json' $taskVendor
$taskSummary = @($taskNotices.Inventory.packages | ForEach-Object { [ordered]@{ id = $_.id; name = $_.name; version = $_.version; source = $_.source; local_path = $_.local_path; registry_checksum = $_.registry_checksum; sourceFiles = $_.local_source_sha256.Count; notices = $_.notices.Count } })
Task-Write 'packages.json' $taskSummary
$taskWatch.Stop()
Task-Write 'result.json' ([ordered]@{ status = 'PASS'; startedUtc = $taskStarted.ToString('o'); finishedUtc = [DateTime]::UtcNow.ToString('o'); seconds = $taskWatch.Elapsed.TotalSeconds; target = $taskNotices.Inventory.target; rootPackages = $taskNotices.Inventory.root_packages; packageCount = $taskNotices.Inventory.packages.Count; noticeInputCount = $taskNotices.Inputs.Count; vendorFilesVerified = $taskVendorBefore.Count; vendorNotices = $taskActual; vendorRecordSha256 = (Task-Hash (Join-Path $taskOutput 'vendor.json')); packagesSummarySha256 = (Task-Hash (Join-Path $taskOutput 'packages.json')); inputsSha256 = (Task-Hash (Join-Path $taskOutput 'inputs.json')); inputsUnchanged = $true; runtime = $taskNotices.Inventory.runtime; scope = 'Actual locked offline Windows gnullvm dependency notice preflight, desktop/server graph; exact vendored path source and own-license/patch-notice readback. No compilation, packaging, native application or publication. Full transitive source inventory not retained; compact package summary and exact vendor record retained.' })
Write-Output 'PASS: actual Windows notice preflight and vendor readback'
exit 0
} catch {
$taskWatch.Stop()
Task-Write 'result.json' ([ordered]@{ status = 'FAIL'; startedUtc = $taskStarted.ToString('o'); finishedUtc = [DateTime]::UtcNow.ToString('o'); seconds = $taskWatch.Elapsed.TotalSeconds; error = $_.Exception.Message; detail = $_.ToString(); inputsSha256 = (Task-Hash (Join-Path $taskOutput 'inputs.json')); scope = 'Read-only notice preflight; failure preserved, no tracked edits.' })
Write-Error $_
exit 1
}