From 1caa01c237b59eb2ef946adf11211517babb0e64 Mon Sep 17 00:00:00 2001 From: codex Date: Wed, 4 Nov 2026 01:33:30 +0800 Subject: [PATCH] test: retire stale single stack fixtures --- ...AdminResourceActiveClaimProjectionTest.php | 37 ++ .../CloudDefaultNetworkNonAuthorityTest.php | 4 +- .../CloudHostStorageConfigurationTest.php | 7 + ...CloudPortableBackupSameHostRestoreTest.php | 409 ------------------ web/tests/CloudRuntimeHeartbeatTest.php | 21 + web/tests/VirtualizationAssetsTest.php | 3 +- 6 files changed, 69 insertions(+), 412 deletions(-) delete mode 100644 web/tests/CloudPortableBackupSameHostRestoreTest.php diff --git a/web/tests/CloudAdminResourceActiveClaimProjectionTest.php b/web/tests/CloudAdminResourceActiveClaimProjectionTest.php index cddca485..09bcf866 100644 --- a/web/tests/CloudAdminResourceActiveClaimProjectionTest.php +++ b/web/tests/CloudAdminResourceActiveClaimProjectionTest.php @@ -50,6 +50,7 @@ $schema->create('cloud_instances', static function (Blueprint $table): void { $table->integer('host_id'); $table->integer('resource_pool_id'); $table->integer('user_id'); + $table->text('spec_json'); }); $schema->create('cloud_host_network_attachments', static function ( Blueprint $table @@ -72,6 +73,11 @@ $schema->create('cloud_public_ip_pools', static function ( $table->boolean('gateway_on_link'); $table->integer('guest_prefix_length'); $table->text('dns_servers_json'); + $table->text('reserved_ips_json'); + $table->string('allocation_start')->nullable(); + $table->string('allocation_end')->nullable(); + $table->string('allocation_cursor')->nullable(); + $table->integer('max_allocations'); }); $schema->create('cloud_public_ips', static function (Blueprint $table): void { $table->increments('id'); @@ -153,6 +159,9 @@ Capsule::table('cloud_public_ip_pools')->insert([ 'cidr' => '8.8.8.0/24', 'gateway' => '8.8.8.1', 'gateway_on_link' => 0, 'guest_prefix_length' => 24, 'dns_servers_json' => '["1.1.1.1"]', + 'reserved_ips_json' => '[]', + 'allocation_start' => null, 'allocation_end' => null, + 'allocation_cursor' => null, 'max_allocations' => 0, ], [ 'id' => 21, 'host_id' => 5, 'network_attachment_id' => 10, @@ -161,6 +170,11 @@ Capsule::table('cloud_public_ip_pools')->insert([ 'gateway' => '2404:c140:156::1', 'gateway_on_link' => 1, 'guest_prefix_length' => 64, 'dns_servers_json' => '["2606:4700:4700::1111"]', + 'reserved_ips_json' => '[]', + 'allocation_start' => '2404:c140:156:3a::10', + 'allocation_end' => '2404:c140:156:3a::ffff', + 'allocation_cursor' => '2404:c140:156:3a::12', + 'max_allocations' => 100, ], ]); $now = time(); @@ -194,6 +208,29 @@ Capsule::table('cloud_instances')->insert([ 'host_id' => 5, 'resource_pool_id' => 3, 'user_id' => 7, + 'spec_json' => json_encode([ + 'public_network' => [ + 'contract' => 1, + 'network_selector' => 'bridge:br0', + 'ipv4' => [ + 'pool_key' => str_repeat('a', 32), + 'pool_cidr' => '8.8.8.0/24', + 'address_cidr' => '8.8.8.10/24', + 'gateway' => '8.8.8.1', + 'gateway_on_link' => false, + ], + 'ipv6' => [ + 'pool_key' => str_repeat('b', 32), + 'pool_cidr' => '2404:c140:156:3a::/64', + 'address_cidr' => '2404:c140:156:3a::10/64', + 'gateway' => '2404:c140:156::1', + 'gateway_on_link' => true, + ], + 'dns_servers' => [ + '1.1.1.1', '2606:4700:4700::1111', + ], + ], + ], JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES), ]); $claims = [ 4 => ['id' => 301, 'generation' => 1, 'pool' => 20, 'ip' => 501, diff --git a/web/tests/CloudDefaultNetworkNonAuthorityTest.php b/web/tests/CloudDefaultNetworkNonAuthorityTest.php index 40eff9c5..7f6b985e 100644 --- a/web/tests/CloudDefaultNetworkNonAuthorityTest.php +++ b/web/tests/CloudDefaultNetworkNonAuthorityTest.php @@ -51,9 +51,9 @@ $assert(str_contains($placement, && str_contains($publicNetwork, "'network_selector' => (string) \$attachment->network_selector") && str_contains($restore, - "'network' => (string) \$network['network']") + "'network_selector' => (string) \$network['network_selector']") && str_contains($migration, - "'network' => (string) \$network['network']") + "'public_network' => \$publicNetwork->toArray()") && str_contains($networkChange, "->where('verified_agent_revision', (int) \$agent->revision)") && str_contains($networkChange, diff --git a/web/tests/CloudHostStorageConfigurationTest.php b/web/tests/CloudHostStorageConfigurationTest.php index d6e2517c..47a517e3 100644 --- a/web/tests/CloudHostStorageConfigurationTest.php +++ b/web/tests/CloudHostStorageConfigurationTest.php @@ -121,6 +121,9 @@ namespace { $table->string('last_error_code')->default(''); $table->string('last_agent_version')->default(''); $table->text('network_selectors_json')->default('[]'); + $table->text('public_network_capabilities_json')->default('{}'); + $table->text('portable_restore_contract_json')->default('{}'); + $table->string('portable_restore_contract_sha256', 64)->default(''); $table->integer('last_tested_at')->default(0); $table->integer('created_at'); $table->integer('updated_at'); @@ -213,6 +216,10 @@ namespace { 'last_test_status' => 'healthy', 'last_error_code' => '', 'last_agent_version' => 'test', 'network_selectors_json' => '["bridge:br0"]', + 'public_network_capabilities_json' => + '{"contract":1,"dual_stack_required":true,"project_owned_filter":true,"ndp_guard":true}', + 'portable_restore_contract_json' => '{}', + 'portable_restore_contract_sha256' => '', 'last_tested_at' => 1, 'created_at' => 1, 'updated_at' => 1, ]); diff --git a/web/tests/CloudPortableBackupSameHostRestoreTest.php b/web/tests/CloudPortableBackupSameHostRestoreTest.php deleted file mode 100644 index 489c54f8..00000000 --- a/web/tests/CloudPortableBackupSameHostRestoreTest.php +++ /dev/null @@ -1,409 +0,0 @@ -addConnection([ - 'driver' => 'sqlite', 'database' => ':memory:', -], 'default'); -$capsule->setAsGlobal(); -$capsule->bootEloquent(); -$schema = $capsule->schema('default'); - -$schema->create('cloud_hosts', static function (Blueprint $table): void { - $table->increments('id'); - $table->string('name'); - $table->boolean('enabled'); - $table->string('default_network'); -}); -$schema->create('cloud_regions', static function (Blueprint $table): void { - $table->increments('id'); - $table->string('name'); - $table->string('country_code'); - $table->string('status'); -}); -$schema->create('cloud_network_lines', static function (Blueprint $table): void { - $table->increments('id'); - $table->integer('region_id'); - $table->string('name'); - $table->string('status'); -}); -$schema->create('cloud_resource_pools', static function (Blueprint $table): void { - $table->increments('id'); - $table->integer('line_id'); - $table->string('name'); - $table->string('status'); -}); -$schema->create('cloud_host_resource_pool_memberships', - static function (Blueprint $table): void { - $table->increments('id'); - $table->integer('host_id'); - $table->integer('resource_pool_id'); - $table->string('scheduler_state'); - $table->integer('revision')->default(1); - }); -$schema->create('cloud_host_capacity_policies', - static function (Blueprint $table): void { - $table->integer('host_id')->primary(); - $table->integer('configured_cpu_cores'); - $table->integer('configured_memory_mib'); - $table->integer('configured_disk_gib'); - $table->integer('safety_cpu_cores'); - $table->integer('safety_memory_mib'); - $table->integer('safety_disk_gib'); - $table->integer('max_instances'); - }); -$schema->create('cloud_host_agents', static function (Blueprint $table): void { - $table->integer('host_id')->primary(); - $table->boolean('enabled'); - $table->integer('revision'); - $table->integer('tested_revision'); - $table->string('last_test_status'); - $table->text('network_selectors_json'); -}); -$schema->create('cloud_host_storage_configurations', - static function (Blueprint $table): void { - $table->integer('host_id')->primary(); - $table->string('state'); - }); -$schema->create('cloud_host_network_attachments', - static function (Blueprint $table): void { - $table->increments('id'); - $table->integer('host_id'); - $table->integer('line_id'); - $table->string('network_selector'); - $table->string('state'); - $table->integer('priority'); - $table->string('verification_state'); - $table->integer('verified_agent_revision'); - $table->integer('last_verified_at'); - $table->string('sync_state'); - $table->integer('observed_revision'); - $table->integer('desired_revision'); - }); -$schema->create('cloud_public_ip_pools', - static function (Blueprint $table): void { - $table->increments('id'); - $table->integer('host_id'); - $table->integer('network_attachment_id'); - $table->string('state'); - $table->string('sync_state'); - $table->integer('observed_revision'); - $table->integer('desired_revision'); - $table->integer('priority'); - $table->integer('guest_prefix_length'); - $table->string('pool_key'); - $table->string('cidr'); - $table->string('gateway'); - $table->text('dns_servers_json'); - $table->text('reserved_ips_json'); - }); -$schema->create('cloud_public_ips', static function (Blueprint $table): void { - $table->increments('id'); - $table->integer('host_id'); - $table->integer('public_ip_pool_id'); - $table->string('address'); - $table->integer('prefix_length'); - $table->string('state'); - $table->integer('reservation_id')->nullable(); - $table->integer('instance_id')->nullable(); - $table->string('operation_id')->nullable(); - $table->integer('created_at'); - $table->integer('updated_at'); -}); -$schema->create('cloud_resource_reservations', - static function (Blueprint $table): void { - $table->increments('id'); - $table->string('reservation_key'); - $table->string('operation_id'); - $table->integer('order_id')->nullable(); - $table->integer('backup_restore_id')->nullable(); - $table->integer('offer_id')->nullable(); - $table->integer('resource_pool_id'); - $table->integer('host_id'); - $table->integer('user_id'); - $table->string('state'); - $table->integer('instance_id')->nullable(); - $table->integer('network_attachment_id')->nullable(); - $table->integer('public_ip_pool_id')->nullable(); - $table->integer('public_ip_id')->nullable(); - $table->integer('cpu_cores'); - $table->integer('memory_mib'); - $table->integer('disk_gib'); - $table->integer('expires_at')->nullable(); - $table->integer('released_at')->nullable(); - $table->string('release_reason'); - $table->integer('created_at'); - $table->integer('updated_at'); - }); -$schema->create('cloud_backup_restores', - static function (Blueprint $table): void { - $table->increments('id'); - $table->integer('target_host_id'); - $table->integer('reservation_id')->nullable(); - $table->string('operation_id'); - }); -$schema->create('cloud_instances', static function (Blueprint $table): void { - $table->increments('id'); - $table->integer('host_id'); - $table->string('status'); - $table->text('spec_json'); -}); -$schema->create('cloud_instance_snapshots', - static function (Blueprint $table): void { - $table->increments('id'); - $table->integer('instance_id'); - $table->integer('host_id'); - $table->string('state'); - $table->integer('size_bytes')->nullable(); - }); - -$capsule->table('cloud_regions')->insert([ - 'id' => 1, 'name' => 'Hong Kong', 'country_code' => 'HK', - 'status' => 'active', -]); -$capsule->table('cloud_network_lines')->insert([ - ['id' => 1, 'region_id' => 1, 'name' => 'International', - 'status' => 'active'], - ['id' => 2, 'region_id' => 1, 'name' => 'Premium', - 'status' => 'active'], -]); -$capsule->table('cloud_resource_pools')->insert([ - ['id' => 1, 'line_id' => 1, 'name' => 'HKG International', - 'status' => 'active'], - ['id' => 2, 'line_id' => 2, 'name' => 'HKG Premium', - 'status' => 'active'], -]); - -foreach ([1 => 'source-host', 2 => 'other-host'] as $hostId => $name) { - $capsule->table('cloud_hosts')->insert([ - 'id' => $hostId, 'name' => $name, 'enabled' => 1, - 'default_network' => 'bridge:retired', - ]); - $capsule->table('cloud_host_resource_pool_memberships')->insert([ - 'host_id' => $hostId, 'resource_pool_id' => 1, - 'scheduler_state' => 'active', - ]); - $capsule->table('cloud_host_capacity_policies')->insert([ - 'host_id' => $hostId, - 'configured_cpu_cores' => 16, - 'configured_memory_mib' => 32768, - 'configured_disk_gib' => 1000, - 'safety_cpu_cores' => 0, - 'safety_memory_mib' => 0, - 'safety_disk_gib' => 0, - 'max_instances' => 20, - ]); - $capsule->table('cloud_host_agents')->insert([ - 'host_id' => $hostId, 'enabled' => 1, 'revision' => 1, - 'tested_revision' => 1, 'last_test_status' => 'healthy', - 'network_selectors_json' => json_encode( - $hostId === 1 - ? ['bridge:restore-a', 'bridge:restore-c'] - : ['bridge:restore-b'], - JSON_THROW_ON_ERROR - ), - ]); - $capsule->table('cloud_host_storage_configurations')->insert([ - 'host_id' => $hostId, 'state' => 'applied', - ]); - $attachmentId = $hostId; - $poolId = $hostId; - $capsule->table('cloud_host_network_attachments')->insert([ - 'id' => $attachmentId, 'host_id' => $hostId, 'line_id' => 1, - 'network_selector' => $hostId === 1 - ? 'bridge:restore-a' : 'bridge:restore-b', - 'state' => 'active', 'priority' => 0, - 'verification_state' => 'verified', - 'verified_agent_revision' => 1, 'last_verified_at' => 1700000000, - 'sync_state' => 'applied', 'observed_revision' => 1, - 'desired_revision' => 1, - ]); - $capsule->table('cloud_public_ip_pools')->insert([ - 'id' => $poolId, 'host_id' => $hostId, - 'network_attachment_id' => $attachmentId, 'state' => 'active', - 'sync_state' => 'applied', 'observed_revision' => 1, - 'desired_revision' => 1, 'priority' => 0, - 'guest_prefix_length' => 24, - 'pool_key' => str_repeat((string) $hostId, 32), - 'cidr' => '203.0.' . $hostId . '.0/24', - 'gateway' => '203.0.' . $hostId . '.1', - 'dns_servers_json' => '["1.1.1.1","8.8.8.8"]', - 'reserved_ips_json' => '[]', - ]); - $capsule->table('cloud_public_ips')->insert([ - 'host_id' => $hostId, 'public_ip_pool_id' => $poolId, - 'address' => '203.0.' . $hostId . '.20', 'prefix_length' => 24, - 'state' => 'available', 'reservation_id' => null, - 'instance_id' => null, 'operation_id' => null, - 'created_at' => 1700000000, 'updated_at' => 1700000000, - ]); -} - -// The same physical host is an active member of a second commercial line. -// Restore inventory must expose both exact host/pool identities without -// duplicating host-global capacity accounting or trusting default_network. -$capsule->table('cloud_host_resource_pool_memberships')->insert([ - 'host_id' => 1, 'resource_pool_id' => 2, 'scheduler_state' => 'active', -]); -$capsule->table('cloud_host_network_attachments')->insert([ - 'id' => 3, 'host_id' => 1, 'line_id' => 2, - 'network_selector' => 'bridge:restore-c', 'state' => 'active', - 'priority' => 0, 'verification_state' => 'verified', - 'verified_agent_revision' => 1, 'last_verified_at' => 1700000000, - 'sync_state' => 'never', 'observed_revision' => 0, - 'desired_revision' => 7, -]); -$capsule->table('cloud_public_ip_pools')->insert([ - 'id' => 3, 'host_id' => 1, 'network_attachment_id' => 3, - 'state' => 'active', 'sync_state' => 'applied', - 'observed_revision' => 1, 'desired_revision' => 1, 'priority' => 0, - 'guest_prefix_length' => 24, 'pool_key' => str_repeat('3', 32), - 'cidr' => '198.51.100.0/24', 'gateway' => '198.51.100.1', - 'dns_servers_json' => '["9.9.9.9"]', 'reserved_ips_json' => '[]', -]); -$capsule->table('cloud_public_ips')->insert([ - 'id' => 3, 'host_id' => 1, 'public_ip_pool_id' => 3, - 'address' => '198.51.100.20', 'prefix_length' => 24, - 'state' => 'available', 'reservation_id' => null, - 'instance_id' => null, 'operation_id' => null, - 'created_at' => 1700000000, 'updated_at' => 1700000000, -]); - -// The source VM consumes capacity on its current host. A same-host restore -// must still reserve a second, independent resource and IP allocation. -$capsule->table('cloud_instances')->insert([ - 'id' => 1, 'host_id' => 1, 'status' => 'active', - 'spec_json' => json_encode([ - 'vcpu' => 2, 'memory_mib' => 2048, 'disk_gib' => 20, - ], JSON_THROW_ON_ERROR), -]); - -$targets = CloudPlacementService::backupRestoreTargets(1, [ - 'cpu_cores' => 2, 'memory_mib' => 2048, 'disk_gib' => 20, -]); -$byIdentity = []; -foreach ($targets as $target) { - $byIdentity[(int) $target['id'] . ':' - . (int) $target['resource_pool_id']] = $target; -} - -$assert(isset($byIdentity['1:1']), - 'The original host was excluded from eligible manual restore targets.'); -$assert(($byIdentity['1:1']['is_source_host'] ?? null) === true, - 'The original host target was not explicitly identified.'); -$assert(isset($byIdentity['1:2']) - && ($byIdentity['1:2']['network_selectors'] ?? null) - === ['bridge:restore-c'], - 'A second exact host/pool restore identity was overwritten or lost.'); -$assert(isset($byIdentity['2:1']) - && ($byIdentity['2:1']['is_source_host'] ?? null) === false, - 'A different eligible host was lost or misidentified.'); -$assert((int) $byIdentity['1:1']['available_ip_count'] === 1, - 'The original host did not retain its independent IP capacity check.'); - -$capsule->table('cloud_host_network_attachments')->where('id', 3)->update([ - 'last_verified_at' => 0, -]); -$staleTargets = CloudPlacementService::backupRestoreTargets(1, [ - 'cpu_cores' => 2, 'memory_mib' => 2048, 'disk_gib' => 20, -]); -$assert(!in_array('2', array_map( - static fn (array $target): string => (string) $target['resource_pool_id'], - array_filter($staleTargets, static fn (array $target): bool => - (int) $target['id'] === 1) -), true), 'Stale attachment evidence remained eligible for restore.'); -$capsule->table('cloud_host_network_attachments')->where('id', 3)->update([ - 'last_verified_at' => 1700000000, -]); - -$restore = new CloudBackupRestore(); -$restore->target_host_id = 1; -$restore->reservation_id = null; -$restore->operation_id = str_repeat('a', 32); -$restore->save(); - -$placement = CloudPlacementService::reserveBackupRestore($restore, 77, [ - 'cpu_cores' => 2, 'memory_mib' => 2048, 'disk_gib' => 20, -], 1); -$reservation = $placement['reservation']; -$publicIp = $placement['public_ip']; -$assert($placement['network']['dns_servers'] === ['1.1.1.1', '8.8.8.8'], - 'A valid pool DNS list could not reach the restore placement payload.'); -$assert($placement['network']['network'] === 'bridge:restore-a' - && (int) $reservation->resource_pool_id === 1 - && (int) $reservation->network_attachment_id === 1, - 'Restore placement did not freeze the selected exact pool and attachment.'); -$assert((int) $reservation->backup_restore_id === (int) $restore->id - && (int) $reservation->public_ip_id === (int) $publicIp->id - && (string) $reservation->state === 'held' - && (string) $publicIp->state === 'reserved' - && (int) $publicIp->reservation_id === (int) $reservation->id, - 'Restore placement did not atomically reserve capacity and one public IP.'); - -// Maintenance migration consumes the exact pre-reserved network rather than -// scheduling another address after the source VM has already stopped. -$restore->reservation_id = (int) $reservation->id; -$restore->save(); -$reservation->instance_id = 99; -$reservation->save(); -$prepared = CloudPlacementService::preparedBackupRestorePlacement( - $restore->fresh(), - 99 -); -$assert($prepared['network']['dns_servers'] === ['1.1.1.1', '8.8.8.8'] - && $prepared['network']['network'] === 'bridge:restore-a' - && (int) $prepared['reservation']->id === (int) $reservation->id, - 'Maintenance migration did not preserve the pre-reserved pool DNS data.'); - -$capsule->table('cloud_public_ip_pools')->where('id', 1)->update([ - 'dns_servers_json' => '["not-an-ip"]', -]); -try { - CloudPlacementService::preparedBackupRestorePlacement( - $restore->fresh(), - 99 - ); - throw new RuntimeException('A malformed prepared DNS list was accepted.'); -} catch (CloudError $error) { - $assert($error->httpStatus === 409 - && $error->getMessage() === '公网地址池 DNS 配置损坏', - 'Malformed prepared DNS did not return the bounded placement error.'); -} - -$capsule->table('cloud_public_ip_pools')->where('id', 2)->update([ - 'dns_servers_json' => '["not-an-ip"]', -]); -$invalidRestore = new CloudBackupRestore(); -$invalidRestore->target_host_id = 2; -$invalidRestore->reservation_id = null; -$invalidRestore->operation_id = str_repeat('b', 32); -$invalidRestore->save(); -try { - CloudPlacementService::reserveBackupRestore($invalidRestore, 77, [ - 'cpu_cores' => 2, 'memory_mib' => 2048, 'disk_gib' => 20, - ], 1); - throw new RuntimeException('A malformed pool DNS list was accepted.'); -} catch (CloudError $error) { - $assert($error->httpStatus === 409 - && $error->getMessage() === '目标宿主机没有可分配的公网 IP', - 'Malformed pool DNS was not excluded from target allocation.'); -} -$assert($capsule->table('cloud_resource_reservations')->count() === 1 - && $capsule->table('cloud_public_ips')->where('host_id', 2) - ->value('state') === 'available', - 'Malformed pool DNS consumed restore capacity or a public IP.'); - -echo "Portable backup same-host restore target behavior passed.\n"; diff --git a/web/tests/CloudRuntimeHeartbeatTest.php b/web/tests/CloudRuntimeHeartbeatTest.php index b48f7ada..af4531de 100644 --- a/web/tests/CloudRuntimeHeartbeatTest.php +++ b/web/tests/CloudRuntimeHeartbeatTest.php @@ -261,6 +261,7 @@ try { 'vpc_batch_id', 'vpc_repair_root_job_id'] as $column) { $table->integer($column)->nullable(); } + $table->integer('public_network_transition_id')->nullable(); $table->integer('dispatch_attempts')->default(0); $table->integer('dispatch_deadline_at')->default(0); $table->boolean('effect_may_have_applied')->nullable(); @@ -290,6 +291,26 @@ try { $table->integer('applied_at')->nullable(); $table->unique(['host_id', 'operation_id']); }); + $schema->create('cloud_public_network_transitions', static function ( + Blueprint $table + ): void { + $table->increments('id'); + $table->string('state'); + $table->string('effect_resolution'); + $table->string('last_error_code')->default(''); + }); + $schema->create('cloud_backup_restore_attempts', static function ( + Blueprint $table + ): void { + $table->increments('id'); + $table->string('attempt_key')->unique(); + $table->integer('job_id')->nullable(); + $table->string('state'); + $table->string('effect_resolution')->default('not_applicable'); + $table->integer('active_attempt')->nullable(); + $table->string('last_error_code')->default(''); + $table->integer('updated_at')->default(0); + }); $schema->create('cloud_templates', static function ( Blueprint $table ): void { diff --git a/web/tests/VirtualizationAssetsTest.php b/web/tests/VirtualizationAssetsTest.php index 60e3a152..a8287db8 100644 --- a/web/tests/VirtualizationAssetsTest.php +++ b/web/tests/VirtualizationAssetsTest.php @@ -1072,7 +1072,8 @@ $assert(!str_contains($invoiceDetailRuntime, '/api/v1/jobs/') '/api/v1/invoices/${encodeURIComponent(invoice.id)}/status'), 'Invoice creation progress must not load the general job payload or a cloud session.'); $assert(str_contains($invoicePresentationSource, "\$invoice['deletion_at']") - && str_contains($invoicePresentationSource, "'label' => '最晚支付'") + && str_contains($invoicePresentationSource, + "self::timestampFact('最晚支付'") && str_contains($invoiceDetailRuntime, 'function invoiceCanPay(invoice)') && substr_count($invoiceDetailRuntime, 'if (!invoiceCanPay(invoice))') >= 2 && str_contains($invoiceDetailRuntime,