## Summary
- Fix regexes in `buildBenchmarkInfo` that strip empty improved/degraded
benchmark sections from PR comments
- The regexes didn't match the actual template text: wrong heading level
(`####` vs `###`), wrong emoji (`📉` vs `⚡️`), and wrong wording —
causing `{benchmark_info_degraded}` to render literally when there are
no degraded benchmarks
- Add unit tests for improved-only, degraded-only, and empty benchmark
scenarios
## Test plan
- [x] All 33 tests in `pr-changes-utils.test.ts` pass
- [x] New tests verify template placeholders are fully removed when a
section is empty
At the moment, show it only for single hunk existing PR comments.
Changes made in a way to ensure ease in adding for new PRs too. Details
of optimization hidden from user at the moment.
---------
Co-authored-by: HeshamHM28 <HeshamMohamedFathy@outlook.com>
Adding : ```<!-- CODEFLASH_OPTIMIZATION:
{"function":"sorter","file":"cli/code_to_optimize/bubble_sort.py","speedup_pct":"30,125%","speedup_x":"301.25x","original_runtime":"9.03
seconds","best_runtime":"29.9
milliseconds","optimization_type":"algorithm","timestamp":"2025-07-23T08:59:04.218Z","version":"1.0"}
-->```
as metadata so that we can change github msgs without breaking verify
optimization regex.
Example: https://github.com/codeflash-ai/my-best-repo/pull/334https://github.com/Saga4/my-best-repo/pull/7#discussion_r2224744802
### **User description**
Passing 'speedup_x' through, and using that instead of percentage. (when
percentage is over 1000)
___
### **PR Type**
- Enhancement
___
### **Description**
- Added new parameter `speedup_x` to PR title builders.
- Modified functions to display multiplier when percentage exceeds 1000.
- Updated dependent PR title calls with additional arguments.
- Adjusted tests to verify new title logic.
___
### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>create-pr.ts</strong><dd><code>Update create-pr
endpoint with new speedup_x parameter</code>
</dd></summary>
<hr>
js/cf-api/endpoints/create-pr.ts
<li>Added <code>speedup_x</code> argument in buildPrTitle call.<br> <li>
Minor formatting fix (removed extra semicolon).<br> <li> Updated branch
creation message to include additional parameters.
</details>
</td>
<td><a
href="https://github.com/codeflash-ai/codeflash-internal/pull/1488/files#diff-728a794bb81f944ae7db030f5e6ae1c1ba6888aa46e4be6846ebc5bd1ce12c2c">+7/-4</a>
</td>
</tr>
<tr>
<td>
<details>
<summary><strong>suggest-pr-changes.ts</strong><dd><code>Update
suggest-pr-changes with new speedup_x parameter</code>
</dd></summary>
<hr>
js/cf-api/endpoints/suggest-pr-changes.ts
<li>Inserted <code>speedup_x</code> parameter in buildDependentPrTitle
call.<br> <li> Adjusted commit message composition.
</details>
</td>
<td><a
href="https://github.com/codeflash-ai/codeflash-internal/pull/1488/files#diff-b4a862986fd70827b8dabcb3157972bd0d5d507cf9c12e5fbf56f24979d073f3">+1/-0</a>
</td>
</tr>
<tr>
<td>
<details>
<summary><strong>create-pr-from-diffcontents.ts</strong><dd><code>Modify
PR creation functions for updated title parameters</code></dd></summary>
<hr>
js/cf-api/github/create-pr-from-diffcontents.ts
<li>Modified buildPrTitle call to include <code>speedup_x</code> and
<code>loop_count</code>.<br> <li> Updated buildDependentPrTitle call
with <code>speedup_x</code>.
</details>
</td>
<td><a
href="https://github.com/codeflash-ai/codeflash-internal/pull/1488/files#diff-b30d5e0c89beb70c0333a025726867aba5db7614911be3c46664bb59d1ab594a">+7/-1</a>
</td>
</tr>
<tr>
<td>
<details>
<summary><strong>pr-changes-utils.ts</strong><dd><code>Update title
building utilities for speedup multiplier logic</code></dd></summary>
<hr>
js/cf-api/github/pr-changes-utils.ts
<li>Added <code>speedup_x</code> parameter to buildPrTitle and
buildDependentPrTitle.<br> <li> Implemented condition to use
<code>speedup_x</code> when percentage > 1000.<br> <li> Refactored title
functions for enhanced clarity.
</details>
</td>
<td><a
href="https://github.com/codeflash-ai/codeflash-internal/pull/1488/files#diff-ac6988771dc3fdb0666757d9bace579f70856f1f383ddd5db264484f1b6016e4">+12/-3</a>
</td>
</tr>
</table></td></tr><tr><td><strong>Tests</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>pr-changes-utils.test.ts</strong><dd><code>Adjust tests
to support new title building parameters</code>
</dd></summary>
<hr>
js/cf-api/github/pr-changes-utils.test.ts
<li>Updated tests for buildPrTitle with additional
<code>speedup_x</code> parameter.<br> <li> Revised expected output
strings in dependent PR title tests.
</details>
</td>
<td><a
href="https://github.com/codeflash-ai/codeflash-internal/pull/1488/files#diff-b724fe01559c8ff46177344dcaa3741bc56bbda2b14ec979558bb7cf6245951a">+5/-5</a>
</td>
</tr>
</table></td></tr></tr></tbody></table>
___
> <details> <summary> Need help?</summary><li>Type <code>/help how to
...</code> in the comments thread for any questions about PR-Agent
usage.</li><li>Check out the <a
href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a>
for more information.</li></details>