withHeader('Cache-Control', 'private, no-store')"), 'Pool writes must be super-admin-only and use a strict request/response boundary.'); $assert(str_contains($service, 'private const MAX_POOLS = 32;') && str_contains($service, "private const STATES = ['active', 'draining', 'disabled'];") && str_contains($service, "hash_hmac(\n 'sha256'") && str_contains($service, "CloudSecrets::key('payload_key')") && !str_contains($service, 'bin2hex(random_bytes(16))') && !str_contains($service, "'GET', 'host/network-pools'") && str_contains($service, "'host/network-pools/' . rawurlencode(\$poolKey)") && str_contains($service, 'CloudHostPoolMembershipService::lockedRows') && str_contains($service, 'CloudHostPoolMembershipService::selected') && str_contains($service, "\$lockedHost->default_network") && str_contains($service, 'CloudHostNetworkAttachment') && str_contains($service, 'CloudPublicIpPool') && str_contains($service, 'desired_revision') && str_contains($service, 'observed_revision') && str_contains($service, 'sync_state') && str_contains($service, 'refreshAttachmentAggregate') && str_contains($service, "'uncertain' => 4") && str_contains($service, 'if ($confirmedRevision > 0)') && str_contains($service, '$attachment->observed_revision = $evidenceRevision;'), 'The service must persist host/line attachment desired state and independent pool revisions.'); $assert(str_contains($service, "preg_match('/^[0-9a-f]{32}$/D', \$requestKey)") && str_contains($service, 'sameCreateRequest(') && str_contains($service, "'replay' => true") && str_contains($service, '存在尚未核对的地址池创建记录,请刷新后编辑该记录,不能继续创建新地址池') && str_contains($service, '$expectedRevision !== $revisionBase') && str_contains($service, '公网地址池版本已变化,请刷新后重试') && str_contains($service, "\$prepared['revision'],\n 'applied'") && str_contains($service, "\$retryExisting = false") && str_contains($service, 'materializeIpLedger') && str_contains($service, "(string) \$pool->sync_state === 'applied'"), 'Creates must be idempotent, updates CAS-fenced and successful writes must materialize the panel IP ledger.'); $assert(str_contains($service, 'assertNoOverlap(') && str_contains($service, 'assertNoGlobalOverlap(') && str_contains($service, 'catalogCount(') && str_contains($service, '一台宿主机最多配置 32 个公网地址池') && str_contains($service, 'OCCUPIED_IP_STATES') && str_contains($service, '该地址池仍有实例或任务占用,只能修改名称和运行状态') && str_contains($service, '$originalAttachment') && str_contains($service, '$attachmentChanged') && str_contains($service, '$attachmentLineChanged') && !str_contains($service, '->delete()'), 'Pool limits, overlap checks, occupied runtime locks and soft lifecycle states are required.'); $assert(str_contains($service, 'legacyInstanceIpClaims(') && str_contains($service, 'materializeIpLedger(') && str_contains((string) $usage, "CloudInstance::where('host_id', \$hostId)") && str_contains((string) $usage, "'unknown'") && str_contains((string) $usage, 'spec_json') && str_contains((string) $usage, 'managementAddressFromValue'), 'Legacy panel instances must be counted/imported from panel metadata and block on unknown usage without host discovery.'); $assert(str_contains($engineClient, '/host/network-pools/[0-9a-f]{32}$#D') && str_contains($engineClient, "? '公网地址池配置未通过引擎校验'") && str_contains($service, '公网地址池应用状态不确定,请勿重复提交,稍后刷新核对') && !str_contains($service, '$error->getMessage()'), 'Engine pool failures must retain reviewed status only and never expose raw engine detail.'); foreach (['host-public-pool', 'host-gateway', 'host-dns', 'host-reserved', 'host-vm-prefix'] as $retiredId) { $assert(!str_contains($template, 'id="' . $retiredId . '"'), 'The old single-pool host input remains in the main form: ' . $retiredId); } $assert(!str_contains($hostController, "'public_pool_cidr', 'public_gateway'") && !str_contains($client, 'function hostPublicNetworkPayload()') && str_contains($hostController, "\$engineHost['public_pool_cidr'] ?? ''"), 'The main host writer must not accept pool input or double-write the pool catalog.'); $assert(str_contains($template, 'id="host-network-pools-drawer"') && str_contains($template, 'data-admin-host-network-drawer') && str_contains($template, '{if !$admin_can_manage|default:false}disabled{/if}') && str_contains($client, 'window.VenixDrawerMotion.openDrawerWithMotion') && str_contains($client, 'window.VenixDrawerMotion.closeDrawerWithMotion') && str_contains($client, "{ method: 'POST', body }") && str_contains($client, "{ method: 'PUT', body }") && str_contains($client, 'networkPoolEpoch') && str_contains($client, 'networkPoolHostId') && str_contains($client, 'networkPoolContextCurrent(hostId, epoch)') && str_contains($client, 'globalThis.crypto?.getRandomValues') && str_contains($client, 'request_key: requestKey') && str_contains($client, 'expected_revision: expectedRevision') && str_contains($client, 'const payload = await api(`/api/v1/admin/hosts/${encodeURIComponent(hostId)}/network-pools`);') && str_contains($client, 'save.disabled = !canManage') && str_contains($client, 'for (const control of [cidr, gateway, prefix, dns, reserved]) control.disabled = true;') && !file_exists($root . '/public/cloud/admin-host-network.css'), 'The responsive pool editor must reuse the shared drawer/CSS and expose disabled write controls.'); $assert(str_contains($service, 'legacyRebuildMessage()') && str_contains($service, '本项目不执行旧数据迁移,请先清空并按新版结构重建开发数据') && str_contains($service, 'legacyRowDto(') && str_contains($template, '旧行仅供核对且不能编辑'), 'Legacy development rows must be explicitly blocked and never rendered as native editable pools.'); $assert(preg_match("/venix_asset_version value='([0-9]+)'/", $assets, $match) === 1 && (int) $match[1] >= 2026100316, 'The shared browser asset version must cover the host pool drawer release.'); echo "Administrator host public-pool contracts passed.\n";