ktx/python/ktx-daemon/tests/test_telemetry_schema_sync.py
Kevin Messiaen cd9a6f5dc2
feat(telemetry): add mongo_query_completed event
Adds the strict mongo_query_completed schema (driver, isDemoConnection,
stageCount, durationMs, outcome, errorClass) for the upcoming
ktx mongo-query command, registered in both the catalog object and the
name/description/fields catalog list, and mirrors it to the Python
daemon schema copy.
2026-07-06 20:05:22 +07:00

41 lines
1.2 KiB
Python

from __future__ import annotations
import json
from pathlib import Path
def test_python_schema_copy_matches_node_schema() -> None:
repo_root = Path(__file__).resolve().parents[3]
node_schema = json.loads(
(repo_root / "packages/cli/src/telemetry/events.schema.json").read_text(
encoding="utf-8"
)
)
python_schema = json.loads(
(
repo_root / "python/ktx-daemon/src/ktx_daemon/telemetry/events.schema.json"
).read_text(encoding="utf-8")
)
assert python_schema == node_schema
assert [event["name"] for event in python_schema["x-ktx-catalog"]] == [
"install_first_run",
"command",
"setup_step",
"connection_added",
"connection_test",
"project_stack_snapshot",
"ingest_completed",
"scan_completed",
"sl_validate_completed",
"sl_query_completed",
"sql_completed",
"mongo_query_completed",
"wiki_query_completed",
"mcp_request_completed",
"daemon_started",
"daemon_stopped",
"sl_plan_completed",
"sql_gen_completed",
"query_history_filter_completed",
]