Add deterministic client integration diagnostics
This commit is contained in:
parent
eb9355b003
commit
fb0df5e4a1
15 changed files with 6193 additions and 18 deletions
466
schemas/doctor-result.schema.json
Normal file
466
schemas/doctor-result.schema.json
Normal file
|
|
@ -0,0 +1,466 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://docforge.local/schema/doctor-result-v1.json",
|
||||
"title": "DocForge bounded read-only integration doctor result",
|
||||
"$defs": {
|
||||
"diagnostics": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"schema_version",
|
||||
"operation",
|
||||
"outcome",
|
||||
"elapsed_ns",
|
||||
"stages",
|
||||
"counters"
|
||||
],
|
||||
"properties": {
|
||||
"schema_version": { "const": 1 },
|
||||
"operation": { "const": "cli.doctor" },
|
||||
"outcome": { "const": "ok" },
|
||||
"elapsed_ns": { "type": "integer", "minimum": 0 },
|
||||
"stages": {
|
||||
"type": "object",
|
||||
"maxProperties": 14,
|
||||
"propertyNames": {
|
||||
"enum": [
|
||||
"source.generation",
|
||||
"source.parse",
|
||||
"adapter.projection",
|
||||
"adapter.extract",
|
||||
"index.check",
|
||||
"index.synchronize",
|
||||
"index.build",
|
||||
"index.read",
|
||||
"render.status",
|
||||
"render.prepare",
|
||||
"render.output_hash",
|
||||
"visualization.status",
|
||||
"viewer.manager",
|
||||
"mcp.runtime_validation"
|
||||
]
|
||||
},
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"required": ["calls", "elapsed_ns"],
|
||||
"properties": {
|
||||
"calls": { "type": "integer", "minimum": 1 },
|
||||
"elapsed_ns": { "type": "integer", "minimum": 0 }
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"counters": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"project_loads",
|
||||
"source_files_parsed",
|
||||
"source_bytes_parsed",
|
||||
"adapter_projection_loads",
|
||||
"adapter_source_extractions",
|
||||
"source_generation_checks",
|
||||
"index_checks",
|
||||
"index_synchronizations",
|
||||
"index_builds",
|
||||
"render_prepare_calls",
|
||||
"render_output_bytes_built",
|
||||
"render_output_bytes_hashed",
|
||||
"viewer_manager_requests"
|
||||
],
|
||||
"additionalProperties": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"maxProperties": 13
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"required": [
|
||||
"status",
|
||||
"schema_version",
|
||||
"doctor_state",
|
||||
"client",
|
||||
"project",
|
||||
"config",
|
||||
"summary",
|
||||
"guarantees",
|
||||
"checks"
|
||||
],
|
||||
"properties": {
|
||||
"status": { "const": "ok" },
|
||||
"schema_version": { "const": 1 },
|
||||
"doctor_state": { "enum": ["healthy", "degraded", "unhealthy"] },
|
||||
"client": { "enum": ["codex", "claude", "openclaw"] },
|
||||
"project": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"project_id",
|
||||
"project_root",
|
||||
"project_root_fingerprint",
|
||||
"adapter"
|
||||
],
|
||||
"properties": {
|
||||
"project_id": { "type": "string", "minLength": 1, "maxLength": 128 },
|
||||
"project_root": { "type": "string", "minLength": 1, "maxLength": 4096 },
|
||||
"project_root_fingerprint": {
|
||||
"type": "string",
|
||||
"pattern": "^[0-9a-f]{16}$"
|
||||
},
|
||||
"adapter": { "type": "string", "minLength": 1, "maxLength": 256 }
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"config": {
|
||||
"type": "object",
|
||||
"required": ["path", "server_name"],
|
||||
"properties": {
|
||||
"path": { "type": "string", "minLength": 1, "maxLength": 4096 },
|
||||
"server_name": {
|
||||
"type": ["string", "null"],
|
||||
"maxLength": 256
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"summary": {
|
||||
"type": "object",
|
||||
"required": ["passed", "warning", "failed", "skipped"],
|
||||
"properties": {
|
||||
"passed": { "type": "integer", "minimum": 0, "maximum": 14 },
|
||||
"warning": { "type": "integer", "minimum": 0, "maximum": 14 },
|
||||
"failed": { "type": "integer", "minimum": 0, "maximum": 14 },
|
||||
"skipped": { "type": "integer", "minimum": 0, "maximum": 14 }
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"guarantees": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"read_only",
|
||||
"project_loads",
|
||||
"adapter_projection_loads",
|
||||
"adapter_source_extractions",
|
||||
"sqlite_opens",
|
||||
"index_checks",
|
||||
"index_synchronizations",
|
||||
"index_builds",
|
||||
"renders",
|
||||
"viewer_operations",
|
||||
"client_config_writes",
|
||||
"configured_command_executions"
|
||||
],
|
||||
"properties": {
|
||||
"read_only": { "const": true },
|
||||
"project_loads": { "const": 0 },
|
||||
"adapter_projection_loads": { "const": 0 },
|
||||
"adapter_source_extractions": { "const": 0 },
|
||||
"sqlite_opens": { "const": 0 },
|
||||
"index_checks": { "const": 0 },
|
||||
"index_synchronizations": { "const": 0 },
|
||||
"index_builds": { "const": 0 },
|
||||
"renders": { "const": 0 },
|
||||
"viewer_operations": { "const": 0 },
|
||||
"client_config_writes": { "const": 0 },
|
||||
"configured_command_executions": { "const": 0 }
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"checks": {
|
||||
"type": "array",
|
||||
"minItems": 14,
|
||||
"maxItems": 14,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": ["check_id", "state", "code", "message", "details"],
|
||||
"properties": {
|
||||
"check_id": {
|
||||
"enum": [
|
||||
"project.binding",
|
||||
"project.canonical_validation",
|
||||
"client.driver",
|
||||
"client.config",
|
||||
"client.entry",
|
||||
"server.executable",
|
||||
"server.arguments",
|
||||
"server.project_binding",
|
||||
"policy.effective",
|
||||
"policy.no_ast",
|
||||
"client.timeouts",
|
||||
"client.environment",
|
||||
"client.tool_filter",
|
||||
"derived.index"
|
||||
]
|
||||
},
|
||||
"state": {
|
||||
"enum": ["passed", "warning", "failed", "skipped"]
|
||||
},
|
||||
"code": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 128
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 512
|
||||
},
|
||||
"details": {
|
||||
"type": "object",
|
||||
"maxProperties": 16,
|
||||
"propertyNames": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 128
|
||||
},
|
||||
"additionalProperties": {
|
||||
"oneOf": [
|
||||
{ "type": "string", "maxLength": 512 },
|
||||
{ "type": "integer" },
|
||||
{ "type": "boolean" },
|
||||
{ "type": "null" },
|
||||
{
|
||||
"type": "array",
|
||||
"maxItems": 16,
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{ "type": "string", "maxLength": 256 },
|
||||
{ "type": "integer" },
|
||||
{ "type": "boolean" },
|
||||
{ "type": "null" }
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"diagnostics": { "$ref": "#/$defs/diagnostics" }
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"properties": {
|
||||
"checks": {
|
||||
"contains": {
|
||||
"properties": { "check_id": { "const": "project.binding" } },
|
||||
"required": ["check_id"]
|
||||
},
|
||||
"minContains": 1,
|
||||
"maxContains": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"checks": {
|
||||
"contains": {
|
||||
"properties": {
|
||||
"check_id": { "const": "project.canonical_validation" }
|
||||
},
|
||||
"required": ["check_id"]
|
||||
},
|
||||
"minContains": 1,
|
||||
"maxContains": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"checks": {
|
||||
"contains": {
|
||||
"properties": { "check_id": { "const": "client.driver" } },
|
||||
"required": ["check_id"]
|
||||
},
|
||||
"minContains": 1,
|
||||
"maxContains": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"checks": {
|
||||
"contains": {
|
||||
"properties": { "check_id": { "const": "client.config" } },
|
||||
"required": ["check_id"]
|
||||
},
|
||||
"minContains": 1,
|
||||
"maxContains": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"checks": {
|
||||
"contains": {
|
||||
"properties": { "check_id": { "const": "client.entry" } },
|
||||
"required": ["check_id"]
|
||||
},
|
||||
"minContains": 1,
|
||||
"maxContains": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"checks": {
|
||||
"contains": {
|
||||
"properties": { "check_id": { "const": "server.executable" } },
|
||||
"required": ["check_id"]
|
||||
},
|
||||
"minContains": 1,
|
||||
"maxContains": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"checks": {
|
||||
"contains": {
|
||||
"properties": { "check_id": { "const": "server.arguments" } },
|
||||
"required": ["check_id"]
|
||||
},
|
||||
"minContains": 1,
|
||||
"maxContains": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"checks": {
|
||||
"contains": {
|
||||
"properties": {
|
||||
"check_id": { "const": "server.project_binding" }
|
||||
},
|
||||
"required": ["check_id"]
|
||||
},
|
||||
"minContains": 1,
|
||||
"maxContains": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"checks": {
|
||||
"contains": {
|
||||
"properties": { "check_id": { "const": "policy.effective" } },
|
||||
"required": ["check_id"]
|
||||
},
|
||||
"minContains": 1,
|
||||
"maxContains": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"checks": {
|
||||
"contains": {
|
||||
"properties": { "check_id": { "const": "policy.no_ast" } },
|
||||
"required": ["check_id"]
|
||||
},
|
||||
"minContains": 1,
|
||||
"maxContains": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"checks": {
|
||||
"contains": {
|
||||
"properties": { "check_id": { "const": "client.timeouts" } },
|
||||
"required": ["check_id"]
|
||||
},
|
||||
"minContains": 1,
|
||||
"maxContains": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"checks": {
|
||||
"contains": {
|
||||
"properties": { "check_id": { "const": "client.environment" } },
|
||||
"required": ["check_id"]
|
||||
},
|
||||
"minContains": 1,
|
||||
"maxContains": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"checks": {
|
||||
"contains": {
|
||||
"properties": { "check_id": { "const": "client.tool_filter" } },
|
||||
"required": ["check_id"]
|
||||
},
|
||||
"minContains": 1,
|
||||
"maxContains": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"checks": {
|
||||
"contains": {
|
||||
"properties": { "check_id": { "const": "derived.index" } },
|
||||
"required": ["check_id"]
|
||||
},
|
||||
"minContains": 1,
|
||||
"maxContains": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": { "doctor_state": { "const": "healthy" } },
|
||||
"required": ["doctor_state"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"summary": {
|
||||
"properties": {
|
||||
"warning": { "const": 0 },
|
||||
"failed": { "const": 0 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": { "doctor_state": { "const": "degraded" } },
|
||||
"required": ["doctor_state"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"summary": {
|
||||
"properties": {
|
||||
"warning": { "minimum": 1 },
|
||||
"failed": { "const": 0 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": { "doctor_state": { "const": "unhealthy" } },
|
||||
"required": ["doctor_state"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"summary": {
|
||||
"properties": {
|
||||
"failed": { "minimum": 1 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue