Add Electron capture request contract
This commit is contained in:
parent
41d20338d9
commit
cc556c2c0c
13 changed files with 348 additions and 15 deletions
99
scripts/run-eveelectron-capture-contract-smoke.ps1
Normal file
99
scripts/run-eveelectron-capture-contract-smoke.ps1
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
param(
|
||||
[string] $CapabilityManifestPath = "runtimes\incubating\eve-electron\eve-runtime-capability.json",
|
||||
[string] $AdvertisementPath = "web\fixtures\aetheria.provider-advertisement.json",
|
||||
[string] $OutputPath = "artifacts\eveelectron-capture-contract\latest\capture-request.json",
|
||||
[string] $Stamp = "smoke"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$absoluteCapabilityPath = if ([System.IO.Path]::IsPathRooted($CapabilityManifestPath)) {
|
||||
$CapabilityManifestPath
|
||||
} else {
|
||||
Join-Path $projectRoot $CapabilityManifestPath
|
||||
}
|
||||
$absoluteAdvertisementPath = if ([System.IO.Path]::IsPathRooted($AdvertisementPath)) {
|
||||
$AdvertisementPath
|
||||
} else {
|
||||
Join-Path $projectRoot $AdvertisementPath
|
||||
}
|
||||
$absoluteOutputPath = if ([System.IO.Path]::IsPathRooted($OutputPath)) {
|
||||
$OutputPath
|
||||
} else {
|
||||
Join-Path $projectRoot $OutputPath
|
||||
}
|
||||
|
||||
foreach ($path in @($absoluteCapabilityPath, $absoluteAdvertisementPath)) {
|
||||
if (-not (Test-Path -LiteralPath $path)) {
|
||||
throw "EveElectron capture contract input not found: $path"
|
||||
}
|
||||
}
|
||||
|
||||
$manifest = Get-Content -LiteralPath $absoluteCapabilityPath -Raw | ConvertFrom-Json
|
||||
$captureContract = $manifest.lifecycle.capture.captureContract
|
||||
if ($null -eq $captureContract) {
|
||||
throw "EveElectron capture contract missing lifecycle.capture.captureContract"
|
||||
}
|
||||
foreach ($field in @("ownerRepo", "runtimeId", "targetId", "requestSchema", "requestBuilder", "advertisementPath", "captureKind", "artifactKind", "artifactPattern", "conformanceAttachment", "requiredProvider", "requiredSurface", "authority", "publishProof")) {
|
||||
if (-not $captureContract.$field) {
|
||||
throw "EveElectron capture contract missing $field"
|
||||
}
|
||||
}
|
||||
if ($captureContract.ownerRepo -ne "EveElectron") {
|
||||
throw "Unexpected EveElectron capture owner: $($captureContract.ownerRepo)"
|
||||
}
|
||||
if ($captureContract.runtimeId -ne "electron-shell") {
|
||||
throw "Unexpected EveElectron capture runtime: $($captureContract.runtimeId)"
|
||||
}
|
||||
if ($captureContract.targetId -ne "electron-shell") {
|
||||
throw "Unexpected EveElectron capture target: $($captureContract.targetId)"
|
||||
}
|
||||
if ($captureContract.requestSchema -ne "gamecult.eve.runtime_capture_request.v1") {
|
||||
throw "Unexpected EveElectron capture request schema: $($captureContract.requestSchema)"
|
||||
}
|
||||
|
||||
$builderPath = Join-Path $projectRoot $captureContract.requestBuilder
|
||||
if (-not (Test-Path -LiteralPath $builderPath)) {
|
||||
throw "EveElectron capture request builder not found: $($captureContract.requestBuilder)"
|
||||
}
|
||||
if ((Join-Path $projectRoot $captureContract.advertisementPath) -ne $absoluteAdvertisementPath) {
|
||||
throw "EveElectron capture advertisement path mismatch: $($captureContract.advertisementPath) vs $AdvertisementPath"
|
||||
}
|
||||
|
||||
node --test (Join-Path $projectRoot "tools\eveelectron\eveelectron-capture-contract.test.mjs")
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "EveElectron capture contract tests failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
node $builderPath --capability $absoluteCapabilityPath --advertisement $absoluteAdvertisementPath --output $absoluteOutputPath --stamp $Stamp
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "EveElectron capture request builder failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
if (-not (Test-Path -LiteralPath $absoluteOutputPath)) {
|
||||
throw "EveElectron capture request was not written: $absoluteOutputPath"
|
||||
}
|
||||
|
||||
$request = Get-Content -LiteralPath $absoluteOutputPath -Raw | ConvertFrom-Json
|
||||
foreach ($expectation in @(
|
||||
@{ field = "schema"; value = "gamecult.eve.runtime_capture_request.v1" },
|
||||
@{ field = "runtimeId"; value = "electron-shell" },
|
||||
@{ field = "ownerRepo"; value = "EveElectron" },
|
||||
@{ field = "providerId"; value = "aetheria" },
|
||||
@{ field = "surfaceId"; value = "aetheria.daemon.game" },
|
||||
@{ field = "targetId"; value = "electron-shell" },
|
||||
@{ field = "commandBoundary"; value = "aetheria.daemon.commands" },
|
||||
@{ field = "receiptSchema"; value = "aetheria.eve_command_acceptance_status.v1" },
|
||||
@{ field = "captureKind"; value = "electron-window-png" },
|
||||
@{ field = "artifactKind"; value = "png" },
|
||||
@{ field = "conformanceAttachment"; value = "runtime.captureArtifacts[]" }
|
||||
)) {
|
||||
if ($request.($expectation.field) -ne $expectation.value) {
|
||||
throw "EveElectron capture request $($expectation.field) expected $($expectation.value) got $($request.($expectation.field))"
|
||||
}
|
||||
}
|
||||
if ($request.artifactPath -ne "artifacts/eveelectron-capture/$Stamp/electron-shell.png") {
|
||||
throw "Unexpected EveElectron capture artifact path: $($request.artifactPath)"
|
||||
}
|
||||
|
||||
Write-Host "EveElectron capture contract smoke passed: $absoluteOutputPath"
|
||||
|
|
@ -138,13 +138,33 @@ foreach ($pathProperty in @("runnerScript", "consumerProject")) {
|
|||
}
|
||||
|
||||
$captureContract = $manifest.lifecycle.capture.captureContract
|
||||
foreach ($field in @("ownerRepo", "runtimeId", "captureKind", "artifactKind", "artifactPattern", "conformanceAttachment", "requiredProvider", "requiredSurface", "authority", "publishProof")) {
|
||||
foreach ($field in @("ownerRepo", "runtimeId", "targetId", "requestSchema", "requestBuilder", "advertisementPath", "captureKind", "artifactKind", "artifactPattern", "conformanceAttachment", "requiredProvider", "requiredSurface", "authority", "publishProof")) {
|
||||
if (-not $captureContract.$field) {
|
||||
throw "EveElectron capture contract missing $field"
|
||||
}
|
||||
}
|
||||
if ($captureContract.runtimeId -ne "electron-shell") {
|
||||
throw "EveElectron capture contract has unexpected runtime: $($captureContract.runtimeId)"
|
||||
}
|
||||
if ($captureContract.targetId -ne "electron-shell") {
|
||||
throw "EveElectron capture contract has unexpected target: $($captureContract.targetId)"
|
||||
}
|
||||
if ($captureContract.requestSchema -ne "gamecult.eve.runtime_capture_request.v1") {
|
||||
throw "EveElectron capture contract has unexpected request schema: $($captureContract.requestSchema)"
|
||||
}
|
||||
if ($captureContract.captureKind -ne "electron-window-png") {
|
||||
throw "EveElectron capture contract has unexpected capture kind: $($captureContract.captureKind)"
|
||||
}
|
||||
foreach ($pathProperty in @("requestBuilder", "advertisementPath")) {
|
||||
$relativePath = $captureContract.$pathProperty
|
||||
$absolutePath = Join-Path $projectRoot $relativePath
|
||||
if (-not (Test-Path -LiteralPath $absolutePath)) {
|
||||
throw "EveElectron capture contract $pathProperty does not exist: $relativePath"
|
||||
}
|
||||
}
|
||||
|
||||
& (Join-Path $projectRoot "scripts\run-eveelectron-split-handoff-smoke.ps1")
|
||||
& (Join-Path $projectRoot "scripts\run-eveelectron-provider-shell-smoke.ps1")
|
||||
& (Join-Path $projectRoot "scripts\run-eveelectron-capture-contract-smoke.ps1")
|
||||
|
||||
Write-Host "EveElectron lifecycle smoke passed: $absoluteManifestPath"
|
||||
|
|
|
|||
|
|
@ -67,7 +67,9 @@ foreach ($evidencePath in @($worldSurfaceLoweringClaim.evidencePaths)) {
|
|||
$expectedFiles = @(
|
||||
"runtimes\incubating\eve-electron\package.json",
|
||||
"runtimes\incubating\eve-electron\src\eve-electron-shell.mjs",
|
||||
"runtimes\incubating\eve-electron\test\eve-electron-shell.test.mjs"
|
||||
"runtimes\incubating\eve-electron\test\eve-electron-shell.test.mjs",
|
||||
"scripts\run-eveelectron-capture-contract-smoke.ps1",
|
||||
"tools\eveelectron\eveelectron-capture-contract.mjs"
|
||||
)
|
||||
|
||||
foreach ($relativePath in $expectedFiles) {
|
||||
|
|
|
|||
|
|
@ -69,6 +69,14 @@ foreach ($id in @("electron-shell-runtime", "electron-command-transport", "elect
|
|||
}
|
||||
}
|
||||
|
||||
$captureMoveSet = $moveSets | Where-Object { $_.id -eq "electron-capture-lifecycle" } | Select-Object -First 1
|
||||
if (-not $captureMoveSet) {
|
||||
throw "EveElectron split handoff missing move set: electron-capture-lifecycle"
|
||||
}
|
||||
if (@($captureMoveSet.currentPaths).Count -eq 0) {
|
||||
throw "EveElectron capture lifecycle move set must declare currentPaths"
|
||||
}
|
||||
|
||||
foreach ($contract in @(
|
||||
"gamecult.eve.surface.v1",
|
||||
"gamecult.eve.command.v1",
|
||||
|
|
|
|||
|
|
@ -167,6 +167,10 @@ node $consumerScript $consumerExport `
|
|||
--expect-runtime-lifecycle-field "electron-shell:test:testContract.runnerKind:electron-provider-shell-smoke" `
|
||||
--expect-runtime-lifecycle-field "electron-shell:test:testContract.runnerScript:scripts/run-eveelectron-provider-shell-smoke.ps1" `
|
||||
--expect-runtime-lifecycle-field "electron-shell:capture:captureContract.captureKind:electron-window-png" `
|
||||
--expect-runtime-lifecycle-field "electron-shell:capture:captureContract.targetId:electron-shell" `
|
||||
--expect-runtime-lifecycle-field "electron-shell:capture:captureContract.requestSchema:gamecult.eve.runtime_capture_request.v1" `
|
||||
--expect-runtime-lifecycle-field "electron-shell:capture:captureContract.requestBuilder:tools/eveelectron/eveelectron-capture-contract.mjs" `
|
||||
--expect-runtime-lifecycle-field "electron-shell:capture:captureContract.advertisementPath:web/fixtures/aetheria.provider-advertisement.json" `
|
||||
--expect-runtime-lifecycle-field "electron-shell:capture:captureContract.requiredSurface:aetheria.daemon.game" `
|
||||
--expect-runtime-lifecycle-status tui:release:pending-tui-package `
|
||||
--expect-runtime-lifecycle-status tui:test:provider-shell-contract-skeleton `
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ try {
|
|||
--expect-split-handoff-move EveElectron:electron-shell:electron-shell-runtime:current:exists:eve-electron-shell.mjs `
|
||||
--expect-split-handoff-move EveElectron:electron-shell:electron-command-transport:current:exists:eve-electron-shell.mjs `
|
||||
--expect-split-handoff-move EveElectron:electron-shell:electron-world-surface-lowering:current:exists:eve-electron-shell.mjs `
|
||||
--expect-split-handoff-move EveElectron:electron-shell:electron-capture-lifecycle:current:exists:eveelectron-capture-contract.mjs `
|
||||
--expect-split-handoff-move EveElectron:electron-shell:electron-shell-runtime:observed-provider:exists:Aetheria.Rts.Web/Electron `
|
||||
--expect-split-handoff-move EveElectron:electron-shell:electron-command-transport:observed-provider:exists:Aetheria.Rts.Web/Client/app.ts `
|
||||
--expect-split-handoff-move EveElectron:electron-shell:electron-world-surface-lowering:observed-provider:exists:Aetheria.Rts.Web/Client `
|
||||
|
|
|
|||
Loading…
Reference in a new issue