Repository navigation
Upstream #1977: canEncodeMatcher rejects unsafe expressions and nested Q.on - #3
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the matcher-eligibility fix intended to let unsupported queries fall back to the reloading observer.
No open issues 🎉
What changed in this PR
This PR brings in upstream Nozbe#1977 to reject unsupported query clauses before matcher encoding, allowing observation to fall back to the reloading observer instead of throwing Illegal clause.
Changes:
- Recursively checks
whereclauses, rejecting unsafe expressions and nestedQ.onclauses. - Adds matcher rejection cases and observation-order regression tests.
- Documents the fix in the unreleased changelog.
| File | Description |
|---|---|
src/observation/test.js |
Adds observation-order tests for an unencodable Loki expression, with and without observed columns. |
src/observation/encodeMatcher/test.js |
Extends unsupported-query cases to unsafe expressions and nested joins. |
src/observation/encodeMatcher/canEncode.js |
Adds recursive clause validation and expands the rejection message. |
CHANGELOG-Unreleased.md |
Records the matcher eligibility fix. |
Review effort: Balanced
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.
Cherry-pick of upstream PR Nozbe#1977 (jsamelak), unchanged, tests and changelog included.
canEncodeMatcherreported queries containingQ.unsafeSqlExpr,Q.unsafeLokiExpr, or aQ.onnested insideQ.and/Q.oras encodable, soquery().observe()threwIllegal clauseinstead of falling back to the reloading observer. Kenhub observes queries withQ.on.Note: its changelog line sits in the same spot as the one in the RN 0.88 PR, so whichever merges second needs a trivial conflict resolution in CHANGELOG-Unreleased.md.