mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-19 08:28:06 +02:00
fix(cli): make connection-not-configured errors actionable and expected (#301)
The MCP sql_execution/sl_query tools and the `ktx sql` CLI threw a plain Error naming no valid connection ids when an agent passed an unconfigured connectionId (or omitted it with multiple connections). The message reached the agent verbatim but gave it nothing to correct with, so it re-guessed for days, and each correct caller-driven rejection filed in PostHog Error Tracking as a ktx fault (issue 019eb10c, 8 occurrences on one install). Add a shared resolver (resolveConfiguredConnection / resolveRequiredConnectionId) that throws KtxExpectedError listing the configured connections, and route the three SQL-execution call sites through it. Expected-error classification keeps these out of Error Tracking while the actionable message lets agents self-correct.
This commit is contained in:
parent
9587049283
commit
8a50601582
8 changed files with 189 additions and 20 deletions
|
|
@ -306,7 +306,9 @@ describe('runKtxSql', () => {
|
|||
),
|
||||
).resolves.toBe(1);
|
||||
|
||||
expect(io.stderr()).toContain('Connection "warehouse" is not configured in ktx.yaml');
|
||||
expect(io.stderr()).toContain(
|
||||
'Connection "warehouse" is not configured in ktx.yaml. No connections are configured in ktx.yaml.',
|
||||
);
|
||||
});
|
||||
|
||||
it('rejects connectors without read-only SQL support and still cleans up', async () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue