(int) \$instance->host_id)") && substr_count($contexts, "->host((int) \$hostId, 'GET', 'vms', \$actor)") === 1, 'Instance inventory is not requested once per visible host.'); $assert(str_contains($contexts, 'CloudHost::whereIn') && str_contains($contexts, 'CloudServicePeriod::whereIn') && str_contains($contexts, "->groupBy('instance_id')"), 'Instance host and service-period dependencies are no longer bulk loaded.'); $assert(str_contains($contexts, "\$allowed[strtolower((string) \$instance->uuid)] = (int) \$instance->id") && str_contains($contexts, "\$instanceId = \$allowed[strtolower(trim(\$vm['uuid']))] ?? null") && str_contains($contexts, 'if ($instanceId !== null)'), 'Engine inventory is not strictly intersected with actor-visible database UUIDs.'); $assert(str_contains($list, '$contexts = $this->vmListContexts($instances, $actor)') && str_contains($list, '$contexts[(int) $instance->id] ?? []'), 'The VM list bypasses its bulk contexts and may reintroduce per-row reads.'); $assert(str_contains($detailApi, '$this->vmData(CloudAccess::instance($args[\'id\'], $actor), $actor)'), 'The single-instance API no longer starts from the owner-scoped access check.'); $loadVm = $section($runtime, 'async function loadVm(', 'function renderVmDetail('); $selection = $section($runtime, 'async function selectVmByApiId(', 'function bindPageCleanup('); $assert(str_contains($loadVm, "api(`/api/v1/vms/\${encodeURIComponent(id)}`)") && str_contains($loadVm, 'state.vms = [vm]'), 'The detail loader does not use the single-instance API.'); $assert(str_contains($selection, 'await loadVm(apiId, true)') && !str_contains($selection, 'loadVms('), 'Detail selection still fetches the full VM list.'); $statusLoader = $section($runtime, 'async function loadVmStatus(', 'function renderVmDetail('); $assert(str_contains($detail, 'hydrateVmDetailBootstrap(detailBootstrap())') && str_contains($detailTemplate, 'id="vm-detail-bootstrap"') && !str_contains($detail, 'initializeSession(') && !str_contains($detail, 'selectVmByApiId(') && !str_contains($detail, 'loadVm('), 'Detail first paint must hydrate the SSR bootstrap without session or full-VM requests.'); $assert(str_contains($statusLoader, 'api(`/api/v1/vms/${encodeURIComponent(id)}/status`)') && str_contains($statusLoader, 'const current = selectedVm()') && substr_count($detail, 'loadVmStatus(vmId)') >= 4 && str_contains($detail, 'window.setTimeout(poll, 20000)') && !str_contains($detail, 'setInterval(') && !str_contains($detail, 'loadVms'), 'Detail refresh and non-overlapping polling must use only the lightweight status endpoint.'); echo "Cloud instance bulk-list and single-detail read paths passed.\n";