Skip to content

fix(query): fail loud on incomplete result previews#165

Merged
zfarrell merged 2 commits into
mainfrom
fix/incomplete-query-result-previews
Jun 19, 2026
Merged

fix(query): fail loud on incomplete result previews#165
zfarrell merged 2 commits into
mainfrom
fix/incomplete-query-result-previews

Conversation

@zfarrell

Copy link
Copy Markdown
Contributor

Makes incomplete query results machine-detectable and fail closed instead of silently presenting partial data: --output json now carries truncated/preview_row_count/total_row_count, and the CLI exits 3 when it can only show a partial preview. Also stops resolve_inline hard-exiting on a follow-up Arrow fetch failure — it now degrades to the preview rather than discarding the rows already in hand.

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.69406% with 16 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/query.rs 92.11% 16 Missing ⚠️

📢 Thoughts on this report? Let us know!

claude[bot]
claude Bot previously approved these changes Jun 18, 2026

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread README.md
- 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@zfarrell zfarrell merged commit 1133d68 into main Jun 19, 2026
14 checks passed
@zfarrell zfarrell deleted the fix/incomplete-query-result-previews branch June 19, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant