Repository navigation
Description
DRAFT 17 (SDK, 2026-10-27) — to be filed
Title: [Bug]: _row_to_account parses SHOW ACCOUNTS with the wrong column layout — comment/suspended fields get foreign values
Description
BaseAccountManager._row_to_account (account.py:~215) maps SHOW ACCOUNTS rows positionally:
return Account(
name=row[0],
admin_name=row[1],
created_time=row[2],
status=row[3],
comment=row[4], # ← actually suspended_time
suspended_time=row[5], # ← actually db_count
suspended_reason=row[6], # ← actually tbl_count
)Actual SHOW ACCOUNTS output on current MatrixOne (verified against a live main build on 2026-10-26 during separate work; 10 columns today):
account_name | admin_name | created_time | status | suspended_time | db_count | tbl_count | size | snapshot_size | comments
Positional consequences:
| SDK field | receives |
|---|---|
comment |
suspended_time (a timestamp — or NULL for open accounts) |
suspended_time |
db_count (an integer!) |
suspended_reason |
tbl_count (an integer!) |
and the real comments column (position 9) is never read — user-visible account comments written via create_account(..., comment=...)/ALTER ACCOUNT COMMENT never round-trip through client.account.* reads. The Suspended_reason field the mapper expects isn't emitted by SHOW ACCOUNTS at all, so the model's field cannot be populated even in principle from this query.
Evidence path: Account objects built by get_account()/list_accounts()/create_account() (which re-reads via get) show comment=None for accounts that have comments (holding NULL/suspended_time instead), suspended_time=<int> type-nonsense, etc. Any app branching on status-adjacent suspended metadata or displaying comments gets wrong/garbage values silently.
Reproduction
client.account.create_account("acme", "admin", "pw", comment="ACME tenant")
acc = client.account.get_account("acme")
print(acc.comment) # None (not "ACME tenant") — real comment lives in row[9], unread
print(acc.suspended_reason) # <tbl_count int> / None — column never existedCross-check on any server: SHOW ACCOUNTS; headers vs. the positional claims above.
Impact
- The Account model's comment/suspended metadata surface is useless; quarantine/suspend ops UIs reading
suspended_reasonsee integers; commenting on accounts (exists server-side and via the SDK's own create/alter APIs!) silently disappears on read — the write side works, the read side lies. - Silent type nonsense (timestamps in comment slots) also violates the dataclass type hints, waiting to crash whatever consumes them with format assumptions.
- Any future server column additions/reshuffles will shift the misalignment again; positional parsing without name-based lookup is the structural cause.
Expected behavior
- Parse by column name (SHOW ACCOUNTS result metadata), not position — resilient to the server's column evolution (the SDK already consumes SQLAlchemy results elsewhere with
.mappingsupport;SHOWresults likewise carry names). - Fix the mapping to the real layout (comments at end; drop the never-populated
suspended_reasonor source it from wherever it actually exists, e.g. mo_account catalog query if SHOW doesn't expose it). - Regression: create an account with a comment, suspend it, then assert
get_account().commentandsuspended_timeread back correctly typed.
Activity
XuPeng-SH commentedon Oct 28, 2026
QA on merged SDK
da0c931aa7a230d51c866057d6cd302d4b83d3f8(#31527):tests/offline/test_account.pypassed 39 tests, including current ten-column SHOW ACCOUNTS fixtures and sync/async account operations. This verifies the fixed current-layout mapping offline; no live account was created or suspended.The original acceptance explicitly asks for column-name-based parsing resilient to reordered columns. The merged helper still reads positional tuples, so that requirement is not established by these tests. Live create/comment/suspend/readback also remains unverified here. Handing off to QA to verify the original contract.
Ariznawlll commentedon Oct 28, 2026
结论
测试不通过。当前服务的原始列布局已修复,但 issue 明确要求的按列名解析及列顺序变化时的正确映射仍未满足。
关键证据
main@72d99c85751dc5b9b7775cb50571e7efd6400487,包含已合入修复 fix(python-sdk): map SHOW ACCOUNTS columns by the server layout #31527;macOS arm64,隔离单进程 LogService / TN / CN,SDK 和实际服务来自同一源码,服务git_version()为72d99c8575。SHOW ACCOUNTS列名和值保持不变、仅将comments与suspended_time的位置互换,并包装为 SDKResultSet(columns, rows)后调用实际AccountManager.get_account():3/3 轮中预期评论expected comment,实际得到suspended timestamp;预期暂停时间suspended timestamp,实际得到expected comment。这是模拟未来服务列顺序变化的契约测试,不是声称当前服务实际输出了重排的列。9e29011e7313a57962adc00963baa659d1e81e37,在该 SHA 的 SDK 源码上重复上述模拟 3/3,字段仍然互换;真实服务账户读回的 3/3 仍对应此前72d99c…。get_account仍通过row[0]查找账户,因而未利用结果的列名。现有测试只覆盖当前布局,无法证明列位置变化后的要求。待解决点
gouhongshen commentedon Oct 28, 2026
Existing-fix audit
Assessment: partially fixed
Fixed evidence
Merged PR #31527, commit f7e89bc, corrects comments to index 9, suspended_time to index 4, and suspended_reason to None through a shared sync/async helper. Proof artifact: clients/python/tests/offline/test_account.py::TestAccountManager::test_get_account_maps_show_accounts_columns_by_layout. Subsequent QA reports successful live comment/suspension readback: #31394 (comment).
Remaining problems
gouhongshen commentedon Oct 28, 2026
Split follow-up for the un-fixed portion: #31603.
fix(python): unify SDK query and analytics lifecycle contracts (#31774)
fix(python): enforce CSV export format and preserve user account meta…
fix(python-sdk): unify SQL, transaction and driver boundaries (#31889)
XuPeng-SH commentedon Oct 30, 2026
新修复转 QA:#31889 已合入 main,合并提交
91dfab2132c4c4fcd3f9a115dbfa968b196b8b14。完整评论所指按列名解析follow-up #31603 已由当前main共享SHOW ACCOUNTS mapper及get/list账户名查找实现;#31889在已有#31802路径上新增缺失/新增/大小写/重复列合同测试,没有第二套mapper。
已核对 issue 正文、完整评论及当前合并源码/测试内容。历史失败按其原 SHA 保留;新修复直接覆盖上述残留,未发现适用于新修复的已验证反例或尚未完成的开发 follow-up。本轮仅源码/测试内容静态核对,没有运行 MatrixOne 服务或 SDK 回归;作者在 PR 内的运行结果是作者证据,不是本轮独立测试。转 Ariznawlll 继续验证,不代表验收通过。
QA 待验范围:sync/async get/list与create/comment/suspend真实读回、重排列、缺失可选/新增/重复/缺失必需列及账户名查找。
Ariznawlll commentedon Oct 31, 2026
结论
测试通过。
关键证据
main@4f894474ad10e1b9dc338868145a118a71c1fa23,修复 fix(python-sdk): unify SQL, transaction and driver boundaries #31889 在祖先链。tests/offline/test_account.py完整重复三轮共 81 passed;包含模拟 SHOW ACCOUNTS 重排列、大小写、缺失可选列、新增列、重复列、缺失必需列以及同步/异步账户名查找与用户归属。重排为模拟结果,不代表服务实际改变了列顺序。issue_31394_31603_account_mapping.py(提交0fc4ca2a),需显式启用 SDK 测试;该 PR 尚未合入,完整 suite 未运行。待解决点