|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
// Source contract for the first page-facing read cutover. The repository's
|
|
|
|
|
// full integration test requires Laravel/Guzzle and is run in the panel CI;
|
|
|
|
|
// this dependency-free check guards the transport and legacy boundaries in
|
|
|
|
|
// the lightweight audit environment.
|
|
|
|
|
$root = dirname(__DIR__);
|
|
|
|
|
$service = file_get_contents($root . '/app/Services/Cloud/CloudAgentObservationService.php');
|
|
|
|
|
$client = file_get_contents($root . '/app/Services/Cloud/CloudAgentClient.php');
|
|
|
|
|
$handle = file_get_contents($root . '/app/Services/Cloud/CloudAgentHandle.php');
|
|
|
|
|
$repository = file_get_contents($root . '/app/Services/Cloud/CloudAgentOperationRepository.php');
|
|
|
|
|
|
|
|
|
|
$assert = static function (bool $condition, string $message): void {
|
|
|
|
|
if (!$condition) {
|
|
|
|
|
throw new RuntimeException($message);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$assert(is_string($service)
|
|
|
|
|
&& str_contains($service, "'domain_observe'")
|
|
|
|
|
&& str_contains($service, 'resolveReadOnly')
|
|
|
|
|
&& str_contains($service, 'markUncertain')
|
|
|
|
|
&& str_contains($service, 'CloudAgentOperationEnvelope::fromResponse')
|
|
|
|
|
&& str_contains($service, 'public function observeMany(')
|
|
|
|
|
&& str_contains($service, 'CloudInstanceMetadata::state')
|
|
|
|
|
&& str_contains($service, 'isReducedFailure')
|
|
|
|
|
&& str_contains($service, 'isDefinitiveReducedRejection')
|
|
|
|
|
&& str_contains($service, 'agent_observation_transport_uncertain')
|
|
|
|
|
&& str_contains($service, '重试必须同时提供 operation_id 和幂等键')
|
|
|
|
|
&& !str_contains($service, 'idempotencyKeyForOperationId')
|
|
|
|
|
&& !str_contains($service, 'CloudEngineClient')
|
|
|
|
|
&& !str_contains($service, 'ssh'),
|
|
|
|
|
'Observation service crossed the legacy Python/SSH boundary or lost its journal gate.');
|
|
|
|
|
$assert(is_string($client) && str_contains($client, "'domain_observe'"),
|
|
|
|
|
'Agent transport does not allow the domain observation kind.');
|
|
|
|
|
$assert(is_string($handle)
|
|
|
|
|
&& str_contains($handle, "['domain_read', 'domain_observe']"),
|
|
|
|
|
'Read-only Agent handles do not allow the observation kind.');
|
|
|
|
|
$assert(is_string($repository) && str_contains($repository, "'domain_observe'"),
|
|
|
|
|
'Panel operation repository does not recognize observation records.');
|
|
|
|
|
|
|
|
|
|
fwrite(STDOUT, "Cloud Agent observation service contract passed.\n");
|