fix(SyntheticTimeSeries): Make synthetic time series more robust with special characters - #2766
Open
MortGron wants to merge 7 commits into
Open
fix(SyntheticTimeSeries): Make synthetic time series more robust with special characters#2766MortGron wants to merge 7 commits into
MortGron wants to merge 7 commits into
Conversation
…able contains dash
3 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2766 +/- ##
==========================================
- Coverage 93.09% 93.08% -0.02%
==========================================
Files 516 516
Lines 53590 53597 +7
==========================================
+ Hits 49889 49890 +1
- Misses 3701 3707 +6
🚀 New features to boost your workflow:
|
MortGron
marked this pull request as ready for review
August 31, 2026 12:57
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the synthetic time series expression builder to escape variable names during regex compilation rather than when storing them in the substitution dictionary, and updates the unit tests accordingly. The reviewer suggests sorting the substitution keys by length in descending order before compiling the regex pattern to prevent shorter prefixes from matching first when they contain non-word characters.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
haakonvt
approved these changes
Sep 3, 2026
haakonvt
left a comment
Contributor
There was a problem hiding this comment.
🦄 Preferably add test cases in a parametrize, but not a hard requirement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
By mistake, synthetic time series queries will fail when
re.escape(var) != varfor some variablevarin a query expression before variable replacement. However, they do not fail when variables contain characters like\.Even though this fixes a bug, a long term solution to make variable names safer is #2762
Checklist:
If a new method has been added it should be referenced in cognite.rst in order to generate docs based on its docstring.