Repository navigation
Support doubled quotes in KQL values - #3858
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 8 |
🟢 Coverage 88.02% diff coverage
Metric Results Coverage variation Report missing for 5d745311 Diff coverage ✅ 88.02% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (5d74531) Report Missing Report Missing Report Missing Head commit (ff74224) 93253 25925 27.80% Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#3858) 1010 889 88.02% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Great, thanks! |
rhafer
left a comment
There was a problem hiding this comment.
Copilot found a bit of a corner case, where I am not sure what the correct behavior is:
There is a conflict between the new quoted-string rule and the existing date rule in pkg/kql/dictionary.peg.
For example:
name:"2024-01-01""foo"""
Under the PR’s quoting rules, this is one value:2024-01-01"foo". But DateTimeRestrictionNode is tried before TextPropertyRestrictionNode. It consumesname:"2024-01-01"as a date restriction, treating the first quote of the doubled pair as the closing quote. The remainder,"foo""", becomes a separate free-text value,foo".
I verified that the builder accepts the query and produces those two nodes with an implicit AND, rather than one string node. The backends then receive the wrong query: OpenSearch rejects the : date operator, while Bleve skips that date node.
The date-rule precedence predates this PR, but it conflicts with the newly supported doubled-quote syntax.
|
Great catch 🤣 I changed it so a value only counts as a date, number or boolean when it is the whole value: either in balanced quotes with the closing quote not followed by another
All existing date, number and boolean forms parse as before. An unclosed quote on a typed value is now rejected, the same as for text values. |
Fixes #3666
@AlexAndBear jfyi. With this change you can do queries like
to query for strings cotaining quotes.