Skip to content

Commit 9f9173e

Browse files
author
Agent Runner
committed
feat: formalize runbook topology contract (#1905)
1 parent 5725071 commit 9f9173e

3 files changed

Lines changed: 67 additions & 2 deletions

File tree

docs/schemas/integration-runbook-v1.schema.json

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,62 @@
2626
]
2727
},
2828
"status": { "type": "string", "enum": ["Passed", "Failed", "Skipped"] },
29-
"details": { "type": "object" }
29+
"details": {
30+
"type": "object",
31+
"properties": {
32+
"exitCode": { "type": ["integer", "null"] },
33+
"error": { "type": "string" },
34+
"loopIterations": { "type": "integer", "minimum": 0 },
35+
"finalStatusPath": { "type": "string" },
36+
"finalStatusReadError": { "type": "string" },
37+
"finalStatusMissing": { "type": "boolean" },
38+
"harness": {
39+
"type": "object",
40+
"properties": {
41+
"runtimeSurface": { "const": "windows-native-teststand" },
42+
"processModelClass": {
43+
"type": "string",
44+
"enum": ["sequential-process-model", "parallel-process-model"]
45+
},
46+
"windowsOnly": { "type": "boolean" },
47+
"requestedSimultaneous": { "type": "boolean" },
48+
"cellClass": { "type": ["string", "null"] },
49+
"executionCellLeasePath": { "type": "string" },
50+
"executionCellId": { "type": "string" },
51+
"executionCellLeaseId": { "type": "string" },
52+
"harnessInstanceLeasePath": { "type": "string" },
53+
"harnessInstanceLeaseId": { "type": "string" },
54+
"harnessInstanceId": { "type": "string" }
55+
},
56+
"additionalProperties": true
57+
},
58+
"executionTopology": {
59+
"type": "object",
60+
"properties": {
61+
"runtimeSurface": { "const": "windows-native-teststand" },
62+
"processModelClass": {
63+
"type": "string",
64+
"enum": ["sequential-process-model", "parallel-process-model"]
65+
},
66+
"windowsOnly": { "type": "boolean" },
67+
"requestedSimultaneous": { "type": "boolean" },
68+
"cellClass": { "type": ["string", "null"] },
69+
"executionCellLeasePath": { "type": "string" },
70+
"executionCellId": { "type": "string" },
71+
"executionCellLeaseId": { "type": "string" },
72+
"harnessInstanceLeasePath": { "type": "string" },
73+
"harnessInstanceLeaseId": { "type": "string" },
74+
"harnessInstanceId": { "type": "string" }
75+
},
76+
"additionalProperties": true
77+
}
78+
},
79+
"additionalProperties": true
80+
}
3081
},
3182
"additionalProperties": false
3283
}
3384
}
3485
},
3586
"additionalProperties": true
36-
}
87+
}

tests/IntegrationRunbook.Tests.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Describe 'IntegrationRunbook - Phase Selection & JSON' -Tag 'Unit' {
1111
$global:runRoot = Resolve-Path (Join-Path $PSScriptRoot '..')
1212
$global:runScript = Resolve-Path $scriptPath
1313
$global:schemaFile = Resolve-Path $schemaPath
14+
. "$PSScriptRoot/TestHelpers.Schema.ps1"
1415
}
1516

1617
It 'emits JSON with expected schema id and core properties (subset phases)' {
@@ -31,6 +32,7 @@ Describe 'IntegrationRunbook - Phase Selection & JSON' -Tag 'Unit' {
3132
Test-Path $tmp | Should -BeTrue
3233
$json = Get-Content $tmp -Raw | ConvertFrom-Json
3334
$json.schema | Should -Be 'integration-runbook-v1'
35+
Assert-JsonShape -Path $tmp -Spec 'IntegrationRunbook' | Should -BeTrue
3436
$json.phases.Count | Should -Be 2
3537
($json.phases | ForEach-Object name) | Should -Be @('Prereqs','ViInputs')
3638
$json.overallStatus | Should -Match 'Passed|Failed'
@@ -166,6 +168,7 @@ exit 0
166168

167169
Test-Path $tmp | Should -BeTrue
168170
$json = Get-Content $tmp -Raw | ConvertFrom-Json
171+
Assert-JsonShape -Path $tmp -Spec 'IntegrationRunbook' | Should -BeTrue
169172
$loopPhase = $json.phases | Where-Object name -eq 'Loop'
170173
$loopPhase.status | Should -Be 'Passed'
171174
$loopPhase.details.loopIterations | Should -Be 2

tests/TestHelpers.Schema.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ $script:JsonShapeSpecs['LoopEvent'] = [pscustomobject]@{
102102
}
103103
}
104104

105+
$script:JsonShapeSpecs['IntegrationRunbook'] = [pscustomobject]@{
106+
Required = @('schema','generated','phases','overallStatus')
107+
Optional = @()
108+
Types = @{
109+
schema = { param($v) $v -is [string] -and $v -eq 'integration-runbook-v1' }
110+
generated = { param($v) ($v -is [string]) -or ($v -is [datetime]) }
111+
overallStatus = { param($v) $v -is [string] -and $v -match '^(Passed|Failed)$' }
112+
phases = { param($v) $v -is [object[]] }
113+
}
114+
}
115+
105116
function Assert-JsonShape {
106117
[CmdletBinding()] param(
107118
[Parameter(Mandatory)][string]$Path,

0 commit comments

Comments
 (0)