perf(csv): avoid regex in CSV value escaping#40195
Conversation
Code Review Agent Run #c0d5f4Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
/resolve |
Code Review Agent Run #e6a089Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #40195 +/- ##
==========================================
- Coverage 64.16% 64.15% -0.01%
==========================================
Files 2591 2591
Lines 138162 138175 +13
Branches 32048 32052 +4
==========================================
+ Hits 88647 88650 +3
- Misses 47986 47992 +6
- Partials 1529 1533 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
SUMMARY
Avoid running two regular expressions for every CSV cell passed through
escape_value(). The CSV export path can call this for every object-valued cell and header, so replacing the regex checks with direct prefix checks keeps the existing CSV injection behavior while reducing per-cell overhead.The implementation preserves the currently tested cases for formula prefixes, doubled-quote prefixes, leading whitespace, pipe escaping, and negative numeric values. It also handles whitespace-prefixed doubled-quote formulas such as
""=10+2.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable.
TESTING INSTRUCTIONS
Ran locally:
Also ran a local microbenchmark comparing the previous regex logic with this implementation over mixed dashboard/CSV export values:
python3 -m pytest tests/unit_tests/utils/csv_tests.py -qwas not runnable in this local checkout becausepytestis not installed.ADDITIONAL INFORMATION