Repository navigation
fix(python): quote JSON object keys in bracket access - #30871
Conversation
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? |
|
mo-bot review · Commit: "interrupted" |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: dcf46bdbd5a7a9fd65b23f4ea73869380d98ee2c
Assessment: approve
Reviewed the complete three-file delta and affected callers. The design correctly centralizes literal-member encoding in JSONPathElement, preserves SQLAlchemy binding, and restores projection dependency and identity contracts. Tests distinguish literal keys from traversal syntax and cover reuse, Unicode, controls, missing values and typed consumers. No actionable introduced defects remain.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
Validation:
-
Focused offline suite: 80 passed on CPython 3.12.12 / SQLAlchemy 2.0.43; receipt checks/1792682441663253884-3.json matches json-offline-current.log and JUnit results.
-
Real MatrixOne integration: head produced 43 passes and three failures; exact-base SDK/tests produced 29 passes and the same three failures. A second head run excluding those baseline failures passed all 43 cases. Fixture table and database cleanup verified. Receipt checks/1792682574644492789-12.json matches online-driver.jsonl and retained Python logs.
-
Private-runtime preflight passed. Native provenance matched 200 current source inputs and five build outputs before integration execution.
-
Reused frozen exact-head CI successes for offline SQLAlchemy 1.4, 2.0 and 2.1 configurations; pending and skipped checks were not counted as passes.
-
Source remained unchanged. Commands, fingerprints, exits, logs and 54 exact-base files were reconciled in /home/xupeng/.local/state/mo-bot/jobs/0a0fca83a48652fb3c5fec48/attempt-1/validation-audit.json; review rationale is retained alongside it in review-notes.json.
Limitations:
-
The full online file is not green: test_extract_with_filter, test_json_replace_only_existing and test_filter_with_dict_syntax fail identically on base and head.
-
Fresh local online validation covered SQLAlchemy 2.0.43. Author-only results without retained artifacts were not treated as independently verified evidence.
-
No performance benchmark was run. Added work is proportional to key length during construction and initial quoted-path parsing; existing constant-path caching preserves per-row traversal behavior.
-
Linked issue text was not supplied; its behavioral contract was assessed from the frozen PR description and reproductions.
What type of PR is this?
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, whiledata["x.y"]silently reads nestedx.yinstead of the literal member namedx.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_subqueryoverride. 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):
test_extract_with_filter,test_json_replace_only_existing, andtest_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.git diff --checkpassed.gpt-6.1-solwithxhighreasoning. Remote CI remains pending.