reconcile(', "'reconcile'", 'CloudAgentOperationRepository', '->finalize(', 'agent_reconcile_result_invalid', 'hash_equals', 'resolveReadOnly', "->where('host_id'", "->where('id'", 'instance_uuid', "record['target']", ] as $required) { $assert(str_contains($service, $required), 'Reconcile service is missing a required safety boundary: ' . $required); } foreach ([ 'CloudEngineClient', 'CloudJobService', 'CloudWorkerService', 'shell_exec', 'curl_exec', 'CloudAgentVmGateway', '->operation(', ] as $forbidden) { $assert(!str_contains($service, $forbidden), 'Reconcile service crossed a legacy or mutation boundary: ' . $forbidden); } $uuid = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'; $assert(str_contains($routes, "/jobs/{id:{$uuid}}/reconcile") && str_contains($routes, 'CloudApiController:reconcileJob'), 'The explicit UUID reconcile route is missing.'); $assert(str_contains($middleware, '/api/v1/jobs/[0-9a-f]{8}-[0-9a-f]{4}') && str_contains($middleware, '/reconcile$'), 'The reconcile route is not classified as database-only by CloudApi middleware.'); $methodOffset = strpos($controller, 'public function reconcileJob('); $assert($methodOffset !== false, 'CloudApiController has no reconcileJob endpoint.'); $method = substr($controller, $methodOffset); $assert(str_contains($method, 'CloudAgentOperationIdentity::validateUuid') && str_contains($method, 'CloudAgentOperationReconcileService') && str_contains($method, 'CloudAgentOperationStatusService::forActor') && str_contains($method, "=== 'uncertain' ? 202 : 200"), 'reconcileJob does not validate, authorize through the service, and project the safe status DTO.'); $assert(str_contains($handle, 'public function reconcile(') && str_contains($handle, 'typed read-back endpoint') && !str_contains($handle, "if (\$this->readOnly) {\n throw new CloudError('降级宿主机 Agent 仅允许只读观察', 503);\n }\n return \$this->client->reconcile"), 'A degraded read-only Agent handle must keep the non-replaying reconcile endpoint available.'); fwrite(STDOUT, "Cloud Agent operation reconcile contract passed.\n");