Conversation
- extension-protocol 新增 cell_number 读取器:CellValue 的 i64 / u64 / f64 `value` 序列化仍只发 JSON number,读取时接受等值的十进制 / 浮点文本; 无法解释的文本("abc"、给 u64 传 "4.5")仍报错,不静默降级成别的类型 - 修 issue #249 / #207:MySQL 文本协议驱动按声明类型把 BIGINT UNSIGNED 列还原成十进制文本({"type":"u64","value":"4"}),宿主严格按 number 解析 时报 `invalid type: string "4", expected u64`,整张表都读不出来 - 三个读取器都处理 serde_json 的 arbitrary_precision 分支:该 feature 下浮点 与超范围整数走私有 number map 进 visit_map,漏掉会把 1.5 误判成对象 验证:cargo test -p extension-protocol(212+ 全绿)、cargo test -p db(1302 全绿)、 cargo clippy -p extension-protocol -p db --all-targets 无新增告警; 摘掉 u64 读取器后 db 与 protocol 两个回归测试均复现 issue 原始报错。
Owner
Author
|
驱动侧根因修复已提:feigeCode/navop-extensions#9 —— 本 PR 保留为宿主兼容层:容忍已发布的老驱动继续发十进制文本,两边可独立发布。 复现链路与影响面: |
Owner
Author
|
撤回这个 PR:根因已在契约侧修掉,宿主不再需要为旧驱动做读取容错。
理由:宿主只判断「是否已安装」时不校验版本,而旧驱动既不会被自动更新、宿主也没有任何提示,用户只能看到 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #249
Description
MySQL (text-protocol) drivers classify
BIGINT UNSIGNED/INT UNSIGNEDcolumns asu64cells, but encode the value as a decimal string on the wire —{"type":"u64","value":"4"}— while the host protocol crate (extension_protocol::row::CellValue::U64) only accepted a JSON number. Deserializing the driver response therefore failed withand the whole table could not be loaded. Issue #207 is the same root cause.
This PR makes the host tolerant at its wire boundary, so already-released drivers keep working without a driver update:
crates/extension-protocol/src/cell_number.rs: readers for thei64/u64/f64cellvalue. Serialization is unchanged (still a JSON number); deserialization now also accepts an equivalent decimal / float text. Decimal text is lossless on the host side (u64::MAXround-trips exactly)."abc","4.5"foru64, a plain JSON object) still fails with a clear serde error — no silent downgrade to another type, so a really broken driver is not masked.serde_json'sarbitrary_precisionfeature (enabled workspace-wide): floats and out-of-range integers arrive through serde_json's private number map (visit_map) instead ofvisit_f64/visit_u64, so all three readers implement that branch too (otherwise a plain1.5would be misread as "an object was sent").CellValuewires the readers onto its three numeric variants; the wire contract itself is unchanged for numbers.How to Test
cargo test -p extension-protocol— library (212 tests) and integration suites pass.cargo test -p db— 1302 library tests pass, 0 failed.cargo clippy -p extension-protocol -p db --all-targets— no new warnings on the touched files.cell_numberunit tests: number vs decimal text,u64::MAX, out-of-range integer, non-numeric text, object payload.row.rswire-level test: text-encodedu64/i64/f64cells, a nestedarraycell, and the plain-number form (guards against regression).crates/db/src/ipc/connection.rs::cursor_fetch_accepts_unsigned_cells_encoded_as_decimal_text— replays the reported driver payload throughCursorFetchOutput→CellValue::U64 { value: 4 }→DbValue::Unsigned("4").u64reader makes both regression tests fail with the issue's exact errorinvalid type: string "4", expected u64.Checklist
cargo runfor story tests related to the changes.