mirror of
https://github.com/Kaelio/ktx.git
synced 2026-07-04 10:52:13 +02:00
fix(telemetry): classify daemon query rejections as expected, not faults (#335)
* fix(telemetry): classify daemon query rejections as expected, not faults Semantic-layer query rejections and warehouse-execution rejections from the sl_query MCP tool were wrapped as generic Errors, so reportException filed them as PostHog $exception faults indistinguishable from real ktx bugs. The daemon already separates a caller rejection (planner ValueError -> exit 3 / HTTP 400) from a crash. The Node runner now carries that distinction as a typed KtxDaemonComputeError, and a shared throwClassifiedQueryError promotes daemon input-rejections and warehouse rejections to KtxQueryError while daemon crashes and native JS faults still reach Error Tracking. query_semantic_layer stops report_exception-ing expected ValueErrors, and a missing 'file:' secret now raises KtxExpectedError so absent .ktx/secrets/<conn>-password stops filing faults. * chore: sync uv.lock to ktx-daemon/ktx-sl 0.15.0
This commit is contained in:
parent
a651b82e2f
commit
5d17469601
10 changed files with 347 additions and 28 deletions
|
|
@ -91,6 +91,22 @@ def test_command_returns_nonzero_for_invalid_json() -> None:
|
|||
assert "Expecting property name enclosed in double quotes" in result.stderr
|
||||
|
||||
|
||||
def test_semantic_query_rejects_invalid_query_with_input_rejected_code() -> None:
|
||||
# A planner ValueError (agent's measure references no source) is an expected
|
||||
# input rejection, distinguished from a fault by INPUT_REJECTED_EXIT_CODE (3).
|
||||
result = run_daemon_command(
|
||||
"semantic-query",
|
||||
{
|
||||
"sources": [ORDERS_SOURCE],
|
||||
"dialect": "postgres",
|
||||
"query": {"measures": ["count(*)"], "dimensions": []},
|
||||
},
|
||||
)
|
||||
|
||||
assert result.returncode == 3, result.stderr
|
||||
assert "does not reference any source" in result.stderr
|
||||
|
||||
|
||||
def test_serve_http_command_starts_uvicorn_without_reading_stdin(
|
||||
monkeypatch,
|
||||
) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue