$repository, 'model' => $model, 'claim' => $claim, 'exception' => $exception, 'schema' => $schema] as $name => $source) { $assert(is_string($source) && $source !== '', 'Missing Agent operation ' . $name . ' source.'); } $assert(str_contains($model, "cloud_agent_operations") && str_contains($model, "desired_json") && str_contains($model, "lease_owner"), 'CloudAgentOperation model lost the fresh journal mapping.'); $assert(str_contains($repository, "private const TABLE = 'cloud_agent_operations'") && str_contains($repository, "function reserve") && str_contains($repository, "function claim") && str_contains($repository, "function finalize") && str_contains($repository, "function setCommitBoundary") && str_contains($repository, "function renew") && str_contains($repository, "function markUncertain") && str_contains($repository, "function get"), 'Agent operation repository is missing a required state transition.'); foreach ([ "->where('version'", "->where('status'", "->where('lease_owner'", "->where('lease_expires_at'", "'attempt_count' =>", "'version' =>", "lockForUpdate()", 'if ((int) $updated !== 1)', "lease_lost", "lease_expired", "不确定操作禁止重新派发", ] as $required) { $assert(str_contains($repository, $required), 'Agent repository lost CAS/lease guard: ' . $required); } $assert(str_contains($claim, 'must not be serialized') && str_contains($claim, '__unserialize') && str_contains($claim, 'dispatch\' && $this->status === \'running') && str_contains($claim, 'reconcile\' && $this->status === \'uncertain'), 'Agent operation claim can cross a queue serialization boundary.'); $assert(str_contains($exception, 'public readonly string $errorCode') && !str_contains($exception, 'public readonly string $code'), 'Agent operation exception must not redeclare Exception::$code.'); $assert(str_contains($repository, 'array_is_list($input[\'desired\'])') && str_contains($repository, 'validJsonKey') && str_contains($repository, 'isDigestValue') && str_contains($repository, "\$trimmed[0] !== '{'") && str_contains($repository, 'array_is_list($decoded)') && str_contains($repository, 'array_is_list($result) || $result === []') && str_contains($repository, 'if ($value === null)') && str_contains($repository, "Agent 操作 JSON 内容已损坏") && !str_contains($repository, "if (!is_string(\$value) || \$value === '') {\n return [];") && str_contains($repository, '成功操作必须有宿主 commit boundary'), 'Agent operation desired/result JSON needs an object and key-shape boundary.'); $assert(str_contains($schema, 'version BIGINT UNSIGNED NOT NULL DEFAULT 1') && str_contains($schema, 'attempt_count INT UNSIGNED') && str_contains($schema, 'lease_owner VARCHAR(96)') && str_contains($schema, 'lease_expires_at BIGINT UNSIGNED'), 'Fresh schema lacks operation CAS/lease columns.'); foreach (['CloudJob', 'CloudEngineClient', 'ssh', 'curl_exec', 'shell_exec', 'CloudSecrets'] as $forbidden) { $assert(!str_contains($repository, $forbidden), 'Fresh Agent repository crossed a legacy/transport boundary: ' . $forbidden); } echo "Cloud Agent operation repository contract checks passed.\n";