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('public-pool-key')") && !str_contains($service, 'bin2hex(random_bytes(16))') && !str_contains($service, 'CloudAgentClient') && str_contains($service, 'CloudHostPoolMembershipService::lockedRows') && str_contains($service, 'CloudHostPoolMembershipService::selected') && str_contains($service, "\$lockedHost->default_network") && str_contains($service, 'CloudNetworkSelector::isValid($selector)') && str_contains($service, "\$attachment->network_mode = 'selector';") && 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, '->transaction(function () use (') && str_contains($service, "\$pool->observed_revision = \$revision;") && str_contains($service, "\$pool->sync_state = 'applied';") && !str_contains($service, 'dispatch_attempts') && str_contains($service, 'materializeIpLedger') && str_contains($service, "(string) \$pool->sync_state === 'applied'"), 'Creates must be idempotent, updates CAS-fenced and local commits must atomically 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, '该地址池仍有实例或任务占用,只能修改名称、运行状态和未占用的保留 / 禁用 IP') && str_contains($service, '已分配或任务占用的公网 IP 不能加入保留 / 禁用列表') && str_contains($service, '$occupiedAddressesByPool') && str_contains($service, 'occupiedUnsafeRuntimeChanged') && 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, 'materializeIpLedger(') && str_contains((string) $usage, "CloudInstance::where('cloud_instances.host_id', \$hostId)") && str_contains((string) $usage, 'capacity_snapshots') && str_contains((string) $usage, "'unknown'") && str_contains((string) $usage, 'spec_json') && str_contains((string) $usage, 'managementAddressFromValue'), 'Panel instances must be counted from PHP metadata and block on unknown usage without host discovery.'); $assert(str_contains($service, 'PHP is the sole authority for public-pool configuration and IP allocation') && str_contains($service, "'applied'") && !str_contains($service, 'CloudAgentClient') && !str_contains($service, 'request('), 'PHP-owned pool writes must not depend on a second host-side pool catalog.'); 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, "'default_network'") && !str_contains($hostController, 'public_gateway'), '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]) control.disabled = true;') && !str_contains($client, '[cidr, gateway, prefix, dns, reserved]') && str_contains($client, '已分配或任务占用的 IP 会被拒绝') && !file_exists($root . '/public/cloud/admin-host-network.css'), 'The responsive pool editor must lock network identity while allowing unoccupied disabled-IP edits.'); $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";