Skip to content

Handle invalid JSONPath in message preview filters - #1917

Open
reachsrinivaschennupati-tech wants to merge 1 commit into
kafbat:mainfrom
reachsrinivaschennupati-tech:fix/1436-preview-jsonpath-crash
Open

Handle invalid JSONPath in message preview filters#1917
reachsrinivaschennupati-tech wants to merge 1 commit into
kafbat:mainfrom
reachsrinivaschennupati-tech:fix/1436-preview-jsonpath-crash

Conversation

@reachsrinivaschennupati-tech

@reachsrinivaschennupati-tech reachsrinivaschennupati-tech commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
  • Breaking change? (if so, please describe the impact and migration path for existing application instances)

What changes did you make? (Give an overview)

Is there anything you'd like reviewers to focus on?

How Has This Been Tested? (put an "x" (case-sensitive!) next to an item)

  • No need to
  • Manually (please, describe, if necessary)
  • Unit checks
  • Integration checks
  • Covered by existing automation

Checklist (put an "x" (case-sensitive!) next to all the items, otherwise the build will fail)

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (e.g. ENVIRONMENT VARIABLES)
  • My changes generate no new warnings (e.g. Sonar is happy)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged

Check out Contributing and Code of Conduct

A picture of a cute animal (not mandatory but encouraged)

Summary by CodeRabbit

  • Bug Fixes

    • Prevented malformed message preview filters from crashing the message list.
    • Messages now continue rendering when a saved JSONPath filter is invalid.
  • Tests

    • Added coverage to verify messages remain visible when invalid filters are used.

@reachsrinivaschennupati-tech
reachsrinivaschennupati-tech requested a review from a team as a code owner July 21, 2026 05:22
@kapybro kapybro Bot added status/triage/manual Manual triage in progress and removed status/triage/manual Manual triage in progress labels Jul 21, 2026
@kapybro

kapybro Bot commented Jul 21, 2026

Copy link
Copy Markdown

AI Summary

The GitHub issue addresses handling invalid JSONPath expressions in message preview filters, likely to prevent crashes or unexpected behavior when users provide malformed paths. The proposed solution involves adding validation or graceful error handling for such cases, though specific changes and testing details are not provided. The issue includes a checklist for code review and testing, but no breaking changes are mentioned.

@kapybro kapybro Bot added area/messages impact/documentation A PR with changes which should be addressed in the documentation type/bug Something isn't working labels Jul 21, 2026
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Message rendering now catches exceptions from invalid JSONPath filters and returns null for affected filter items. A Jest test verifies that malformed saved preview filters do not prevent the message offset from rendering.

Changes

Message filter resilience

Layer / File(s) Summary
Guard JSONPath evaluation and validate rendering
frontend/src/components/Topics/Topic/Messages/Message.tsx, frontend/src/components/Topics/Topic/Messages/__test__/Message.spec.tsx
renderFilteredJson catches JSONPath errors, while a test confirms malformed saved filters leave the message offset visible.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

A rabbit found a crooked path,
It hopped past errors in a flash.
The message stayed in view,
Its offset shining through—
Safe filters made the UI dash!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: handling invalid JSONPath expressions in message preview filters.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@Haarolean Haarolean linked an issue Jul 31, 2026 that may be closed by this pull request
4 tasks
@Haarolean Haarolean added scope/frontend Related to frontend changes and removed impact/documentation A PR with changes which should be addressed in the documentation labels Jul 31, 2026
</div>
);
} catch {
return null;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

how's that gonna be treated at the ui?

@reachsrinivaschennupati-tech

Copy link
Copy Markdown
Contributor Author

@Haarolean I corrected the PR checklist formatting so the checklist linter can parse the checked items properly. Please review when you have a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/messages scope/frontend Related to frontend changes type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FE: Messages: JSON path errors crash the page

2 participants