id()") && str_contains($service, "'host/network-options', \$actor, \$diagnostics->id()") && str_contains($service, 'private const ENGINE_TIMEOUT_SECONDS = 8.0;') && str_contains($service, 'public_ip_available_count') && str_contains($service, "['available', 'disabled']") && str_contains($service, 'self::LOCAL_IP_HOLDS') && str_contains($service, '$poolObserved') && str_contains($service, 'public_ip_pool_id') && str_contains($service, "['degraded', self::ERROR_INVALID_NETWORK]") && str_contains($service, "['unavailable', self::ERROR_UNAVAILABLE]") && str_contains($service, '$attemptedAt = $this->now();') && str_contains($service, 'private function beginAttempt') && str_contains($service, '(int) $snapshot->attempt_generation !== $attemptGeneration') && str_contains($service, '$snapshot->last_attempt_at = $attemptedAt;') && str_contains($service, "\$host->last_seen_at = \$now;") && substr_count($service, "\$host->last_seen_at =") === 1, 'Capacity/IP timeout, observation, local-state preservation or last-seen boundary changed.'); $assert(str_contains($service, 'private const MAX_PUBLIC_POOLS = 32;') && str_contains($service, 'private const MAX_PUBLIC_IPS_PER_POOL = 254;') && str_contains($service, 'private const MAX_PUBLIC_IPS_PER_HOST = 8128;') && str_contains($service, 'private static function reconcilePublicInventory') && str_contains($service, 'private static function networksOverlap') && str_contains($service, "'reserved_ips_known' => true") && str_contains($service, '$publicPool->reserved_ips_json = json_encode(') && str_contains($service, "preg_match('/^[0-9a-f]{32}$/D'") && str_contains($service, '$hasNewerDesiredConfiguration') && str_contains($service, '$incomingRevision < $desiredRevision') && str_contains($service, 'if (!$hasNewerDesiredConfiguration)') && str_contains($service, 'public capacity does not match pool catalog') && str_contains($service, 'public pool observations disagree'), 'Bounded multi-pool parsing, identity or cross-endpoint count checks are missing.'); $applyStart = strpos($service, 'private function apply'); $failureStart = strpos($service, 'private function markFailure'); $apply = $applyStart === false || $failureStart === false ? '' : substr($service, $applyStart, $failureStart - $applyStart); $hostLock = strpos($apply, "CloudHost::where('id', \$hostId)->lockForUpdate()"); $snapshotLock = strpos($apply, "CloudHostCapacitySnapshot::where('host_id', \$hostId)"); $membershipLock = strpos($apply, 'CloudHostPoolMembershipService::lockedRows'); $attachmentLock = strpos($apply, "CloudHostNetworkAttachment::where('host_id', \$hostId)"); $poolLock = strpos($apply, "CloudPublicIpPool::where('host_id', \$hostId)"); $ipLock = strpos($apply, "CloudPublicIp::where('host_id', \$hostId)"); $assert($apply !== '' && $hostLock !== false && $snapshotLock !== false && $membershipLock !== false && $attachmentLock !== false && $poolLock !== false && $ipLock !== false && $hostLock < $snapshotLock && $snapshotLock < $membershipLock && $membershipLock < $attachmentLock && $attachmentLock < $poolLock && $poolLock < $ipLock, 'Inventory lock order must remain host, snapshot fence, membership, attachment, pool, IP.'); $validationStart = strpos($service, 'private static function capacity', $failureStart); $failure = $failureStart === false || $validationStart === false ? '' : substr($service, $failureStart, $validationStart - $failureStart); $assert($failure !== '' && str_contains($failure, "\$snapshot->sync_state = 'failed';") && str_contains($failure, "\$snapshot->last_error_code = \$code;") && !str_contains($failure, 'cpu_total_cores') && !str_contains($failure, 'CloudPublicIp::') && !str_contains($failure, 'CloudPublicIpPool::') && !str_contains($failure, 'CloudHostNetworkAttachment::'), 'Failure handling may clear last-known capacity or mutate pool/IP inventory.'); $assert(str_contains($actor, "Config::get('super_admin', '')") && str_contains($actor, "->where('enable', 1)->where('is_admin', 1)") && str_contains($runtime, "CloudDaemonActor::resolve('cloud-runtime-sync')") && !str_contains($runtime, 'private function systemActor') && str_contains($service, "CloudDaemonActor::resolve('cloud-host-inventory-sync')"), 'Daemon engine actors no longer share one permission resolver.'); $assert(str_contains($lifecycle, "busy('host_inventory_sync')") && str_contains($lifecycle, 'new CloudHostInventorySyncService()') && str_contains($lifecycle, 'min(10, $batchSize)') && str_contains($service, 'public function syncOne(int $hostId): array') && str_contains($service, "Config::get('cloud_host_inventory_interval_seconds', 30)") && str_contains($service, 'private const MAX_HOSTS_PER_PASS = 10;') && str_contains($service, "'cloud_host_resource_pool_memberships'") && str_contains($service, "'cloud_host_network_attachments'") && str_contains($service, "'cloud_public_ip_pools'") && str_contains($service, "hasColumn('cloud_public_ips', 'public_ip_pool_id')") && str_contains($heartbeat, "'host_inventory_sync' => '宿主容量与公网 IP 同步'") && str_contains($heartbeat, "'host_inventory_sync_failed'") && str_contains($heartbeat, "'host_inventory_sync_unconfigured'"), 'Lifecycle heartbeat phase or fixed inventory diagnostics are missing.'); $assert(!str_contains($service, 'getMessage()') && !str_contains($service, "['error']") && !str_contains($service, "['detail']"), 'Raw engine diagnostics can cross the inventory persistence boundary.'); echo "Cloud host inventory source contracts passed.\n";