@@ -115,6 +115,66 @@ Describe 'IntegrationRunbook - Phase Selection & JSON' -Tag 'Unit' {
115115 Remove-Item Env:LV_HEAD_VI - ErrorAction SilentlyContinue
116116 }
117117 }
118+
119+ It ' projects loop execution topology from the loop final status into Loop phase details' {
120+ $tempRepo = Join-Path $TestDrive ' runbook-loop-topology'
121+ $scriptsDir = Join-Path $tempRepo ' scripts'
122+ New-Item - ItemType Directory - Path $scriptsDir - Force | Out-Null
123+
124+ $runbookCopy = Join-Path $scriptsDir ' Invoke-IntegrationRunbook.ps1'
125+ Copy-Item - LiteralPath $runScript - Destination $runbookCopy - Force
126+
127+ $loopStub = @"
128+ param([string]`$ FinalStatusJsonPath)
129+ `$ payload = [ordered]@{
130+ schema = 'loop-final-status-v1'
131+ timestamp = '2026-03-24T12:30:00Z'
132+ iterations = 2
133+ diffs = 0
134+ errors = 0
135+ succeeded = `$ true
136+ harness = [ordered]@{
137+ runtimeSurface = 'windows-native-teststand'
138+ processModelClass = 'parallel-process-model'
139+ windowsOnly = `$ true
140+ requestedSimultaneous = `$ true
141+ cellClass = 'worker'
142+ executionCellLeasePath = 'tests/results/_agent/runtime/execution-cell-hooke-loop.json'
143+ executionCellId = 'exec-cell-hooke-loop-01'
144+ executionCellLeaseId = 'lease-hooke-loop-01'
145+ harnessInstanceLeasePath = 'tests/results/_agent/runtime/harness-instance-hooke-loop.json'
146+ harnessInstanceLeaseId = 'harness-lease-hooke-loop-01'
147+ harnessInstanceId = 'ts-hooke-loop-01'
148+ }
149+ }
150+ (`$ payload | ConvertTo-Json -Depth 8) | Set-Content -LiteralPath `$ FinalStatusJsonPath -Encoding UTF8
151+ exit 0
152+ "@
153+ Set-Content - LiteralPath (Join-Path $scriptsDir ' Run-AutonomousIntegrationLoop.ps1' ) - Value $loopStub - Encoding UTF8
154+
155+ Set-Content - LiteralPath (Join-Path $tempRepo ' VI1.vi' ) - Value ' ' - Encoding utf8
156+ Set-Content - LiteralPath (Join-Path $tempRepo ' VI2.vi' ) - Value ' ' - Encoding utf8
157+
158+ $tmp = Join-Path $tempRepo ' tmp-runbook-loop-topology.json'
159+ Push-Location $tempRepo
160+ try {
161+ & $runbookCopy - Phases ' Prereqs,ViInputs,Loop' - JsonReport $tmp | Out-Null
162+ $LASTEXITCODE | Should - Be 0
163+ } finally {
164+ Pop-Location
165+ }
166+
167+ Test-Path $tmp | Should - BeTrue
168+ $json = Get-Content $tmp - Raw | ConvertFrom-Json
169+ $loopPhase = $json.phases | Where-Object name -eq ' Loop'
170+ $loopPhase.status | Should - Be ' Passed'
171+ $loopPhase.details.loopIterations | Should - Be 2
172+ $loopPhase.details.executionTopology.runtimeSurface | Should - Be ' windows-native-teststand'
173+ $loopPhase.details.executionTopology.processModelClass | Should - Be ' parallel-process-model'
174+ $loopPhase.details.executionTopology.executionCellLeaseId | Should - Be ' lease-hooke-loop-01'
175+ $loopPhase.details.executionTopology.harnessInstanceLeaseId | Should - Be ' harness-lease-hooke-loop-01'
176+ $loopPhase.details.executionTopology.harnessInstanceId | Should - Be ' ts-hooke-loop-01'
177+ }
118178}
119179
120180Describe ' IntegrationRunbook - Schema Shape Minimal Validation' - Tag ' Unit' {
0 commit comments