Skip to content

fix(filter): let a padded raw string match a value with edge quotes - #214

Merged
pdevito3 merged 4 commits into
mainfrom
fix/raw-string-padding
Nov 1, 2026
Merged

pdevito3 merged 4 commits into
mainfrom
fix/raw-string-padding

Conversation

@pdevito3

@pdevito3 pdevito3 commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Why

A filter value that starts or ends with " had no form that worked, on any operator. The opening run of quotes in a raw string is the delimiter, so an edge quote became part of the delimiter. Now, if a raw string starts and ends with a space, QueryKit removes one space from each end. Markdown code spans use the same rule. Thus Title == """ "hi" """ compares Title with "hi".

What changed

  • RawStringLiteralParser removes one space from each end when both ends have a space and the value is not all spaces.
  • Two old Trim('"') calls in CreateRightExprFromType stripped the quotes again after the parser. The scalar trim is deleted, because no parser can give an edge quote except through the new rule. The list-item trim now runs only for a quoted list such as """["a", "b"]""".
  • The README documents the rule, the silent """"hi"""" case, and the behavior change.

Scope

  • Regular "..." strings do not get the rule.
  • """"hi"""" still gives hi with no error. The README now explains it.
  • In a list, each item still loses all edge whitespace. That behavior is older than this change.

Tradeoffs

  • Backslash escapes would change every value that has a \ in it, for example a Windows path.
  • Doubled quotes ("") conflict with the grammar, because """ already opens a raw string.

Blast Radius

A raw string that starts and ends with a space now loses one space at each end. A raw list item now keeps its edge quotes. Both are intended, and the release notes for v1.17.1 call them out.

Verification

  • An independent verifier ran each case through the verify-querykit harness, on base and on head, in memory and on Postgres. For example, Title == """ "hi" """ sends = ' "hi" ' on base and = '"hi"' on head. The verdict was PASS+NOTES.
  • QueryKit.UnitTests passes 868 of 868, and QueryKit.IntegrationTests passes 394 of 394. The new tests failed on the base parser.
  • A thermo-nuclear review found no high or medium issues. The README fix for its low finding is in this PR.

A value that starts or ends with a double quote cannot be matched today,
because the opening run of quotes swallows a leading quote and a trailing
quote runs into the closing delimiter. These tests pin the padding rule
that fixes it: one space is dropped from each end of a raw string value
when both ends have a space and the value is not only spaces. They also
pin that a raw quoted list for the in operator still drops item quotes.
A raw string value could not start or end with a double quote. The
opening run of quotes took a leading quote as part of the delimiter, and
a trailing quote ran into the closing delimiter. Now one space is dropped
from each end of a raw string value when both ends have a space and the
value is not only spaces, so """ "hi" """ is the value "hi".

The scalar string path and the bracket list path also stripped every
edge quote from the value after the parser had already removed the
delimiters, which undid the padding. The scalar trim is removed. The list
trim now applies only to a quoted list for the in operator, which still
needs it to unwrap its items.

This changes """ x """ from " x " to "x".
@pdevito3

pdevito3 commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

Shipping verdict: PASS+NOTES from an independent verifier agent that did not write the code. It used the verify-querykit harness on base 63e10e4 and head c4795a8, in memory and on Postgres. Memory and Postgres agreed on every case. The commit after c4795a8 (aa7b7b0) changes only README.md, so the verdict covers the current code.

Note: a raw list item now keeps its edge quotes ([""" "a" """] was a, now "a"). The README and the v1.17.1 release notes call this out.

@pdevito3
pdevito3 merged commit f46d56b into main Nov 1, 2026
2 checks passed
@pdevito3
pdevito3 deleted the fix/raw-string-padding branch November 1, 2026 21:35
pdevito3 added a commit that referenced this pull request Nov 1, 2026
…214)

* test(filter): pin the space padding rule for raw string values

A value that starts or ends with a double quote cannot be matched today,
because the opening run of quotes swallows a leading quote and a trailing
quote runs into the closing delimiter. These tests pin the padding rule
that fixes it: one space is dropped from each end of a raw string value
when both ends have a space and the value is not only spaces. They also
pin that a raw quoted list for the in operator still drops item quotes.

* fix(filter): let a padded raw string match a value with edge quotes

A raw string value could not start or end with a double quote. The
opening run of quotes took a leading quote as part of the delimiter, and
a trailing quote ran into the closing delimiter. Now one space is dropped
from each end of a raw string value when both ends have a space and the
value is not only spaces, so """ "hi" """ is the value "hi".

The scalar string path and the bracket list path also stripped every
edge quote from the value after the parser had already removed the
delimiters, which undid the padding. The scalar trim is removed. The list
trim now applies only to a quoted list for the in operator, which still
needs it to unwrap its items.

This changes """ x """ from " x " to "x".

* docs(readme): remove the em dash from the per-property override note

* docs(readme): describe how a list item trims whitespace and keeps edge quotes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant