-
Notifications
You must be signed in to change notification settings - Fork 43
test: update jinja rule fixtures #1925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codex Review: Here are some suggestions.
Reply with @codex fix comments
to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
fn find_raw_at_src_idx(segment: &ErasedSegment, src_idx: usize) -> Option<ErasedSegment> { | ||
if segment.segments().is_empty() { | ||
return None; | ||
} | ||
for seg in segment.segments() { | ||
if let Some(pos_marker) = seg.get_position_marker() { | ||
let src_slice = pos_marker.source_slice.clone(); | ||
if src_slice.end <= src_idx { | ||
continue; | ||
} | ||
if seg.segments().is_empty() { | ||
return Some(seg.clone()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Anchor Jinja fixes to the wrong segment when no AST node exists
The helper used by JJ01 to locate the segment for a raw Jinja slice only checks source_slice.end <= src_idx
before returning a leaf. When a Jinja tag does not produce any SQL tokens (e.g. control tags like {% if %}
or {% endif %}
), there is no segment whose source_slice
covers that tag. find_raw_at_src_idx
therefore returns the first segment that follows the tag rather than failing, which means the subsequent LintFix
uses the templated slice of an unrelated SQL token. Applying the fix will either modify the wrong templated region or fail due to mismatched templated/source slices. The search should ensure src_slice.start <= src_idx < src_slice.end
and return None
otherwise so that fixes target the correct segment.
Useful? React with 👍 / 👎.
Benchmark for 09d60e2Click to view benchmark
|
ebebd4a
to
63d8f16
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, please upgrade to Bugbot Pro by visiting the Cursor dashboard. Your first 14 days will be free!
main[pos + inner.len()..].to_string(), | ||
post.to_string(), | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Jinja Tag Parsing Fails on Short Strings
The get_whitespace_ends
function assumes a minimum length for Jinja tags when performing slicing, but its input validation only checks for opening and closing braces. This can cause panics for short strings like "{}"
or "{}}"
due to invalid slice indices.
Benchmark for 0cbca49Click to view benchmark
|
Looks like there are a few issues preventing this PR from being merged!
If you'd like me to help, just leave a comment, like
Feel free to include any additional details that might help me get this PR into a better state. You can manage your notification settings |
No description provided.