Various CLI improvements and fixes (and one backend fix)#2264
Conversation
… backwards compatibility
c31b285 to
a5b035a
Compare
Greptile SummaryThis PR consolidates CLI error handling into a central
Confidence Score: 5/5Safe to merge — the structural changes are well-tested and the error-handling refactor is logically correct. All changed code paths have unit and/or e2e test coverage; the handler dispatch order is verified correct; the sorting fix is straightforward; the only findings are minor debugging-ergonomics nits in the new error handlers that do not affect runtime behavior for regular users. No files require special attention.
|
| Filename | Overview |
|---|---|
| cli/kleinkram/cli/error_handling.py | New centralized error handlers with good per-status-code messages; raise exc in debug branches loses original traceback (should be bare raise). |
| cli/kleinkram/cli/_executions.py | Local try/except blocks removed; InvalidMissionQuery re-raised with from e chain; UUID validation now uses typer.BadParameter; looks correct. |
| cli/kleinkram/printing.py | Sorting fix replaces tuple-of-(str, str, Mission) sort with a key-based lambda, correctly avoiding TypeError on incomparable Mission/File objects. |
| cli/kleinkram/cli/_list.py | Backward-compat list {files,missions,projects} commands now delegate to the canonical sub-command implementations via deferred imports; clean approach. |
| cli/kleinkram/cli/app.py | Error handler registration moved to register_error_handlers(app); list typer hidden (kept for back-compat); handler dispatch order is correct. |
| packages/validation/src/skip-validation.ts | Upper bound for skip lifted from 9999 to Number.MAX_SAFE_INTEGER; error message updated accordingly. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[CLI command invoked] --> B[ErrorHandledTyper.__call__]
B --> C{Exception raised?}
C -- No --> D[Normal exit]
C -- Yes --> E{ClickException?}
E -- Yes --> F[re-raise to Click]
E -- No --> G[iterate handlers in reverse order]
G --> H{isinstance httpx.HTTPStatusError?}
H -- Yes --> I[handle_http_status_error\ndisplay status-code-specific message\nlog traceback]
H -- No --> J{isinstance httpx.RequestError?}
J -- Yes --> K[handle_request_error\ndisplay connect/timeout/network message\nlog traceback]
J -- No --> L{isinstance Exception?}
L -- Yes --> M[handle_generic_exception\ndisplay_error\nlog traceback]
I --> N{debug mode?}
K --> N
M --> N
N -- Yes --> O[raise exc]
N -- No --> P[SystemExit 1]
Reviews (2): Last reviewed commit: "fix(cli+sdk): minor fixes" | Re-trigger Greptile
Includes: