Repository navigation
ci: keep Python SDK changes on SDK CI and filter Iceberg checks - #31265
Conversation
…atrixorigin#31262) ## What type of PR is this? - [x] API-change - [x] BUG - [x] Improvement - [x] Documentation - [ ] Feature - [x] Test and CI - [x] Code Refactoring ## Which issue(s) this PR fixes: Closes matrixorigin#30242 Closes matrixorigin#31202 Closes matrixorigin#31203 Closes matrixorigin#31204 Closes matrixorigin#31205 Closes matrixorigin#31206 Closes matrixorigin#31207 Closes matrixorigin#31208 Closes matrixorigin#31209 Closes matrixorigin#31210 Closes matrixorigin#31211 Closes matrixorigin#31212 Closes matrixorigin#31213 Closes matrixorigin#31214 Closes matrixorigin#31215 Closes matrixorigin#31216 Closes matrixorigin#31217 Closes matrixorigin#31218 Closes matrixorigin#31219 Closes matrixorigin#31220 Closes matrixorigin#31221 Closes matrixorigin#31223 Closes matrixorigin#31224 Closes matrixorigin#31225 Closes matrixorigin#31226 Closes matrixorigin#31227 Closes matrixorigin#31228 Closes matrixorigin#31229 Closes matrixorigin#31230 Closes matrixorigin#31231 Closes matrixorigin#31233 Closes matrixorigin#31234 Closes matrixorigin#31235 Closes matrixorigin#31236 Closes matrixorigin#31238 Closes matrixorigin#31240 Closes matrixorigin#31242 Closes matrixorigin#31243 Closes matrixorigin#31244 Closes matrixorigin#31245 Closes matrixorigin#31246 Closes matrixorigin#31247 Closes matrixorigin#31248 Closes matrixorigin#31249 Closes matrixorigin#31251 Closes matrixorigin#31252 Closes matrixorigin#31253 Closes matrixorigin#31254 Closes matrixorigin#31255 Closes matrixorigin#31258 Closes matrixorigin#31259 Closes matrixorigin#31260 Closes matrixorigin#31241 Closes matrixorigin#31263 Closes matrixorigin#31266 Closes matrixorigin#31267 Closes matrixorigin#31276 Related to matrixorigin#30067 and matrixorigin#30069; this does not claim completion of their broader scope. ## What this PR does / why we need it: The Python SDK had divergent sync/async SQL construction, incomplete transaction ownership and manager APIs that could silently return incorrect data or partially apply batches. This consolidates those boundaries and adds native-result, failure, cancellation and dependency-version contracts. - Share typed SQLAlchemy bind compilation, boolean grouping, alias handling and snapshot validation. Preserve main's UPDATE/DELETE ORDER BY and LIMIT behavior, including LIMIT 0. Reject unsupported ambiguous forms before execution. - Retain direct legacy Query execution and mapped attribute/projection results. Resolve one schema/table/alias target for SELECT, UPDATE and DELETE, including async sessions; reject conflicting database targets and unsupported joined mutations before dispatch. Preserve recursive CTE intent, expose AsyncClient.export and allow safely rendered fulltext SQL to compose through exports and logical_in. - Preserve native Decimal binding and render Decimal literals as bounded fixed-point tokens, keeping adjacent high-precision values distinct in read/update/delete predicates; reject excessive exponent expansion before formatting. - Establish explicit server transactions and pool-owned physical connection initialization. Preserve cancellation and primary errors during rollback, close and scoped fulltext-setting restoration. Fix aiomysql pre-ping on SQLAlchemy 2.0.43. - Make Pinecone batches validate before mutation and execute atomically; require an unambiguous primary key. Correct vector metric selection, numeric values, metadata and duplicate result labels. - Correct snapshot/publication/Stage/PITR catalog readback, LOAD option propagation, reflected index parsing and metadata aggregation. CSV relations detect changed observed schemas; LOCAL INFILE now requires explicit opt-in. - Make public fulltext group() emit one required positive OR group; reject branch structures that cannot preserve membership. Check each mapped server file using bounded DATALINK reads at construction, before scanning, at true stream EOF, and before import commit. - Isolate capability observations per connection generation. Treat version banners as descriptive rather than assuming feature support. Remove duplicated async snapshot implementation and unsafe transaction examples. - Replace global dependency mocks with real dependency contracts, add a runner that rejects skipped/empty required suites and records provenance, and retain SQLAlchemy compatibility coverage; workflow configuration is delivered separately. Core installation remains independent of Arrow. ### Validation - Offline suites rerun after the SQLite fixture correction: SQLAlchemy **1.4.54: 1958 passed**, **2.0.43: 1954 passed**, **2.1.6: 1962 passed**, each with **95 passing subtests**, zero skips. The documentation regression parses the AsyncSession examples in `README.md`, `README_USER.md` and `docs/quickstart.rst`, and rejects the prior same-session `asyncio.gather(session.execute(...))` pattern. - MatrixOne **4.2.5** (`git_version=1a44f3d`): **70 required native contracts passed, zero skips**. Source server **v20261026**, actual binary **305be60de8** built from main **83c1e23526**: **70 passed, zero skips**. Later kernel merges were not rebuilt or claimed as tested. - [Portable execution reports](https://github.com/matrixorigin/matrixone/blob/898ee8afcb0fb23d3086dd416c83d3010b58ef9b/clients/python/docs/validation/README.md) record the source/test/config fingerprints, observed server identities, exact test selections and native JUnit results for the implementation before the final documentation correction. The final change adds only three documentation examples and one offline AST test; it does not modify SDK runtime code. The complete offline matrix above was rerun again after the SQLite fixture correction described below. - Native assertions cover exact exported rows, recursive CTE results, legacy projection mapping, schema-qualified writes, async client/session database isolation, rejected joined writes, safe fulltext composition, mapped-file completion and EOF/precommit rollback. Pool ownership and connection reuse are checked after failures. - Changed Python Black checks, whole-SDK fatal flake8 and four shared-helper mypy checks passed. The changed literal helper has the same two pre-existing Optional-iterator mypy diagnostics as the clean baseline, with no introduced findings. Wheel/sdist build and twine checks passed. Earlier clean Python 3.8/3.9 core import checks without Arrow apply to the unchanged import graph. - Python has no Go-style race detector; no Go files change. Deterministic async cancellation, physical close-once, atomic rollback, error precedence and pool-reuse tests cover the existing lifecycle mechanisms across the three SQLAlchemy versions. - The 57 linked issues were audited individually against concrete regression assertions: 186 issue-to-test references across 115 distinct JUnit case IDs were checked against the three final offline reports and both native reports, with zero missing references and no failures/errors/skips for the mapped cases. Shared cases cover related issue triggers; this does not mean 57 independent test suites. matrixorigin#31246's initial ZoneMap behavior is covered, while its ALTER+UPDATE/CLONE statistics variants are not individually exercised. matrixorigin#31223's offline case distinguishes IVF/HNSW ownership, but native vector cases cover two IVF indexes rather than native HNSW. - Prior-head GitHub CI for `5fbb1bc564aefc1f9059236646fe61faef32019e` completed successfully ([run](https://github.com/matrixorigin/matrixone/actions/runs/40311220191)): all six Python SDK offline matrix jobs, CI preflight and CI Required passed. Online/native and kernel/coverage jobs were skipped by SDK-only routing; the separate Iceberg adapter tidy job passed, while Iceberg E2E Local was skipped. The retained local native JUnit reports predate the documentation and SQLite fixture corrections; neither correction changes SDK runtime or native tests. CI for the updated head is pending. ### Review correction: portable schema-routing oracle The legacy `Query.first()` retains `LIMIT 1`. Reusing that Query for an UPDATE made the schema-routing offline test depend on SQLite's optional `ENABLE_UPDATE_DELETE_LIMIT` extension. The mutation now uses a fresh legacy Query, preserving every schema-routing, row-value, default-table isolation and deletion assertion. MatrixOne UPDATE/DELETE LIMIT semantics remain unchanged. - Before correction: reproduced the sync failure on Python 3.11.14 / SQLite 3.50.4 without the extension; async control passed. - After correction: complete offline suites on SQLAlchemy 1.4.54 / 2.0.43 / 2.1.6 passed with 1958 / 1954 / 1962 cases, respectively, plus 95 passing subtests per suite; zero failures/errors/skips. Existing mutation LIMIT/order and lifecycle/cancellation cases remain included. - Incremental static checks: repository Black configuration and fatal flake8 (`E9,F63,F7,F82`) passed for the changed test module. No Go code changes; Go race is not applicable, and Python has no equivalent Go race detector. - Reused native evidence was reconciled against all 214 recorded source/test/config inputs before this correction; the only changed input afterward is this offline test. No new server qualification or throughput improvement is claimed. The repair adds one ordinary test-only Query object and no service, I/O or additional test case. ### CI routing This PR changes only `clients/python/**`. The SDK workflow configuration enhancement is split into supporting CI PR matrixorigin#31265, so the existing trusted classifier selects **scope=sdk** and omits kernel UT/BVT/coverage. The new AsyncSession documentation regression is under `tests/offline`; the existing issue contract tests remain under `tests/offline/contracts` and `tests/online`, selected by the existing trusted SDK workflow. The supporting CI change also filters the independently triggered Iceberg workflow; that filter only takes effect after it enters the trusted base. ### Compatibility and cost Decimal literal expansion is capped at 4096 characters before allocation. The native report records a 4.2.5 limitation for some 38-fractional-place literal values; no SDK workaround changes server semantics. Both native release and source targets are tested explicitly; these results do not imply support for every historical MatrixOne release. LOCAL loading now defaults off. Invalid/ambiguous IDs, metric names, duplicate vector labels, conflicting explicit database targets, joined UPDATE/DELETE and unsupported snapshot/fulltext syntax raise instead of silently producing misleading results. Stage ALTER IF EXISTS returns None when absent. Vector metadata is refreshed with two reads per query. Explicit per-column metadata statistics require sequential scans proportional to the observed column count; wildcard metadata retains its fast path. Upsert performs whole-batch validation before its transaction. CSV inference is bounded and cannot guarantee an immutable file after validation. Submitted COMMIT outcomes are not retried or represented as guaranteed rollback. Details and reproduction commands are in clients/python/TESTING.md and the design documents. Mapped file checks add O(number of explicit files) bounded reads per validation point and reuse the active stream/write connection. They require native DATALINK read permission and do not pin object versions. A removed-and-restored file between checks may evade detection; emitted stream batches cannot be retracted after a terminal error. Unsupported URI/glob forms raise before execution. Fulltext group() supports positive word/prefix branches; conjunction/exclusion/phrase/nested branches are explicitly rejected. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1846409 to
cb48181
Compare
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: 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: cb4818119c21e807a0a4919b4a8bda462fb1dad4
Assessment: approve
Reviewed all six changed files, callers, responsibility owners and the complete frozen discussion. The design appropriately reuses existing routing and contract validation, preserves checkout trust, and separates required tests from optional analytics. No actionable defects remain. Both discussion items are informational; the required assessment ledger is saved.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
Validation:
-
38 CI owner tests passed, including routing, checkout policy and database guard coverage.
-
Installed-package smoke checks passed on Python 3.8 and 3.9.
-
Python 3.12 with SQLAlchemy 2.0.43: 1,954 offline tests and 95 subtests passed without skips.
-
Separate analytics execution: 60 passed, 189 expected online-only skips. Three invalid target configurations were rejected before connection.
-
Workflow lint passed after excluding the unchanged, deliberately disabled Iceberg E2E condition. JavaScript syntax and diff checks passed.
-
Reconciled receipts, retained logs, SDK provenance, JUnit results and 347 source hashes. Source remained unchanged. Evidence is recorded in /home/xupeng/.local/state/mo-bot/jobs/3805f4c040547b0b8faf01a4/attempt-1/validation-audit.json; final audit receipt: checks/1793029232459645698-5.json.
Limitations:
-
Trusted workflow changes activate after merge; post-merge routing and live online targets were not exercised. Existing remote SDK checks do not prove execution of the new workflow steps.
-
Online environments require configuration; no live-server certification is claimed. Documented GitHub native path-filter limits are accepted.
-
Unchanged matrix cells were not all repeated locally. Actionlint external shellcheck/pyflakes integrations were disabled. Cancelled or pending CI is not counted as passing.
-
Expected CI savings were not benchmarked. Added costs are one offline matrix cell and two core smoke jobs; database runtime paths are unchanged.
What type of PR is this?
Which issue(s) this PR fixes:
Related to #31259 and #31260; CI follow-up to the merged Python SDK quality PR #31262.
What this PR does / why we need it:
Python SDK workflow-only edits currently select full kernel CI, while the independent Iceberg module-tidy workflow runs on unrelated SDK/docs PRs. Route the exact SDK workflow path through the existing SDK classifier and filter Iceberg checks to Go production/test, module/workspace and native/build dependency inputs. Mixed changes, both rename paths, incomplete inventories, unknown inputs and forced-full requests retain conservative SDK/kernel routing.
The SDK workflow reuses the merged
scripts/run_contracts.pyto record source/dependency/server provenance and reject empty or skipped required contracts. It adds a SQLAlchemy 2.0.43 regression cell and Python 3.8/3.9 installed-core smoke checks, with existing analytics checks and distribution validation retained. Offline fork checkout stays immutable, hosted, read-only and credential-free; no inherited secrets or untrusted classifier override is introduced.Online jobs remain manual-only, with explicit 4.2.5/current-source targets. Configuration validation stays owned by the contract runner; only the extended suite's database requirement is checked separately. Update the existing SDK CI guide with both environments, version/revision identities, shared export directories and qualification limits. Replace the test-only glob engine with a direct configuration contract; GitHub owns native matching semantics.
Validation
Validated against base/merge-base
28e8760905a7f39dba2ce436357ea75492f30512, which includes #31262 and its required runner:node --test .github/ci/*.test.cjs: 38 passed, zero skipped. Includes routing/rename/incomplete-inventory/aggregate/trust boundaries and actual Bash execution of the database guard for configured/missing values.git diff --checkand actionlint 1.7.12 passed on all three changed workflows. The local actionlint configuration admits the existing custom runner label; the existing deliberately disabled Iceberg E2E constant-false diagnostic is excluded. External shellcheck was unavailable.twine checkpassed.Design and final review use actual
gpt-6.1-solwithxhighreasoning. No database services or existing data were touched by this follow-up.Deployment and activation limits
The branch includes merged #31262 through rebase, so its new workflow calls a runner present in the tested source tree.
pull_request_targetcontinues loading workflow/helper code from the trusted workflow revision; new routing and execution rules activate after merge, not through an untrusted PR-head override.The
matrixone-sdk-4.2.5andmatrixone-sdk-current-sourceenvironments are not configured in the repository. This PR provisions no environment, runner, server or credentials and does not dispatch online tests. The two-target online matrix is an execution capability until explicitly configured and run, not evidence of online certification. Extended-suite skips are reported separately.Iceberg's native path filtering is a best-effort optimization subject to GitHub's diff limits; it does not inherit the SDK classifier's complete-inventory fallback. The local path test verifies configuration, not GitHub's matching implementation. Existing cancelled CI is not claimed as passing; new remote CI remains pending after publication.