Skip to content

Upstream #1977: canEncodeMatcher rejects unsafe expressions and nested Q.on - #3

Merged
joker-777 merged 5 commits into
kenhubfrom
upstream-pr/1977
Oct 31, 2026
Merged

joker-777 merged 5 commits into
kenhubfrom
upstream-pr/1977

Conversation

@joker-777

Copy link
Copy Markdown

Cherry-pick of upstream PR Nozbe#1977 (jsamelak), unchanged, tests and changelog included.

canEncodeMatcher reported queries containing Q.unsafeSqlExpr, Q.unsafeLokiExpr, or a Q.on nested inside Q.and/Q.or as encodable, so query().observe() threw Illegal clause instead of falling back to the reloading observer. Kenhub observes queries with Q.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.

Copilot AI balanced review requested due to automatic review settings October 30, 2026 23:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 where clauses, rejecting unsafe expressions and nested Q.on clauses.
  • 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

Copilot AI balanced review requested due to automatic review settings October 31, 2026 21:36
@joker-777
joker-777 merged commit 4db22ef into kenhub Oct 31, 2026
3 of 8 checks passed
@joker-777
joker-777 deleted the upstream-pr/1977 branch October 31, 2026 21:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues for the query-observation fallback change.

No open issues 🎉

Review effort: Balanced

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.

3 participants