Skip to content

Conversation

droidmonkey
Copy link
Member

Testing strategy

Added a test case, all existing ones pass, this is a minimal change that would not break existing placeholder syntax.

Type of change

  • ✅ Bug fix (non-breaking change that fixes an issue)

@droidmonkey droidmonkey added the pr: bugfix Pull request fixes a bug label Mar 16, 2025
@droidmonkey droidmonkey added this to the v2.7.11 milestone Mar 16, 2025
@droidmonkey droidmonkey requested a review from phoerious March 16, 2025 12:06
Copy link

codecov bot commented Mar 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.89%. Comparing base (37ddbb3) to head (1b1c2b0).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #11904      +/-   ##
===========================================
- Coverage    63.92%   63.89%   -0.03%     
===========================================
  Files          369      369              
  Lines        38920    38925       +5     
===========================================
- Hits         24878    24871       -7     
- Misses       14042    14054      +12     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +1062 to +1070
// Short circuit if we have escaped the placeholder brackets
if (str.startsWith("\\{") && str.endsWith("\\}")) {
// Replace the escaped brackets with actuals and move on
auto ret = str;
ret.replace(0, 2, "{");
ret.replace(ret.size() - 2, 2, "}");
return ret;
}

Copy link
Member

Choose a reason for hiding this comment

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

This is a very brittle escaping mechanism. Either we need a proper state machine for parsing the syntax or this should at least be part of the regex, e.g. as negative lookbehinds/lookaheads.

Copy link
Member Author

Choose a reason for hiding this comment

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

@phoerious
This is a very special case situation and should rarely be encountered. Since we properly test the start and end conditions before manually manipulating the string, I don't see a particular problem with this implementation. I am not interested in putting extensive work to make a state machine or complex regex just for this.

@droidmonkey droidmonkey force-pushed the fix/escape-placeholder branch from e09cf0b to 1b1c2b0 Compare March 30, 2025 12:20
@droidmonkey droidmonkey requested a review from phoerious June 21, 2025 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: bugfix Pull request fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

T-REPLACE-RX doesn't work as expected when escaping curly braces

2 participants