Repository navigation
fix(python-sdk): bind JSON path strings safely - #30766
mergify[bot] merged 2 commits into
Conversation
Keep six JSON helper path arguments inside string values, including quoted member names. Preserve SQLAlchemy 1.4 compatibility and executemany, with native SQL boundary and online roundtrip regressions. Rebase onto main 57681d4; the complete clients/python tree is unchanged from verified candidate 8541db1. Related to matrixorigin#30765. 由 LW 授权的 ChatGPT Personal 智能体提交。
|
由 LW 授权的 ChatGPT Personal 智能体提交。 发布后固定交付记录:head eac18da,3文件+76/-14。独立review对最终远程head再次明确Approve,确认parent57681d4、全树与本地固定提交一致,完整PythonSDK树与真实三版本MatrixOne RED/GREEN及全量offline/打包已测版本一致。没有未处理审查阻塞。 已读回PR正文与预检内容完全相同、LF换行及模板段落正确。产品PR没有验证workflow或临时生成物;必要offline/online回归完整保留。Issue #30765 的XuPeng-SH assignee已读回,PR暂draft等待上游正式required CI;通过后再指派PR并请求该负责人审阅并读回。不合并、不关闭Issue。所有分支归档、expected-SHA更新、PR创建与只读核验主体同上署名。 |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
由 LW 授权的 ChatGPT Personal 智能体提交。 上游正式门禁与负责人交付已完成(head eac18da 未变化):MatrixOne ALL CI #39692878618 的6个Python/SQLAlchemy矩阵job均SUCCESS,CI preflight及CI Required聚合门禁SUCCESS;Iceberg adapter module tidy SUCCESS,E2E按路径SKIPPED。内核/升级/BVT与完整在线job按路径/手动触发条件SKIPPED,未冒充通过。 独立终审Approve、真实MatrixOne三版本各6项RED→GREEN、全量offline与打包证据见正文和Issue。无新inline thread或requested changes。全部规定门禁通过后,已将PR转ready、assign XuPeng-SH并请求其审阅;重新读取GitHub确认draft=false、assignees含XuPeng-SH、requested reviewers含XuPeng-SH。正文同步实际结果。以上无正文的状态/指派/审阅请求与只读核验均由本署名主体执行;不合并、不部署、不关闭Issue。 |
|
mo-bot review · Commit: Review completed. Read the assessment. |
|
mo-bot review · Commit: already-reviewed |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-xupeng · review
Commit: eac18da85008a93ae4b770a6f86bcd4af9e7e6d0
Assessment: approve
Reviewed the complete three-file delta, callers, compatibility, test coverage and supplied comments. The fix correctly delegates JSON-path escaping to SQLAlchemy without adding another execution path. No actionable defects found.
Model: gpt-6-astra / xhigh
Session: 01a14d34-4e51-79a3-a62d-6c9c16279dc8 · slot 0 · generation 0
Validation:
-
Verified frozen head/base, complete patch, clean source and declared SDK/product tree hashes.
-
Isolation preflight passed. All 50 JSON offline tests passed on each of SQLAlchemy 1.4.54, 2.0.55 and 2.1.6, including cached bindings and two-row executemany mutations.
-
Thirty additional literal-rendering cases passed through the public SQL-string compiler and SQLite parser; MatrixOne dialect bind compilation also passed.
-
Matched commands, source fingerprints, successful exit receipts, logs and JUnit counts. Evidence retained in /home/xupeng/.local/state/mo-bot/jobs/fba5805d3b614c5226ed2343/attempt-1/validation-manifest.json.
-
Inspected CI wiring and the frozen snapshot reporting six successful SDK offline matrix jobs and CI Required.
Limitations:
-
No live MatrixOne roundtrip or full offline suite was rerun locally. Author-reported online results lack retained execution logs in the supplied bundle and were not independently verified.
-
Local tests used Python 3.13.5; other Python versions are represented only by the frozen CI status snapshot.
-
The linked issue body was not supplied; review covered the behavioral contract stated in the PR.
Merge Queue Status
This pull request spent 3 minutes 4 seconds in the queue, including 1 minute 49 seconds running CI. Required conditions to merge
|
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes #30765. ## What this PR does / why we need it: Python SDK bracket access still concatenates object keys as bare JSONPath syntax after #30766 fixed SQL parameter binding. `data["owner's"]` raises an invalid-path error, while `data["x.y"]` silently reads nested `x.y` instead of the literal member named `x.y`. Encode every first and nested member with the standard library JSON string encoder, retaining actual UTF-8 for non-BMP characters. Existing SQLAlchemy binding remains responsible for SQL boundaries. All default, text, numeric, boolean and comparison readers consume the same correctly quoted path. No manual identifier grammar, compatibility branches, cache or server/protocol changes are added. Encoding is linear in key length during expression construction; no per-row work is introduced. Default unlabelled projection also exposed existing SQLAlchemy expression integration defects. Delegate FROM dependencies to the underlying column/literal, restore inherited identity hashing for anonymous labels, and remove the obsolete `_is_subquery` override. Extend the existing offline/online JSON suites with discriminating values, literal-versus-nested collisions, punctuation, quotes, backslashes, empty names, control characters, Unicode, parent/sibling reuse, missing/NULL values, typed predicates, and ORM/table/alias/literal projection compilation. Stabilize four existing order-dependent assertions with explicit ordering. Validation on the final content (CPython 3.12.8, SQLAlchemy 1.4.54 / 2.0.43 / 2.1.6): - Entire SDK offline suite: **1298 / 1294 / 1302 passed**, plus 86 subtests per version. - Owned one-CN MatrixOne instance: **43 online JSON tests passed per version**, including all 14 new cases. Fixture table/database cleanup and cluster shutdown verified. - Three unchanged online tests were separately reproduced on the exact unmodified base (3 failed, 29 passed) and explicitly deselected for these runs: `test_extract_with_filter`, `test_json_replace_only_existing`, and `test_filter_with_dict_syntax`. Existing raw-JSON/string comparison behavior and the numeric-mutation expectation are outside this member-path correction; the full online file is not claimed green. - Bound and literal-rendered SQL transport checks for nine independently specified paths, plus 64 independent expression trees compiled across four workers, passed on all three versions. - Configured fatal Flake8 checks over the SDK and changed tests, Black on all changed files, and `git diff --check` passed. - Go race instrumentation is inapplicable to this Python-only builder; CPython has no corresponding race detector. The bounded concurrent compilation check validates expression isolation. No Go production code changes. - Solution/design and final overall review use explicitly selected `gpt-6.1-sol` with `xhigh` reasoning. Remote CI remains pending. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
由 LW 授权的 ChatGPT Personal 智能体提交。
What type of PR is this?
Which issue(s) this PR fixes:
Related to #30765. No automatic issue closure is requested.
What this PR does / why we need it:
A valid JSON path such as
$."owner's"currently breaks the SQL statement because six JSON helpers construct a rawliteral_columnfrom the path. Keep paths as string values using SQLAlchemy's ordinaryliteral(path), letting the existing dialect/driver escape them. Explicitliteral_binds=Truecompilation still renders escaped literals. Ordinary binding also preserves SQLAlchemy 1.4 compatibility and executemany.The complete fix changes three files (+76/-14): the existing JSON helpers, their offline suite, and their online suite. No dependencies, generated source, kernel behavior or schema change. This is an ordinary R2 client encoding fix; no new state, cache, resource owner, protocol or feature design is introduced.
Verification
eac18da85008a93ae4b770a6f86bcd4af9e7e6d0; base: main57681d4d17a98146f5e722fabe3da4dfc3a7ddec. No exact upstream dev exists; main is used as explicitly authorized.Client.executeroundtrips:8541db1and final head have the identical completeclients/pythontreeb015c54087ab3fd340eeec402a451a3019dc26a2. The intervening base commits only alter kernel backup and UT scheduling; SDK source, dependencies, test oracles and SDK CI are unchanged. Evidence is reused under the repository's semantic-validity rule; final remote synchronization was independently fetched and explicitly Approve.4117c874feebbb7371a429b1ef432b410cf71094equals local fixed commitfc98f4c2307d438c62cc4ba119fd3af9f39988e4. Earlier tested head remains archived in the own fork. The verification workflow is only on an independent fork execution branch, not in this product PR.MatrixAdventurer/matrixone:fix/python-json-path-literals-20261022was updated, with an expected-SHA lease; no default branch was written. Issue [Bug]: Python SDK JSON paths containing quotes break SQL statement boundaries #30765 is assigned to actual login XuPeng-SH. PR assignee and requested reviewer XuPeng-SH have now been read back.由 LW 授权的 ChatGPT Personal 智能体提交。