fix(query): fail loud on incomplete result previews#165
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Reviewed. Clean fail-closed implementation: truncation truth is carried explicitly through QueryResponse, JSON output exposes truncated/preview_row_count/total_row_count, and the distinct exit code 3 is correctly scoped to the inline path (the async/query status paths route through fetch_arrow_result which is always complete). resolve_inline degrading to the preview instead of hard-exiting on a follow-up fetch failure is a good catch. Tests cover the new paths well.
| - Use `hotdata query status <query_run_id>` to poll for results. | ||
| - Exit codes for `query status`: `0` = succeeded, `1` = failed, `2` = still running (poll again). | ||
| - `json` output carries `truncated`, `preview_row_count`, and `total_row_count` so a consumer can detect a partial result from the body alone. | ||
| - If the server returns only a bounded preview that can't be completed (truncated and unfetchable), the CLI prints the preview, warns on stderr, and exits `3` — so pipelines break rather than silently ingest partial data. |
There was a problem hiding this comment.
super nit: "pipelines break rather than silently ingest partial data" is accurate for JSON consumers (the body carries truncated), but the exit-3 mechanism only breaks a shell pipeline like hotdata query ... | downstream when set -o pipefail is enabled — otherwise the pipeline's status is downstream's, not the CLI's. Worth noting that the exit-code signal requires pipefail for csv/table consumers, which have no in-body truncation marker. (not blocking)
There was a problem hiding this comment.
LGTM. Clean separation of the fail-closed exit from rendering, truncation truth carried through to structured output, and graceful degradation on follow-up fetch failure. Verified the new std::process::exit in print_result only affects the inline path — the other caller (results.rs via fetch_arrow_result) always yields truncated: false. One non-blocking doc note left inline.
Makes incomplete query results machine-detectable and fail closed instead of silently presenting partial data:
--output jsonnow carriestruncated/preview_row_count/total_row_count, and the CLI exits3when it can only show a partial preview. Also stopsresolve_inlinehard-exiting on a follow-up Arrow fetch failure — it now degrades to the preview rather than discarding the rows already in hand.