Skip to content

[#1178] Added more context info on error messages of query parsing#1179

Merged
andre-senna merged 3 commits into
masterfrom
senna-1178-1
Jul 16, 2026
Merged

[#1178] Added more context info on error messages of query parsing#1179
andre-senna merged 3 commits into
masterfrom
senna-1178-1

Conversation

@andre-senna

Copy link
Copy Markdown
Contributor

Resolves #1178

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3dbf18bf-d41e-4f76-be0c-41e4235a0f03

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

PatternMatchingQueryProcessor.cc expands parser and operator-builder RAISE_ERROR messages with full query text, offending tokens, and cursor positions. Parsing behavior and public declarations remain unchanged.

Changes

Query diagnostic context

Layer / File(s) Summary
Parser and query-tree diagnostics
src/agents/query_engine/PatternMatchingQueryProcessor.cc
Parsing and query-tree construction errors now include query text, invalid tokens where available, and cursor positions.
Operator-builder diagnostics
src/agents/query_engine/PatternMatchingQueryProcessor.cc
Argument-validation errors for LINK_TEMPLATE, AND, OR, CHAIN, LINK, and unique assignment filters now include query context and cursor positions.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: ccgsnet


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Tests For Behavior Changes ❌ Error PatternMatchingQueryProcessor.cc changed user-visible query error messages, but the PR adds no src/tests/cpp updates and the description gives no test-omission justification. Add/ अपडेट C++ tests under src/tests/cpp for the new parser/operator error messages (query text + cursor), or note why tests are intentionally omitted.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: richer query-parsing error messages with added context.
Description check ✅ Passed The description is related to the change set and correctly points to issue #1178.
Linked Issues check ✅ Passed The changes add full-query and cursor context to query parsing errors as requested in #1178.
Out of Scope Changes check ✅ Passed The patch stays focused on query parser error-message context and adds no unrelated changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch senna-1178-1

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 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.

Inline comments:
In `@src/agents/query_engine/PatternMatchingQueryProcessor.cc`:
- Around line 374-376: Update the trailing-elements error handling in
PatternMatchingQueryProcessor so it reports the source position of a
remaining/root execution-stack element rather than the stale cursor value from
the last popped entry. Preserve the relevant position before draining
execution_stack, then use that position in the RAISE_ERROR diagnostic when
element_stack.size() != 1.
- Around line 289-294: Add matching C++ regression tests under src/tests/cpp/
for the updated diagnostics in PatternMatchingQueryProcessor and related
operator-builder paths. Verify invalid-token and trailing-element errors include
the query text and correct cursor positions, and cover every too-few-arguments
path with its expected diagnostic contract.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b4edbc1c-2355-4709-93d2-f2e89aed06bc

📥 Commits

Reviewing files that changed from the base of the PR and between e8c24c0 and 19841fa.

⛔ Files ignored due to path filters (1)
  • src/MODULE.bazel.lock is excluded by !**/*.lock, !**/*.lock
📒 Files selected for processing (1)
  • src/agents/query_engine/PatternMatchingQueryProcessor.cc

Comment thread src/agents/query_engine/PatternMatchingQueryProcessor.cc
Comment thread src/agents/query_engine/PatternMatchingQueryProcessor.cc
@andre-senna

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@andre-senna

Copy link
Copy Markdown
Contributor Author

@CodeRabbit approve

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Comments resolved and changes approved.

@andre-senna andre-senna self-assigned this Jul 16, 2026
@andre-senna
andre-senna merged commit 8a2713a into master Jul 16, 2026
4 of 5 checks passed
@andre-senna
andre-senna deleted the senna-1178-1 branch July 16, 2026 15:09
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.

Improve query parser error messages to show the entire query and cursor when available

1 participant