Skip to content

Conversation

benfdking
Copy link
Collaborator

No description provided.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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".

Comment on lines +40 to +51
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());

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 👍 / 👎.

Copy link

github-actions bot commented Sep 2, 2025

Benchmark for 09d60e2

Click to view benchmark
Test Base PR %
DepthMap::from_parent 60.3±1.23µs 60.5±0.58µs +0.33%
fix_complex_query 12.2±0.20ms 12.1±0.04ms -0.82%
fix_superlong 130.6±13.59ms 132.6±15.14ms +1.53%
parse_complex_query 4.2±0.09µs 4.2±0.02µs 0.00%
parse_expression_recursion 7.4±0.06µs 7.2±0.05µs -2.70%
parse_simple_query 1057.5±13.45ns 1101.1±19.27ns +4.12%

@benfdking benfdking force-pushed the codex/add-jinja-whitespace-rule-jj01 branch from ebebd4a to 63d8f16 Compare September 2, 2025 09:06
Copy link

@cursor cursor bot left a 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(),
)
}
Copy link

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.

Fix in Cursor Fix in Web

Copy link

github-actions bot commented Sep 2, 2025

Benchmark for 0cbca49

Click to view benchmark
Test Base PR %
DepthMap::from_parent 60.7±0.97µs 61.2±2.53µs +0.82%
fix_complex_query 12.2±0.13ms 12.3±0.09ms +0.82%
fix_superlong 142.0±17.11ms 140.5±14.61ms -1.06%
parse_complex_query 4.2±0.23µs 4.2±0.05µs 0.00%
parse_expression_recursion 7.2±0.12µs 7.2±0.09µs 0.00%
parse_simple_query 1062.7±25.42ns 1063.3±14.24ns +0.06%

Copy link

openhands-ai bot commented Sep 2, 2025

Looks like there are a few issues preventing this PR from being merged!

  • GitHub Actions are failing:
    • PR Checks

If you'd like me to help, just leave a comment, like

@OpenHands please fix the failing actions on PR #1925 at branch `codex/add-jinja-whitespace-rule-jj01`

Feel free to include any additional details that might help me get this PR into a better state.

You can manage your notification settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant