Conversation
…eption (#3664) LetStatement and ReturnStatement did not override isIdempotent(), defaulting to false. Read-only scripts (LET+SELECT, RETURN) were rejected by the /query endpoint. Now LetStatement delegates to its sub-statement and ReturnStatement returns true. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue where read-only SQLScripts, specifically those using Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
🧪 CI InsightsHere's what we observed from your CI run for bd9fae5. 🟢 All jobs passed!But CI Insights is watching 👀 |
There was a problem hiding this comment.
Code Review
This pull request effectively addresses an issue where read-only SQL scripts with LET and RETURN were incorrectly flagged as non-idempotent. The changes are concise and correct, with isIdempotent() now properly implemented for LetStatement and ReturnStatement. The addition of comprehensive regression tests is excellent, verifying both the fix and ensuring that write operations remain non-idempotent. The detailed markdown file explaining the change is also a great addition.
| if (statement != null) | ||
| return statement.isIdempotent(); |
There was a problem hiding this comment.
For improved code clarity and to prevent potential maintenance issues, it's a good practice to use braces for all if statements, even when the body contains only a single line. This makes the code more robust against future modifications.
| if (statement != null) | |
| return statement.isIdempotent(); | |
| if (statement != null) { | |
| return statement.isIdempotent(); | |
| } |
Code ReviewThe fix correctly addresses the root cause: both ✅ What looks good
Issues to address1. Stray documentation file in repo root
2. Test uses fully-qualified
assertThatThrownBy(() -> database.query("sqlscript", script))
.isInstanceOf(QueryNotIdempotentException.class);This is both more readable and consistent with the rest of the codebase. The full-qualified form also bypasses the import section and is harder to scan. 3. Minor: expression idempotency caveat (FYI, not a blocker) The comment SummaryThe core logic is correct and the approach is sound. The two things that should be fixed before merging are: remove/relocate the stray |
Remove stray documentation file from repo root and switch test assertion from JUnit assertThrows to AssertJ assertThatThrownBy for codebase consistency. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code ReviewThis is a clean, focused fix for issue #3664. The approach is correct and well-scoped. What's Good
Minor Observations
VerdictThe fix is minimal, correct, and well-tested. No issues found that would block merging. ✅ |
Code review feedback addressed (bd9fae5)Applied:
Rejected:
|
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3666 +/- ##
==========================================
- Coverage 65.86% 65.76% -0.10%
==========================================
Files 1550 1550
Lines 109689 109689
Branches 22875 22875
==========================================
- Hits 72245 72141 -104
- Misses 27762 27822 +60
- Partials 9682 9726 +44 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
/queryendpoint withQueryNotIdempotentExceptionLetStatement.isIdempotent()now delegates to its sub-statement (soLET $x = (SELECT ...)is idempotent,LET $x = (INSERT ...)is not); expression-only LETs returntrueReturnStatement.isIdempotent()now returnstrueunconditionally since RETURN only outputs dataTest plan
queryScriptWithLetAndReturnIsIdempotent— read-only script succeeds viadatabase.query("sqlscript", ...)queryScriptWithWriteStatementIsNotIdempotent— script with INSERT is still rejectedSQLScriptTesttests pass🤖 Generated with Claude Code