Skip to content

fix(python-sdk): preserve mutation state when cloning SQL builders - #30877

Merged
mergify[bot] merged 2 commits into
matrixorigin:mainfrom
MatrixAdventurer:fix/python-builder-clone-mutations-20261022
Oct 22, 2026
Merged

mergify[bot] merged 2 commits into
matrixorigin:mainfrom
MatrixAdventurer:fix/python-builder-clone-mutations-20261022

Conversation

@MatrixAdventurer

@MatrixAdventurer MatrixAdventurer commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

由 LW 授权的 ChatGPT Personal 智能体提交。

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Related to #30876. No automatic issue closure is requested.

What this PR does / why we need it:

MatrixOneSQLBuilder.clone() resets the operation to SELECT and omits INSERT/UPDATE payloads. Executing a cloned write therefore reads rows without performing the intended mutation; adding values()/set() to the clone also raises a wrong-operation error.

Copy the existing operation type, INSERT columns/row containers and UPDATE SET state. Preserve current parameter-value semantics: builder containers are independent, arbitrary user values are not deep-copied. SELECT and DELETE retain the existing query-clause copying. No new state owner, dependency, generated file, server behavior or API signature.

Two files, +78/-0. The existing test file now exercises actual public-builder SQL using a tiny disposable native SQLite DBAPI table: INSERT, bulk INSERT (including NULL), UPDATE, DELETE and SELECT in both binding/substitution modes; independent additions/reset; and bulk input aliases.

Verification

  • Base main cf48adddcda41c2ae754904af76b034a83b83163; remote head 28ed91a784de1994f797de07c79ac4f99a287474; full tree 8ba3e0937972b582946d1b4c4ef5f6639c9879a2 equals tested local commit b9e9145c9ab24629aa61279cf1793b09e93e3ced.
  • Python 3.12.14 / SQLAlchemy 1.4.54. Original production with the initial 12 regression cases: 10 failed /2 passed, including actual unchanged table state after all cloned write forms. Final regression: 13 passed; complete owning test file: 51 passed.
  • Final complete offline command PYTHONPATH=. python -m pytest tests/offline -o addopts='' -q --tb=short: 1311 passed +86 subtests, 3 existing warnings, zero failed/skipped.
  • Fatal Flake8 E9,F63,F7,F82, git diff --check, wheel/sdist build and Twine checks passed. Required packaging tools were installed in an isolated workspace environment; no repository dependencies changed.
  • Independent review agent explicitly Approve on the complete final two-file delta; independently reproduced original/fixed behavior and executed all 13 regressions and all 51 owning tests.
  • Ordinary R2 query-generation bug fix; design exemption applies. No concurrency, waits, persistent format, distributed lifecycle or new authority. Tests close their owned connections in finally. No kernel BVT is added because no server SQL/protocol contract changes; native SQLite proves emitted ordinary SQL behavior. No live MatrixOne/full online certification is claimed.
  • Upstream MatrixOne ALL CI #39809700496 passed all six SDK Python/SQLAlchemy matrix jobs and CI Required on this exact head. Offline suites and wheel/sdist validation succeeded in every cell; the configured fatal-Flake8 cell succeeded. Kernel/manual-online jobs were intentionally skipped, not claimed passed. PR is ready for review.
  • Freshly verified authenticated MatrixAdventurer id85048713, own-fork parent relationship and push permission. No exact dev exists; main uses explicit user authorization. Only own-fork feature branch fix/python-builder-clone-mutations-20261022 was created; no upstream/default ref is written.
  • Issue [Bug]: Python SQL builder clone turns INSERT/UPDATE/DELETE into SELECT #30876 actual assignee XuPeng-SH was read back. After required CI passed, the PR was marked ready, assigned to XuPeng-SH and review requested from XuPeng-SH; actual metadata readback is recorded below. Branch/commit/PR operations and read-only verification are by the signed execution subject. No merge, deployment or automatic issue closure.

由 LW 授权的 ChatGPT Personal 智能体提交。

Copy the existing operation, INSERT row containers and UPDATE SET state. Add real SQL result and copy-isolation regressions. Related to matrixorigin#30876.

