fix(mysql): strip trailing semicolon on unlimited query path - #2557
fix(mysql): strip trailing semicolon on unlimited query path#2557Bartok9 wants to merge 1 commit into
Conversation
Walkthrough
ChangesMySQL semicolon normalization
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
core/wren/tests/unit/test_mysql_unlimited_semicolon.py (1)
8-16: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winTest runtime behavior, not only source ordering.
This source-text assertion can pass even if
query()still executes a semicolon-terminated SQL string. Add a behavior-level test with a fake cursor/connection that callsquery(..., limit=None)and asserts the executed SQL is normalized.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@core/wren/tests/unit/test_mysql_unlimited_semicolon.py` around lines 8 - 16, Replace or supplement test_query_always_strips_before_limit with a runtime test using fake cursor and connection objects, invoke query with limit=None, and assert the cursor receives SQL without the trailing semicolon. Keep the test focused on executed SQL rather than source-text ordering, reusing the existing query setup symbols where applicable.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@core/wren/tests/unit/test_mysql_unlimited_semicolon.py`:
- Around line 8-16: Replace or supplement test_query_always_strips_before_limit
with a runtime test using fake cursor and connection objects, invoke query with
limit=None, and assert the cursor receives SQL without the trailing semicolon.
Keep the test focused on executed SQL rather than source-text ordering, reusing
the existing query setup symbols where applicable.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: ad6eef6e-92b8-4324-9f00-a61ad926e228
📒 Files selected for processing (2)
core/wren/src/wren/connector/mysql.pycore/wren/tests/unit/test_mysql_unlimited_semicolon.py
|
Same note as on the sibling PRs in this series: the direction matches what already landed for Athena in #2535, but the test needs to exercise the connector rather than its source text.
Also worth clarifying in the description: |
Code reviewSuperseded — #2595 landed this change for MySQL in Worth noting because it isn't obvious from the PR page: this still reports limit = _coerce_limit(limit)
# Always strip terminator so unlimited execute matches dry_run EXPLAIN ...
sql = strip_trailing_semicolon(sql) # this PR
if limit is not None:
sql = _apply_limit(sql, limit)
else:
# Unlimited path: strip trailing terminators ...
sql = strip_trailing_semicolon(sql) # already on main via #2595(verified with One process note that applies to the whole series: the test here pins implementation text rather than behaviour — WrenAI/core/wren/tests/unit/test_mysql_unlimited_semicolon.py Lines 8 to 16 in 2c6ef6a It reads |
|
Superseded by #2595 (already merged) — and you're right this would double-strip on top of it. Closing. Thanks. |
Summary
MySQL Connector.query always strips before LIMIT so unlimited SEL CET matches dry_run (core/wren Apache-2.0).
pytest core/wren/tests/unit/test_mysql_unlimited_semicolon.py — 1 passed
Author Bartok9
Summary by CodeRabbit
Bug Fixes
Tests