actor($request, $write)') && str_contains($controller, '$this->actor($request, true)'), 'Scheduling reads and writes lost their database-only authorization boundary.'); $hostSchedulingStart = strpos($controller, 'public function hostScheduling'); $hostSchedulingEnd = strpos($controller, 'public function hostStorageConfiguration', $hostSchedulingStart); $hostScheduling = $hostSchedulingStart === false || $hostSchedulingEnd === false ? '' : substr( $controller, $hostSchedulingStart, $hostSchedulingEnd - $hostSchedulingStart ); $assert(str_contains($controller, 'CloudAdminHostSchedulingService::saveCapacity') && str_contains($controller, 'CloudAdminHostSchedulingService::saveMembership') && str_contains($controller, 'CloudAdminHostSchedulingService::deleteMembership') && str_contains($controller, "'expected_revision'") && $hostScheduling !== '' && !str_contains($hostScheduling, 'public_ip'), 'Controller dispatch does not keep capacity and membership mutations separate.'); $assert(str_contains($projectionService, 'CloudHostPoolMembershipService::primary(') && !str_contains($projectionService, '$host->resource_pool_id') && !str_contains($projectionService, '$host->scheduler_state'), 'Host projection must derive compact placement from membership authority.'); $assert(str_contains($service, 'public static function saveCapacity(') && str_contains($service, 'public static function saveMembership(') && str_contains($service, 'public static function deleteMembership(') && str_contains($service, 'CloudHostPoolMembershipService::upsertLocked(') && str_contains($service, 'CloudHostPoolMembershipService::removeLocked(') && str_contains($service, '同一宿主机的启用或排空资源池成员必须属于同一地区') && str_contains($service, '该资源池成员仍有实例或资源预留,不能停用或删除'), 'Scheduling service lost independent multi-membership CAS behavior.'); $assert(str_contains($membershipService, 'public static function activeRows(') && str_contains($membershipService, 'public static function primary(') && str_contains($membershipService, 'public static function upsertLocked(') && str_contains($membershipService, 'public static function removeLocked(') && str_contains($membershipService, 'expectedRevision') && !str_contains($membershipService, '$host->resource_pool_id'), 'Membership authority does not expose independent revisioned rows.'); $assert(!str_contains($service, 'CloudHostInventorySyncService') && !str_contains($service, 'syncOne(') && str_contains($service, 'CloudPanelUsageService::forHost(') && str_contains($service, 'CloudAdminPublicNetworkCapacityProjection::forHosts(') && !str_contains($service, 'hostUsage(') && str_contains($capacityProjection, 'network_attachment.line_id') && str_contains($capacityProjection, '$attachmentState[$hostId][$lineId][$attachmentId]'), 'Scheduling capacity or IP ownership regressed to host inventory/default-network coupling.'); $assert(str_contains($template, 'data-admin-host-scheduling-drawer') && str_contains($template, 'id="host-membership-create-form"') && str_contains($template, 'id="host-membership-pool"') && str_contains($template, 'id="host-membership-list"') && str_contains($template, 'id="host-scheduling-form"') && str_contains($template, 'id="host-panel-capacity"') && str_contains($template, '保存全局容量') && !str_contains($template, 'id="host-resource-pool"') && !str_contains($template, 'id="host-scheduler-state"') && !str_contains($template, 'host-capacity-sync'), 'Host drawer did not replace its single placement selector with membership rows.'); $capacityBodyStart = strpos($script, 'function schedulingBody()'); $capacityBodyEnd = strpos($script, 'function syncCachedHostScheduling', $capacityBodyStart); $capacityBody = $capacityBodyStart === false || $capacityBodyEnd === false ? '' : substr($script, $capacityBodyStart, $capacityBodyEnd - $capacityBodyStart); $assert($capacityBody !== '' && str_contains($capacityBody, 'configured_cpu_cores') && str_contains($capacityBody, 'max_instances') && !str_contains($capacityBody, 'resource_pool_id') && !str_contains($capacityBody, 'scheduler_state'), 'Global capacity PUT still contains a membership mutation.'); $assert(str_contains($script, 'function renderHostMemberships(') && str_contains($script, 'dataset.hostMembershipForm') && str_contains($script, 'item?.region_name') && str_contains($script, 'item?.line_name') && str_contains($script, 'item?.pool_name') && str_contains($script, 'item.priority') && str_contains($script, 'item.weight') && str_contains($script, 'item.revision') && str_contains($script, '/scheduling/memberships/${encodeURIComponent(poolId)}') && str_contains($script, "method: 'PUT'") && str_contains($script, "method: 'DELETE'") && str_contains($script, 'expected_revision: 0') && str_contains($script, 'VenixAdminDangerDialog.confirm') && str_contains($script, 'window.VenixDrawerMotion.openDrawerWithMotion') && str_contains($script, 'window.VenixDrawerMotion.closeDrawerWithMotion') && !str_contains($script, '/capacity-sync'), 'Membership rendering or independent PUT/DELETE behavior is incomplete.'); $assert(preg_match("/venix_asset_version value='([0-9]+)'/", $assets, $match) === 1 && (int) $match[1] >= 2026110204, 'Shared asset version was not bumped for the scheduling UI change.'); $assert(file_exists($root . '/tests/AdminHostSchedulingBehaviorTest.mjs') && !file_exists($root . '/public/cloud/admin-host-scheduling.css'), 'Scheduling UI must retain shared styling and have a DOM behavior test.'); echo "Administrator host multi-membership scheduling contracts passed.\n";