由 LW 授权的 ChatGPT Personal 智能体提交。
@mergify mergify Bot added kind/bug Something isn't working kind/test-ci labels Oct 22, 2026
@MatrixAdventurer
MatrixAdventurer marked this pull request as ready for review October 22, 2026 15:59
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

Copy link
Copy Markdown
Contributor Author

由 LW 授权的 ChatGPT Personal 智能体提交。

固定交付记录:head28ed91a784de1994f797de07c79ac4f99a287474,base main cf48add,产品tree8ba3e0937972b582946d1b4c4ef5f6639c9879a2与本地已测/独立Approve commit b9e9145c9ab24629aa61279cf1793b09e93e3ced相同。2文件+78/-0。初始12case实际RED10failed/2passed;补bulk-input容器别名后最终13/13,owningfile51/51,完整offline1311+86subtests。fatal Flake8、sdist/wheel及Twine通过,已核对打包wheel含最终clone字段修复。独立review完整覆盖全部最终delta,并独立执行原始/修复对照、13focused及51owning测试,明确Approve,无阻塞。

上游正式CI https://github.com/matrixorigin/matrixone/actions/runs/39809700496 :六个SDK矩阵job和CI Required均SUCCESS。原始日志已读取:SA1.4为1311、SA2.0为1307、SA2.1为1315,均+86subtests,所有包校验PASSED。Iceberg adapter module tidy SUCCESS,kernel/BVT/upgrade/full-online按配置SKIPPED,不声称覆盖。此为当前固定源码的执行证据;ready事件可能重新触发同源码CI,不将排队运行说成已完成。

已转ready、assign XuPeng-SH、request reviewer XuPeng-SH,读回draft=false、PR assignee包含XuPeng-SH、requested reviewers包含XuPeng-SH(另有自动aptend),正文内容与实际发送一致并保留模板/LF。Issue30876 assignee此前已读回。本人fork关系/权限和无dev的main fallback已实时核实;maintainer_can_modify实际True。所有fork feature分支/commit/Issue/PR创建、ready、指派、审阅请求及只读核验均由本署名主体执行。未推上游/default分支,不合并、不部署、不自动关闭Issue。

@XuPeng-SH

XuPeng-SH commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-xupeng · done

Commit: 28ed91a784de1994f797de07c79ac4f99a287474

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-xupeng · review

Commit: 28ed91a784de1994f797de07c79ac4f99a287474

Assessment: approve

Reviewed the complete two-file delta, callers, ownership, error paths and test quality. Cloning preserves mutation state and independent builder containers while retaining shallow parameter semantics. No actionable defects found.

Model: gpt-6-astra / xhigh

Session: 01a14d34-4e51-79a3-a62d-6c9c16279dc8 · slot 0 · generation 0

Validation:

  • Owning test file: 51 passed, including all 13 new regressions, on Python 3.13.5 and SQLAlchemy 2.0.55.

  • Additional probes passed for incomplete-write validation, independent completion/reset/predicates, parameter identity and SELECT clauses. Base controls reproduced mutation clones becoming SELECT.

  • An initial existing-test failure caused by missing dialect registration was resolved by installing the pinned SDK package; the complete owning file then passed.

  • Preflight and git diff --check passed. Source remained unchanged. Commands, source fingerprints, exits and retained logs reconciled in /home/xupeng/.local/state/mo-bot/jobs/01f0cdec1579863129c81628/attempt-1/evidence-audit.json.

Limitations:

  • Full offline suite and live MatrixOne tests were not rerun locally. SQLite validates emitted ordinary SQL, not MatrixOne server behavior.

  • Captured CI statuses show six successful SDK matrix cells, but raw CI/author logs were unavailable for independent reconciliation.

  • Linked issue #30876 text was absent from supplied evidence; its behavioral contract was assessed from the PR description.

@mergify mergify Bot added the queued label Oct 22, 2026
@mergify

mergify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-22 17:24 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-10-22 17:51 UTC · at eb2168fa473516a5a05538186c5250d48b5ded20 · squash

This pull request spent 27 minutes 34 seconds in the queue, including 1 minute 51 seconds running CI.

Required conditions to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working kind/test-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants