MPT-18065 Fix backward incompatible issues related to RQL: Support of property comparison#210
MPT-18065 Fix backward incompatible issues related to RQL: Support of property comparison#210
Conversation
📝 WalkthroughWalkthroughThis PR introduces automatic quoting of string values in RQL query expressions. A new public helper function Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/unit/rql/query_builder/test_rql_dot_path.py (1)
33-34: Remove unusednoqadirectives.Static analysis indicates that
FBT003is not enabled in the linting configuration, making thesenoqacomments unnecessary.🧹 Suggested cleanup
- assert str(result(True)) == f"{op}(asset.id,'true')" # noqa: FBT003 - assert str(result(False)) == f"{op}(asset.id,'false')" # noqa: FBT003 + assert str(result(True)) == f"{op}(asset.id,'true')" + assert str(result(False)) == f"{op}(asset.id,'false')"
66dfc76 to
51fd78e
Compare
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@mpt_api_client/rql/query_builder.py`:
- Line 18: The trailing noqa comment on the parse_kwargs function signature is
invalid/unused; edit the parse_kwargs definition (function name: parse_kwargs)
to remove the "# noqa: WPS231 C901" directive so linters (ruff/flake8) can apply
configured rules correctly, then run the linting suite to confirm no remaining
rule suppressions are needed or add specific, valid noqa codes only if genuinely
required and documented.
In `@tests/unit/rql/query_builder/test_rql_dot_path.py`:
- Around line 32-34: The two assertions in test_rql_dot_path.py that read assert
str(result(True)) == f"{op}(asset.id,'true')" # noqa: FBT003 and assert
str(result(False)) == f"{op}(asset.id,'false')" # noqa: FBT003 should have the
unused noqa directives removed; edit the test to drop the " # noqa: FBT003"
suffixes so the lines are simply the assertions using result and op, leaving
other lines untouched.



Closes MPT-18028
Changes
quote_rql_value(value: str) -> strto properly escape single quotes and wrap values in single quotes for RQL comparisonsparse_kwargsto quote string-encoded values for string lookups and comparison operators (COMP)RQLQuery._binto quote encoded values for comparison operators before building expressionseq(status,'active')instead ofeq(status,active))