get('/fabric', 'App\\Controllers\\Admin\\CloudPageController:fabric')")
&& str_contains($header, 'href="/admin/fabric"')
&& str_contains($header, '地区私网')
&& str_contains($page, "fetch('admin/cloud/fabric.tpl')"),
'Fabric administrator page route, navigation or renderer is missing.');
foreach (['probe', 'apply', 'reconcile'] as $operation) {
$assert(str_contains(
$cloudRoutes,
"/admin/fabric/regions/{region_id:[0-9]+}/{$operation}"
), 'Region Fabric route is missing: ' . $operation);
}
$assert(str_contains($cloudRoutes, "\$this->get('/admin/fabric'")
&& strpos($cloudRoutes, "/admin/fabric/regions/{region_id:[0-9]+}/apply")
< strpos($cloudRoutes, "\$this->get('/admin/fabric/{fabric_id:"),
'Region workflows must be registered before the dynamic Fabric detail route.');
$assert(!str_contains($cloudRoutes, "'/admin/fabric/apply'")
&& !str_contains($controller, 'public function apply(')
&& !str_contains($cloudRoutes,
'/admin/fabric/{fabric_id:[A-Za-z0-9][A-Za-z0-9_.-]{0,63}}/reconcile')
&& !str_contains($controller, 'public function reconcile('),
'Retired generic raw-plan/reconcile administrator endpoints remain reachable.');
$assert(str_contains($cloudRoutes,
"\$this->get('/admin/regions/{id:[0-9]+}/fabric'")
&& !str_contains($cloudRoutes,
"\$this->map(['GET', 'PUT', 'PATCH'], '/admin/regions/{id:[0-9]+}/fabric'")
&& !str_contains($cloudRoutes,
"\$this->post('/admin/regions/{id:[0-9]+}/fabric'")
&& !str_contains($cloudRoutes,
"\$this->put('/admin/regions/{id:[0-9]+}/fabric'")
&& !str_contains($cloudRoutes,
"\$this->patch('/admin/regions/{id:[0-9]+}/fabric'"),
'Region Fabric mapping must be read-only outside the region wizard.');
$regionFabricController = $section($resourceController,
'public function regionFabric(', 'public function networkLines(');
$assert(!str_contains($regionFabricController, 'getMethod')
&& !str_contains($regionFabricController, 'CloudInput')
&& !str_contains($regionFabricController, 'saveRegionFabric'),
'The resource controller retained a manual region mapping write path.');
$assert(str_contains($middleware, "/api/v1/admin/fabric(?:/|$)")
&& str_contains($client, 'function fabricStatuses')
&& str_contains($client, 'function fabricProbe')
&& str_contains($client, 'function fabricApply')
&& str_contains($client, 'function fabricReconcile')
&& str_contains($client, 'safeFabricErrorMessage')
&& str_contains($client,
"'fabric_probe_busy' => '已有地区宿主机检测正在运行,请稍后重试'"),
'Region Fabric actions must use the protected PHP boundary and bounded engine client.');
$assert(str_contains($controller, 'CloudAccess::manage')
&& str_contains($controller, "['is_super_admin']")
&& str_contains($controller, 'assertEmptyBody')
&& str_contains($controller, 'probeRegion')
&& str_contains($controller, 'applyRegion')
&& str_contains($controller, 'reconcileRegion'),
'Region Fabric actions lost the super-admin or empty-body boundary.');
$assert(str_contains($service, "'regions' => self::readinessRegions")
&& str_contains($service, 'function probeRegion')
&& str_contains($service, 'function applyRegion')
&& str_contains($service, 'function reconcileRegion')
&& str_contains($service, 'assertConfigurableProbes')
&& str_contains($service, 'automaticFabricId')
&& str_contains($service, 'automaticOverlay')
&& str_contains($service, 'automaticNodes')
&& str_contains($service, 'CloudAdminResourceService::saveRegionFabric')
&& str_contains($service, "'ready_host_count'")
&& str_contains($service, "'blocked_host_count'")
&& str_contains($service, "'network_manager_expected'")
&& str_contains($service, "'fabric_member'"),
'Fabric service must own automatic plans and project region/host readiness.');
$assert(!str_contains($service, 'public static function apply(')
&& !str_contains($service, 'public static function reconcile(')
&& str_contains($service, 'public static function applyRegion(')
&& str_contains($service, 'public static function reconcileRegion(')
&& str_contains($client, 'function fabricApply')
&& str_contains($client, 'function fabricReconcile'),
'Generic PHP plan writes survived or the region-owned engine boundary was removed.');
$listingProjection = $section($service,
'public static function listing(', 'public static function detail(');
$detailProjection = $section($service,
'public static function detail(', 'public static function probeRegion(');
$regionProjection = $section($service,
'private static function readinessRegions(',
'private static function workflowProjection(');
$assert(!str_contains($listingProjection, "'fabrics' =>")
&& !str_contains($regionProjection, "'fabric' =>")
&& str_contains($detailProjection, "'fabric' =>"),
'List workflows exposed raw plans or the explicit detail readback disappeared.');
$workflowProjection = $section($service,
'private static function workflowProjection(',
'private static function probeRows(');
foreach (['stage', 'can_probe', 'can_apply', 'can_reconcile',
'blocking_reasons', 'action_mode'] as $key) {
$assert(str_contains($workflowProjection, "'{$key}' =>"),
'Workflow projection key is missing: ' . $key);
}
foreach (['engine_unavailable', 'no_hosts', 'needs_probe', 'blocked',
'ready_to_apply', 'needs_reconcile', 'active', 'migration_required',
'recovery_required'] as $stage) {
$assert(str_contains($workflowProjection, "'{$stage}'"),
'Workflow projection stage is missing: ' . $stage);
}
foreach (['vpc_fabric_pin_mismatch', 'vpc_fabric_mapping_missing'] as $reason) {
$assert(str_contains($workflowProjection, "'{$reason}'")
&& str_contains($script, $reason . ':'),
'VPC Fabric migration reason is missing from service/UI: ' . $reason);
}
foreach ([
'fabric_endpoint_interface_unverified',
'fabric_endpoint_interface_unsafe_or_drifted',
'fabric_endpoint_rp_filter_unverified',
] as $reason) {
$assert(str_contains($script, $reason . ':'),
'Fabric endpoint readiness reason is missing from the UI: ' . $reason);
}
foreach (['mode', 'fabric_id', 'fabric_region', 'revision', 'listen_port',
'overlay_cidr', 'host_count'] as $key) {
$assert(str_contains($workflowProjection, "'{$key}' =>"),
'Plan preview key is missing: ' . $key);
}
$assert(!str_contains($workflowProjection, "'nodes' =>")
&& !str_contains($workflowProjection, "'endpoints' =>")
&& !str_contains($workflowProjection, "'host_ids' =>"),
'Plan preview exposes raw node, endpoint or host-id arrays.');
$assert(!str_contains($service, "'private_key'")
&& !str_contains($service, "'ssh_command'")
&& !str_contains($service, "'raw_output'"),
'Fabric admin projection must not accept or expose private credentials or raw commands.');
$assert(str_contains($script,
"iproute2_missing: '缺少 ip 命令(Debian 包 iproute2 / AlmaLinux 包 iproute)'")
&& str_contains($script,
"iproute2_probe_failed: 'ip 命令 JSON 能力回读无效'"),
'Host readiness must distinguish the ip command from distribution package names.');
$rpFilterFields = [
'rp_filter_all', 'rp_filter_default', 'rp_filter_default_effective',
'rp_filter_underlay_raw', 'rp_filter_underlay_effective',
'rp_filter_fabric_raw', 'rp_filter_fabric_effective',
];
foreach ($rpFilterFields as $field) {
$assert(str_contains($service, "'{$field}'")
&& str_contains($script, $field),
'The Fabric readiness projection dropped rp_filter evidence: ' . $field);
}
$assert(str_contains($script, 'function rpFilterLines(capabilities)')
&& str_contains($script,
"rp_filter_not_compatible: 'rp_filter 必要回读缺失或无效,无法安全自动配置'")
&& str_contains($script, "'rp_filter all:'")
&& str_contains($script, "'rp_filter default:'")
&& str_contains($script, "'Endpoint '")
&& str_contains($script, "'wg-fabric0:'")
&& str_contains($script,
"'策略:all/default/公网接口只读;仅平台自有 wg-fabric0 与 VPC bridge 设为 2'")
&& str_contains($script, "'(strict,自动配置将收敛为 2)'")
&& !str_contains($script, "'rp_filter:' + sysctl(capabilities.rp_filter)"),
'The administrator page still hides the interface-specific rp_filter decision.');
preg_match_all('/