Repository navigation
fix(run): refuse negative --max-rows before querying (#119) - #121
Conversation
laaielichter
left a comment
There was a problem hiding this comment.
Thanks @dianatofficial, #119 is assigned to you (your claim at 08:26 was the only one) and the PR does what the issue asks. One small CHANGELOG move and it is ready.
What I checked. I merged 6f863ea onto current main (986a194) in a scratch worktree: clean merge, ruff check . passes, pytest -q gives 855 passed, 10 skipped (no symlink tests deselected needed on Linux). Against #119's "Done when":
run()validatesmax_rowsbefore anything is estimated or executed, so Python callers get it too, and--max-rows -5returnsstatus: "error"naming the value with anext_step, exit code 1, andlist_receiptsstays empty.--max-rows 0, a value abovemax_output_rows(still capped) and leaving the option out behave as before.- Tests exist through
core.run()and throughmain([...])(JSON and plain output), plus the0case. - Rejecting booleans and non-integers is a bit stricter than the old
int(max_rows); that is fine, the MCP tool already types it as an int.
Please fix: where the CHANGELOG line sits. The new bullet is at the top of ### Fixed. Other open PRs also add their line at the top of that list, so they will all conflict. Please move your bullet to the end of the existing ### Fixed list (just above ### Changed), then push.
Optional. Both test files end with an extra blank line; you can drop it while you are in there.
CI: both runs for this commit (ci, codeql) are action_required, which is GitHub holding a new contributor's first run until a maintainer approves it, so no check has run yet.
Generated by Claude Code
…im trailing blank lines
|
Moved the \CHANGELOG.md\ bullet to the end of ### Fixed\ (just above ### Changed) and removed the extra trailing blank lines in both test files. |
laaielichter
left a comment
There was a problem hiding this comment.
Thank you @dianatofficial, both things from my last review are done in 8f965cc: the #119 bullet is now at the end of ### Fixed (just above ### Changed), and the extra blank lines at the end of the two test files are gone.
What I checked. I merged 8f965cc onto current main (c48adf8) in a scratch worktree: clean merge (the CHANGELOG no longer conflicts), ruff check . passes, pytest -q gives 873 passed, 10 skipped. The code and tests are unchanged from 6f863ea, which I already checked against #119's "Done when", so nothing else to add.
CI: both runs for this commit (ci, codeql) are action_required, which is GitHub holding a first-time contributor's run until a maintainer approves it, so no check has run on GitHub yet.
Generated by Claude Code
|
@dianatofficial #105 just merged, so Generated by Claude Code |
|
Resolved the \ ests/test_cli_and_mcp.py\ merge locally and verified |
|
Thank you, @dianatofficial! I don't see the merge on the PR yet, though: its head is still Generated by Claude Code |
|
@dianatofficial a small tip in case the Generated by Claude Code |
|
@laaielichter Merged current main into the branch, kept both test blocks in ests/test_cli_and_mcp.py, and verified the #119 bullet sits cleanly at the end of ### Fixed under ## Unreleased. All conflicts are resolved and the branch is clean and ready to land. Thank you! |
laaielichter
left a comment
There was a problem hiding this comment.
Thank you @dianatofficial for merging main in. Still approved on f8cfa4e.
Compared with 8f965cc, which I approved, the only change is the merge of current main (52666d3); the code, the tests and the CHANGELOG line for #119 are the same, and the merge is clean. With this head: ruff check . passes, git diff --check is clean and pytest -q gives 887 passed, 10 skipped.
CI: the ci and codeql runs for this head are action_required until a maintainer approves them, and Gulliver needs all 14 checks green, so I am not merging yet.
Generated by Claude Code
|
@dianatofficial a heads-up: other PRs landed on Generated by Claude Code |
…fix/run-max-rows-validation
|
@laaielichter Merged current main into the branch and kept all CHANGELOG lines with our entry at the end of the Fixed list as requested. All conflicts are resolved and the branch is clean. Thank you! |
laaielichter
left a comment
There was a problem hiding this comment.
Thank you @dianatofficial for merging the current main in again. Still approved, now on 41ee698.
Compared with what I approved earlier, your change is the same: run() validation in core.py, the two test files and the #119 CHANGELOG line (the merge of main resolved the CHANGELOG cleanly; the branch is now 0 commits behind main bff74d0). With this head: ruff check . passes, git diff --check is clean and pytest -q gives 976 passed, 10 skipped.
By hand: on main, gulliver run --max-rows -5 "SELECT 1" runs and writes a receipt; on this head it returns status: error ("--max-rows must be at least 0, got -5.") with a next_step, before anything is queried. Mutation check: with core.py reverted to main, test_run_refuses_negative_max_rows_and_allows_zero and test_cli_run_refuses_negative_max_rows_and_allows_zero both fail, so the tests do guard the fix.
I have approved the ci and codeql runs for this head; the PR merges once all 14 required checks are green.
Generated by Claude Code
|
Merged as Generated by Claude Code |
Fixes #119.
What was wrong
gulliver run --max-rows Nsilently clamped negative values to0(max(0, min(int(max_rows), ...))), returning an emptypreview: []withstatus: "ok"instead of failing loudly.What changed
max_rowsat the top ofrun()insrc/gulliver/core.py: whenmax_rows is not Noneand is negative (< 0), boolean, or non-integer,run()returns_error(...)naming the flag and invalid value alongside a clearnext_step, exiting with code1before running preflight/estimation, touching the database, or writing a receipt.--max-rows 0(row counts without preview rows), values abovebudget.max_output_rows(still capped to budget), and omittedmax_rows(None) continue to behave identically to before.bool/ non-intfloats is slightly stricter than the oldint(max_rows)coercion.tests/test_flow_duckdb.py(testingmax_rows=-5writes no receipt,max_rows=0, and capping abovemax_output_rows) and CLI tests intests/test_cli_and_mcp.py(--jsonand plain output).CHANGELOG.mdentry underUnreleased -> Fixed.Verification
ruff check .:All checks passed!pytest -q -k "not symlink":851 passed, 11 skipped, 3 deselectedon Windows 11 with Python 3.13 (the 3 deselected tests intests/test_security.pycallos.symlink).