Repository navigation
Decode quoted literals and parse matcher operators before values - #17
Merged
Merged
Conversation
aaraujo
force-pushed
the
fix/logql-quoted-literals
branch
from
November 11, 2026 02:00
ac7e9bc to
840f1ce
Compare
aaraujo
marked this pull request as ready for review
November 11, 2026 02:08
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.
Decode interpreted string literals once before exposing selector and pipeline values in the AST. Quoted service names and literal filters now carry their actual quote/backslash characters. Matcher operators are read from the label prefix, so strings such as
a!=b,a=~banda!~bstay inside the value.Use the same decoder for quoted pipeline stages, preserve raw-string backslashes and discard raw carriage returns. Support Go simple, octal, hex-byte and Unicode escapes; reject malformed escapes and invalid Unicode. AST values are UTF-8 strings, so byte escapes that do not form valid UTF-8 are rejected explicitly and documented. No dependency or publishing change.
Six new literal regression tests cover all matcher/line-filter operators, shared stages, one-time decoding, Unicode/byte escapes and malformed input. The initial five regressions failed before the fix. Six compatibility corpus cases and its checksum are updated.
Validation:
src/parser.rscoverage: 94.7% (2,289/2,418 lines), evaluated by the repository's 80% per-file gate using locally installed cargo-llvm-cov 0.6.16. This measurement predates the rebase; the parser body is unchanged. CI remains authoritative.Reference semantics: Go string literals.
Quoted-regex compatibility
This rejects previously tolerated single-backslash regex escapes inside
interpreted strings. For example, the first form below now fails to parse; the next two are valid:
The examples above are query text, before any host-language/JSON escaping.
Consumers should check persisted query/configuration strings for
\d,\.andsimilar regex escapes; existing strings are not automatically rewritten. Raw
pipeline strings preserve these backslashes. Backtick selector support is
unchanged and remains outside this patch.
Rebased onto current main
0192fa9at840f1ce74886af0360977a9b5857fc4f14154098.The only conflict was the changelog; both the unreleased parser fix and the 0.1.1
license entry are preserved. The new regression file uses current upstream
PackDB Contributorscasing. Parser and regression bodies are unchanged.OSS_CHECK_SCOPE=full scripts/oss-ci.sh checkspasses after rebasing, includingsource-header checks, formatting, strict lint, full tests, doctests and package
manifest/content checks. This PR does not publish a package.