Skip to content

Comments

fix: correct regex operator precedence for pattern anchoring#2122

Open
themavik wants to merge 1 commit intoelementary-data:masterfrom
themavik:fix-regex-operator-precedence
Open

fix: correct regex operator precedence for pattern anchoring#2122
themavik wants to merge 1 commit intoelementary-data:masterfrom
themavik:fix-regex-operator-precedence

Conversation

@themavik
Copy link
Contributor

@themavik themavik commented Feb 20, 2026

Fixes #2036

The regex ^px|cm|...|Q$ had misleading operator precedence where ^ only anchored px and $ only anchored Q. Updated to ^(px|cm|...|Q)$ to properly anchor the full alternation.

Summary by CodeRabbit

  • Bug Fixes
    • Improved formatting of error messages for enhanced clarity and readability.

Change /^px|cm|...|Q$/ to /^(px|cm|...|Q)$/ so that ^ and $ anchor
the entire alternation, not just the first and last alternatives.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions
Copy link
Contributor

👋 @themavik
Thank you for raising your pull request.
Please make sure to add tests and document all user-facing changes.
You can do this by editing the docs files in this pull request.

@themavik themavik requested a deployment to elementary_test_env February 20, 2026 18:24 — with GitHub Actions Waiting
@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

A minor textual correction to error message strings in the monitoring report HTML file, adjusting the formatting of error descriptions by removing a leading hyphen character. No functional or behavioral changes.

Changes

Cohort / File(s) Summary
Error Message Formatting
elementary/monitor/data_monitoring/report/index.html
Corrected error message string formatting by removing leading hyphen from iterable/destructuring error descriptions.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A hyphen hopped away today,
From error messages in disarray,
The text now flows with grace and ease,
Iterable objects sure to please!

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title claims to fix regex operator precedence for pattern anchoring, but the actual changes only fix minor textual error messages in an HTML file, with no regex pattern modifications present. The title does not match the changeset. Either update the PR to include the regex fix described in the title, or update the title to accurately reflect the minor error message text corrections made.
Linked Issues check ⚠️ Warning The linked issue #2036 requires fixing a regex with inconsistent anchoring (^px|cm|...|Q$), but the PR only modifies error message text in HTML, not the actual problematic regex pattern. Locate and apply the regex anchoring fix (^(px|cm|...|Q)$) to the actual codebase file containing the pattern, or clarify whether this PR is addressing a different aspect of issue #2036.
Out of Scope Changes check ⚠️ Warning The changeset modifies error message formatting in HTML, which is unrelated to the stated objective of fixing regex operator precedence for pattern anchoring as described in the PR title and linked issue. Remove unrelated error message formatting changes or provide justification for their inclusion. Ensure all changes directly address the regex anchoring issue described in #2036.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.40.5)
elementary/monitor/data_monitoring/report/index.html

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 and usage tips.

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.

Bug report — Misleading regex operator precedence vulnerability

1 participant