''") && !str_contains($order, "'public_pool_cidr' => ''") && !str_contains($order, "'public_ip_cidr' => ''") && !str_contains($order, "'gateway' => ''"), 'Unpaid orders still define the retired scalar public-network contract.'); $purchaseTransaction = strpos($order, "return (new User())->getConnection()->transaction("); $assert($purchaseTransaction !== false && !str_contains($order, '云快照创建实例正在升级双栈网络,暂不可用') && str_contains($order, 'CloudDeploymentSnapshotService::resolveForOrder('), 'Cloud-snapshot purchase remains behind the retired compatibility gate.'); $paymentStart = strpos($order, 'public static function queuePaidProvision('); $paymentPlacement = strpos($order, 'CloudPlacementService::reserve(', $paymentStart === false ? 0 : $paymentStart); $paymentPath = $paymentStart === false || $paymentPlacement === false ? '' : substr($order, $paymentStart, $paymentPlacement - $paymentStart); $assert($paymentPath !== '' && str_contains($paymentPath, "} elseif (\$source === 'deployment_snapshot') {") && str_contains($paymentPath, 'CloudDeploymentSnapshotService::resolveForOrder(') && str_contains($paymentPath, 'CloudBackupService::provisioningSource('), 'Paid cloud-snapshot provisioning does not revalidate its immutable source before placement.'); $backupIdentityStart = strpos($recovery, 'private static function backupProvisionIdentity('); $backupIdentityEnd = strpos($recovery, 'private static function backingBackupIdentity(', $backupIdentityStart === false ? 0 : $backupIdentityStart); $backupIdentity = $backupIdentityStart === false || $backupIdentityEnd === false ? '' : substr($recovery, $backupIdentityStart, $backupIdentityEnd - $backupIdentityStart); $assert($backupIdentity !== '' && str_contains($backupIdentity, "'public_network'") && str_contains($backupIdentity, 'CloudPublicNetworkSnapshot::fromArray(') && str_contains($backupIdentity, '$requestedPublicNetwork->fingerprint()') && str_contains($backupIdentity, '$reservation->operation_id') && !str_contains($backupIdentity, "'public_pool_key'") && !str_contains($backupIdentity, "'public_ip_cidr'"), 'Cloud-snapshot create recovery still trusts the retired scalar network contract.'); $compactOrder = preg_replace('/\s+/', ' ', $order) ?? $order; $assert(str_contains($compactOrder, "\$orderSpec['public_network'] = \$placement['public_network']->toArray();") && str_contains($order, "\$placement['payload']['body']['public_network']"), 'Paid order and dispatched job do not freeze the same public-network snapshot.'); foreach (['reserveBundle(', 'commitBundle(', 'fenceBundle(', 'releaseBundle('] as $call) { $assert(preg_match( '/CloudPublicNetworkAllocationService::\s*' . preg_quote($call, '/') . '/', $placement ) === 1, 'Provisioning placement does not use bundle operation: ' . $call); } $assert(!str_contains($placement, 'releaseCommittedBundle(') && str_contains($releaseAuthority, 'CloudPublicNetworkAllocationService::') && str_contains($releaseAuthority, 'releaseCommittedBundle(') && str_contains($releaseAuthority, 'CloudPortableRestoreInstanceDeletion::releaseCommitted('), 'Confirmed instance deletion bypasses its canonical release authority.'); $releaseAuthorityCallers = []; foreach ([$root . '/app', $root . '/config', $root . '/public'] as $directory) { $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $directory, FilesystemIterator::SKIP_DOTS ) ); foreach ($iterator as $file) { if (!$file->isFile() || $file->getExtension() !== 'php') { continue; } $contents = file_get_contents($file->getPathname()); if (is_string($contents) && str_contains($contents, 'CloudInstanceResourceRelease')) { $releaseAuthorityCallers[] = realpath($file->getPathname()); } } } $releaseAuthorityCallers = array_values(array_unique( $releaseAuthorityCallers )); sort($releaseAuthorityCallers); $expectedReleaseCallers = [ realpath( $root . '/app/Services/Cloud/CloudInstanceResourceRelease.php' ), realpath($root . '/app/Services/Cloud/CloudJobService.php'), realpath($root . '/app/Services/Cloud/CloudWorkerService.php'), ]; sort($expectedReleaseCallers); $assert($releaseAuthorityCallers === $expectedReleaseCallers, 'Instance deletion escaped the job/worker release authority boundary.'); $assert(str_contains($placement, "\$payload['body']['public_network'] = \$publicNetwork->toArray();") && str_contains($placement, "'public_network' => \$publicNetwork"), 'Placement does not return and dispatch one immutable dual-stack snapshot.'); $assert(!str_contains($reservation, "foreach (['network_attachment_id', 'public_ip_pool_id',") && str_contains($reservation, 'cloud_resource_reservation_ips'), 'Resource reservations still treat one public_ip_id as network authority.'); $compactWorker = preg_replace('/\s+/', ' ', $worker) ?? $worker; $workerFinalizationStart = strpos($worker, '$provisionInvoice = CloudInvoice::where('); $workerCommit = strpos($worker, 'CloudPlacementService::commit(', $workerFinalizationStart === false ? 0 : $workerFinalizationStart); $workerPreCommit = $workerFinalizationStart === false || $workerCommit === false ? '' : substr($worker, $workerFinalizationStart, $workerCommit - $workerFinalizationStart); $assert($workerPreCommit !== '' && !str_contains($workerPreCommit, 'CloudResourceReservation::where('), 'Create success locks the reservation before canonical placement commit.'); $tryHostStart = strpos($placement, 'private static function tryHost('); $allocatorCall = strpos( $placement, 'CloudPublicNetworkAllocationService::reserveBundle(', $tryHostStart === false ? 0 : $tryHostStart ); $preAllocator = $tryHostStart === false || $allocatorCall === false ? '' : substr($placement, $tryHostStart, $allocatorCall - $tryHostStart); $assert($preAllocator !== '' && !str_contains($preAllocator, 'lockedCandidates(') && !str_contains($preAllocator, 'hasCompleteDualStackCandidate('), 'tryHost can bypass the canonical allocator through a stale precheck.'); $assert(substr_count($worker, 'CloudPublicNetworkSnapshot::fromArray(') >= 2 && str_contains($compactWorker, "\$instanceSpec['public_network'] = \$confirmedPublicNetwork->toArray();") && str_contains($worker, "\$requestedPublicNetwork->fingerprint()") && str_contains($worker, "\$confirmedPublicNetwork->fingerprint()"), 'Create finalization does not compare and persist the exact dual-stack identity.'); $assert(str_contains($invoice, 'CloudPublicNetworkSnapshot::fromArray(') && str_contains($invoice, "\$spec['public_network']") && !str_contains($invoice, "\$spec['public_ip_cidr']"), 'Provision-success mail still treats scalar public_ip_cidr as authoritative.'); $assert(substr_count($recovery, 'CloudPublicNetworkSnapshot::fromArray(') >= 2 && str_contains($recovery, "\$orderSpec['public_network']") && str_contains($recovery, "\$body['public_network']"), 'Create recovery identity is not bound to the frozen dual-stack snapshot.'); echo "Dual-stack provisioning call-chain contract passed.\n";