actor($request, $write)') && str_contains($controller, '$this->actor($request, true)'), 'Scheduling reads must allow administrators while writes stay super-admin only.'); $assert(str_contains($controller, "'resource_pool_id', 'scheduler_state'") && !str_contains(substr($controller, strpos($controller, 'public function hostScheduling'), strpos($controller, 'public function syncHostCapacity') - strpos($controller, 'public function hostScheduling')), 'public_ip'), 'The scheduling allowlist must not accept manual public IP fields.'); $hostLock = strpos($service, "CloudHost::where('id', \$hostId)->lockForUpdate()"); $policyLock = strpos($service, "CloudHostCapacityPolicy::where('host_id', \$hostId)"); $assert($hostLock !== false && $policyLock !== false && $hostLock < $policyLock && str_contains($service, '->lockForUpdate()->first();'), 'Scheduling writes must lock host before capacity policy.'); $assert(str_contains($service, "\$schedulerState === 'active'") && str_contains($service, 'CloudNetworkLineFeature::enabled()') && str_contains($service, "(string) \$pool->status !== 'active'") && str_contains($service, "(string) \$region->status !== 'active'") && str_contains($service, '$safety >= $configured'), 'Active scheduling must validate the host, pool hierarchy and safety reserves.'); $assert(str_contains($service, 'CloudHostInventorySyncService())->syncOne($hostId)') && str_contains($service, '可以保存配置,但调度器会拒绝放置实例'), 'Manual sync and non-blocking health/staleness warnings must remain explicit.'); $assert(str_contains($template, 'data-admin-host-scheduling-drawer') && str_contains($template, 'id="host-capacity-sync"') && str_contains($template, '{if $admin_can_manage|default:false}') && str_contains($template, '公网 IP 仅由宿主机盘点维护'), 'The host drawer must expose server-rendered write controls without IP editing.'); $assert(str_contains($script, 'window.VenixDrawerMotion.openDrawerWithMotion') && str_contains($script, 'window.VenixDrawerMotion.closeDrawerWithMotion') && str_contains($script, '/capacity-sync') && str_contains($script, '/scheduling'), 'The host drawer must reuse shared motion and scheduling endpoints.'); $assert(preg_match("/venix_asset_version value='([0-9]+)'/", $assets, $match) === 1 && (int) $match[1] >= 2026100308, 'Shared asset version must be bumped for admin.js changes.'); $assert(!file_exists($root . '/public/cloud/admin-host-scheduling.css'), 'Host scheduling must not introduce a standalone CSS file.'); echo "Administrator host scheduling contract checks passed.\n";