Skip to content

fix: properly handle trailing newlines in lucene and add more tests#948

Merged
mhoff merged 4 commits intomainfrom
fix-trailing-newlines-in-lucene-filter
Apr 1, 2026
Merged

fix: properly handle trailing newlines in lucene and add more tests#948
mhoff merged 4 commits intomainfrom
fix-trailing-newlines-in-lucene-filter

Conversation

@mhoff
Copy link
Copy Markdown
Collaborator

@mhoff mhoff commented Mar 20, 2026

Description

  • properly handle trailing newlines in lucene
  • add more tests regarding the usage of (escaped) special characters
  • ensure test_requester fails for not triggering filter rules

Assignee

  • The changes adhere to the contribution guidelines
  • I have performed a self-review of my code
  • My changes generate no new warnings (e.g. flake8/mypy/pytest/...) other than deprecations

Documentation

Code Quality

  • Patch test coverage > 95% and does not decrease
  • New code uses correct & specific type hints

How did you verify that the changes work in practice?

  • pytest

Reviewer


The rendered docs for this PR can be found here.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.20%. Comparing base (78c0f13) to head (bb87566).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #948      +/-   ##
==========================================
- Coverage   96.21%   96.20%   -0.01%     
==========================================
  Files         218      218              
  Lines       14373    14373              
==========================================
- Hits        13829    13828       -1     
- Misses        544      545       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@Pablu23 Pablu23 left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thank you for all the tests, but please do explain what the difference is between \Z and $ because as I thought and a quick google would also agree, they should be equivalent?

@mhoff
Copy link
Copy Markdown
Collaborator Author

mhoff commented Mar 30, 2026

Looks good to me. Thank you for all the tests, but please do explain what the difference is between \Z and $ because as I thought and a quick google would also agree, they should be equivalent?

The regex is meant to find (the potentially escaped) end of the string. But $ matches trailing newlines as well, which the user intends to use as part of the payload. This leads to trailing newlines being stripped from the payload.

https://sethmlarson.dev/regex-%24-matches-end-of-string-or-newline#:~:text=Pattern%20matches
https://sethmlarson.dev/use-backslash-A-and-z-not-%5E-and-%24-with-python-regular-expressions

@mhoff
Copy link
Copy Markdown
Collaborator Author

mhoff commented Mar 30, 2026

@Pablu23 could you please also tick the review tasks in the PR description?

@mhoff mhoff force-pushed the fix-trailing-newlines-in-lucene-filter branch from 1762421 to bb87566 Compare April 1, 2026 12:16
@mhoff mhoff merged commit 3c63a13 into main Apr 1, 2026
24 checks passed
@mhoff mhoff deleted the fix-trailing-newlines-in-lucene-filter branch April 1, 2026 12:44
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.

3 participants