Thing/scripts/run-eveunity-split-handoff-smoke.ps1
2026-07-09 15:40:38 +01:00

139 lines
5.4 KiB
PowerShell

param(
[string] $HandoffPath = "packages\org.gamecult.eve.unity-uitoolkit\eveunity-split-handoff.json",
[string] $CapabilityPath = "packages\org.gamecult.eve.unity-uitoolkit\eve-runtime-capability.json"
)
$ErrorActionPreference = "Stop"
$projectRoot = Split-Path -Parent $PSScriptRoot
$absoluteHandoffPath = if ([System.IO.Path]::IsPathRooted($HandoffPath)) {
$HandoffPath
} else {
Join-Path $projectRoot $HandoffPath
}
$absoluteCapabilityPath = if ([System.IO.Path]::IsPathRooted($CapabilityPath)) {
$CapabilityPath
} else {
Join-Path $projectRoot $CapabilityPath
}
if (-not (Test-Path -LiteralPath $absoluteHandoffPath)) {
throw "EveUnity split handoff manifest not found: $absoluteHandoffPath"
}
if (-not (Test-Path -LiteralPath $absoluteCapabilityPath)) {
throw "EveUnity runtime capability manifest not found: $absoluteCapabilityPath"
}
$handoff = Get-Content -LiteralPath $absoluteHandoffPath -Raw | ConvertFrom-Json
$capability = Get-Content -LiteralPath $absoluteCapabilityPath -Raw | ConvertFrom-Json
if ($handoff.schema -ne "gamecult.eve.runtime_split_handoff.v1") {
throw "Unexpected EveUnity split handoff schema: $($handoff.schema)"
}
if ($handoff.splitTarget -ne "EveUnity") {
throw "Unexpected EveUnity split handoff target: $($handoff.splitTarget)"
}
if ($handoff.ownerRepo -ne "EveUnity") {
throw "Unexpected EveUnity split handoff owner: $($handoff.ownerRepo)"
}
if ($handoff.currentHostRepo -ne "Eve") {
throw "Unexpected EveUnity split handoff host: $($handoff.currentHostRepo)"
}
if ($handoff.runtimeId -ne "unity-uitoolkit") {
throw "Unexpected EveUnity split handoff runtime: $($handoff.runtimeId)"
}
if ($capability.incubation.splitHandoff.manifestPath -ne $HandoffPath.Replace("\", "/")) {
$expectedPath = $HandoffPath.Replace("\", "/")
throw "EveUnity capability manifest does not point at split handoff. Expected $expectedPath got $($capability.incubation.splitHandoff.manifestPath)"
}
$expectedStages = @("release", "test", "capture")
foreach ($stage in $expectedStages) {
if (-not $capability.lifecycle.$stage) {
throw "EveUnity capability lifecycle missing stage: $stage"
}
}
$moveSets = @($handoff.moveSets)
foreach ($stage in $expectedStages) {
$moveSet = $moveSets | Where-Object { $_.stage -eq $stage } | Select-Object -First 1
if (-not $moveSet) {
throw "EveUnity split handoff missing move set for stage: $stage"
}
if ($moveSet.destinationOwner -ne "EveUnity") {
throw "EveUnity split handoff stage $stage has unexpected destination owner: $($moveSet.destinationOwner)"
}
if (-not $moveSet.replacementProof) {
throw "EveUnity split handoff stage $stage missing replacement proof"
}
$pendingProofs = @($capability.lifecycle.$stage.pendingProofs)
if (-not ($pendingProofs -contains $moveSet.replacementProof)) {
throw "EveUnity split handoff stage $stage replacement proof is not mirrored in runtime capability pending proofs: $($moveSet.replacementProof)"
}
foreach ($relativePath in @($moveSet.currentPaths)) {
$absolutePath = Join-Path $projectRoot $relativePath
if (-not (Test-Path -LiteralPath $absolutePath)) {
throw "EveUnity split handoff stage $stage references missing current path: $relativePath"
}
}
}
$consumerBoundary = $moveSets | Where-Object { $_.id -eq "aetheria-unity-consumer-boundary" } | Select-Object -First 1
if (-not $consumerBoundary) {
throw "EveUnity split handoff missing Aetheria Unity consumer-boundary move set"
}
if ($consumerBoundary.stage -ne "provider-consumer") {
throw "Aetheria Unity consumer-boundary move set has unexpected stage: $($consumerBoundary.stage)"
}
if ($consumerBoundary.destinationOwner -ne "EveUnity") {
throw "Aetheria Unity consumer-boundary has unexpected destination owner: $($consumerBoundary.destinationOwner)"
}
if (-not $consumerBoundary.replacementProof) {
throw "Aetheria Unity consumer-boundary missing replacement proof"
}
foreach ($relativePath in @($consumerBoundary.currentPaths)) {
$absolutePath = Join-Path $projectRoot $relativePath
if (-not (Test-Path -LiteralPath $absolutePath)) {
throw "Aetheria Unity consumer-boundary references missing current path: $relativePath"
}
}
foreach ($providerPath in @($consumerBoundary.observedProviderPaths)) {
if (-not ([System.IO.Path]::IsPathRooted($providerPath))) {
throw "Aetheria Unity observed provider path must be absolute: $providerPath"
}
if (-not (Test-Path -LiteralPath $providerPath)) {
throw "Aetheria Unity observed provider path is missing: $providerPath"
}
}
foreach ($requiredObservedPath in @(
"E:\Projects\Aetheria\Packages\manifest.json",
"E:\Projects\Aetheria\GameCult.Eve.UnityUIToolkit.csproj",
"E:\Projects\Aetheria\Assets"
)) {
if (-not (@($consumerBoundary.observedProviderPaths) -contains $requiredObservedPath)) {
throw "Aetheria Unity consumer-boundary missing required observed provider path: $requiredObservedPath"
}
}
foreach ($contract in @(
"gamecult.eve.surface.v1",
"gamecult.eve.command.v1",
"gamecult.eve.provider_advertisement.v1",
"gamecult.eve.plugin_advertisement.v1",
"gamecult.eve.plugin.v1",
"gamecult.eve.conformance_export.v1"
)) {
if (-not (@($handoff.contractInputs) -contains $contract)) {
throw "EveUnity split handoff missing contract input: $contract"
}
}
foreach ($proof in @($handoff.requiredExternalProofs)) {
if (-not $proof) {
throw "EveUnity split handoff contains an empty required external proof"
}
}
Write-Host "EveUnity split handoff smoke passed: $absoluteHandoffPath"