Skip to content

Commit a551dea

Browse files
fix: correct max_rows error message from "exceeds" to "reached"
When len(rows) == max_rows, the count equals the maximum — it does not exceed it. The error message now accurately says "reached maximum". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1bbc9c5 commit a551dea

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/dqlitewire/messages/responses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ def decode_body(
402402
offset += consumed
403403

404404
if len(rows) >= max_rows:
405-
raise DecodeError(f"Row count {len(rows)} exceeds maximum {max_rows}")
405+
raise DecodeError(f"Row count {len(rows)} reached maximum {max_rows}")
406406

407407
if offset == prev_offset:
408408
raise DecodeError(

tests/test_messages_responses.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ def test_max_rows_limit_decode_body(self) -> None:
544544
assert len(decoded.rows) == 5
545545

546546
# Should fail with max_rows=3
547-
with pytest.raises(DecodeError, match="Row count.*exceeds maximum"):
547+
with pytest.raises(DecodeError, match="Row count.*reached maximum"):
548548
RowsResponse.decode_body(body, max_rows=3)
549549

550550
def test_max_rows_exact_boundary_rejects_at_limit(self) -> None:
@@ -570,8 +570,9 @@ def build_body(n_rows: int) -> bytes:
570570
body += encode_uint64(0xFFFFFFFFFFFFFFFF) # DONE
571571
return body
572572

573-
# Exactly max_rows rows should raise
574-
with pytest.raises(DecodeError, match="exceeds maximum"):
573+
# Exactly max_rows rows should raise — message must say "reached",
574+
# not "exceeds", because len(rows) == max_rows (issue 178)
575+
with pytest.raises(DecodeError, match="reached maximum"):
575576
RowsResponse.decode_body(build_body(3), max_rows=3)
576577

577578
# One fewer than max_rows should succeed

0 commit comments

Comments
 (0)