1, 'kind' => 'backup_create', 'host_id' => 7, 'operation_id' => str_repeat('ab', 16), 'request_fingerprint' => str_repeat('c', 64), ]; $largeUrls = []; for ($part = 1; $part <= 512; $part++) { $largeUrls[] = 'https://storage.example.invalid/backups/object.qcow2?' . 'partNumber=' . $part . '&X-Amz-Signature=' . str_repeat('d', 320); } $createPayload = [ $identityKey => $identity, 'owner_id' => 42, 'can_manage' => true, 'backup_key' => str_repeat('e', 32), 'maximum_size_bytes' => 44023414784, 'method' => 'POST', 'request_target' => '/v1/vms/uuid/backups', 'body' => [ 'object_upload' => [ 'part_urls' => $largeUrls, 'complete_url' => $largeUrls[0], 'abort_url' => $largeUrls[1], 'verify_url' => $largeUrls[2], ], ], ]; $encodedOriginal = json_encode($createPayload, JSON_THROW_ON_ERROR); $assert(strlen($encodedOriginal) > 196608, 'The fixture no longer exercises the prepared-envelope size limit.'); $createCompact = $compact->invoke(null, 'backup_create', $createPayload); $encodedCompact = json_encode($createCompact, JSON_THROW_ON_ERROR); $assert(strlen($encodedCompact) < 4096, 'Prepared backup evidence still retains oversized capabilities.'); $assert(($createCompact[$identityKey] ?? null) === $identity && ($createCompact['maximum_size_bytes'] ?? null) === 44023414784 && !isset($createCompact['body']) && !str_contains($encodedCompact, 'X-Amz-Signature'), 'Prepared backup evidence lost identity or retained a capability URL.'); $restorePayload = [ $identityKey => array_replace($identity, ['kind' => 'backup_restore']), 'owner_id' => 42, 'can_manage' => true, 'backup_key' => str_repeat('e', 32), 'restore_key' => str_repeat('f', 32), 'reservation_id' => 91, 'body' => [ 'vcpu' => 4, 'memory_mib' => 8192, 'disk_gib' => 80, 'bandwidth_mbps' => 500, 'network' => 'bridge:restore-wan', 'public_ip_cidr' => '203.0.113.19/24', 'public_pool_key' => str_repeat('1', 32), 'public_pool_cidr' => '203.0.113.0/24', 'gateway' => '203.0.113.1', 'dns_servers' => ['9.9.9.9', '149.112.112.112'], 'source_url' => $largeUrls[0], 'source_sha256' => str_repeat('2', 64), 'root_password' => 'must-not-survive', ], ]; $restoreCompact = $compact->invoke(null, 'backup_restore', $restorePayload); $encodedRestore = json_encode($restoreCompact, JSON_THROW_ON_ERROR); $assert(($restoreCompact['body'] ?? null) === [ 'vcpu' => 4, 'memory_mib' => 8192, 'disk_gib' => 80, 'bandwidth_mbps' => 500, 'network' => 'bridge:restore-wan', 'public_ip_cidr' => '203.0.113.19/24', 'public_pool_key' => str_repeat('1', 32), 'public_pool_cidr' => '203.0.113.0/24', 'gateway' => '203.0.113.1', 'dns_servers' => ['9.9.9.9', '149.112.112.112'], ] && !str_contains($encodedRestore, 'source_url') && !str_contains($encodedRestore, 'root_password') && !str_contains($encodedRestore, 'X-Amz-Signature'), 'Prepared restore evidence retained an expired capability or secret.'); $publicNetwork = [ 'attachment_key' => str_repeat('3', 32), 'network' => 'bridge:br0', 'addresses' => [ [ 'address_family' => 4, 'address_cidr' => '203.0.113.29/24', 'gateway' => '203.0.113.1', 'pool_key' => str_repeat('4', 32), 'dns_servers' => ['9.9.9.9'], ], [ 'address_family' => 6, 'address_cidr' => '2001:db8:100::29/64', 'gateway' => '2001:db8:100::1', 'pool_key' => str_repeat('5', 32), 'dns_servers' => ['2620:fe::fe'], ], ], ]; $vpcPort = [ 'vpc_key' => str_repeat('6', 32), 'address_cidr' => '10.0.0.29/24', 'mac_address' => '02:00:00:00:00:29', ]; $migrationPayload = [ $identityKey => array_replace( $identity, ['kind' => 'instance_migration_transfer'] ), 'owner_id' => 42, 'can_manage' => true, 'reservation_id' => 92, 'maintenance_migration_id' => 93, 'body' => [ 'vcpu' => 8, 'memory_mib' => 16384, 'disk_gib' => 160, 'bandwidth_mbps' => 1000, 'public_network' => $publicNetwork, 'vpc_port' => $vpcPort, 'public_ip_cidr' => '203.0.113.29/24', 'gateway' => '203.0.113.1', 'source_url' => $largeUrls[0], 'root_password' => 'must-not-survive', ], ]; $migrationCompact = $compact->invoke( null, 'instance_migration_transfer', $migrationPayload ); $encodedMigration = json_encode( $migrationCompact, JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES ); $assert(($migrationCompact['body'] ?? null) === [ 'vcpu' => 8, 'memory_mib' => 16384, 'disk_gib' => 160, 'bandwidth_mbps' => 1000, 'public_network' => $publicNetwork, 'vpc_port' => $vpcPort, ] && !str_contains($encodedMigration, 'public_ip_cidr') && !str_contains($encodedMigration, 'source_url') && !str_contains($encodedMigration, 'root_password') && !str_contains($encodedMigration, 'X-Amz-Signature'), 'Prepared migration evidence lost canonical dual-stack state or retained' . ' a retired scalar field, capability, or secret.'); echo "Portable-backup prepared recovery envelope contract passed.\n";