Repository navigation
fix(core): 结构服务异常边界与写入读回尺寸校验(lingshu #1106,镜像 #1150 净增量) - #1155
Merged
Merged
Conversation
E02/E03:_receive 的 json.loads 包 RecursionError/JSONDecodeError、_send 的 json.dumps 包 RecursionError——深层 JSON(~2 万层)曾穿透 handler ⇒ 客户端 只收 EOF,无法区分成功与失败。现统一转 WriteError(业务可回执)。 E01':dispatch 补 Overflow/Recursion 边界(before_rowid=10**100 的 sqlite INTEGER 越界、occurred_at 时区越界的 astimezone——合法 JSON 触发的溢出)。 E01''(收发对称):structure_writer 新增 _require_readable——写入前按读取 视图估算响应尺寸,超 MAX_RECORD_BYTES(1MiB-4KiB) 即拒,保证「可写入 ⊆ 可读出」(改前 1MiB 内可写入但响应发不出 ⇒ 已提交但不可读)。 净增量镜像自 PR #1150(STARDUSTLC666 修复与守卫原样,其分支基线早于 #1138/#1143/#1146/#1153/#1154 直接合并会回退已合工作)。#1146 读超时预算 与 #1154 校验保持。守卫 10 条(E01/E02/E03 三钉 + B 组对照),基线 3 红、 修复后 10/10;变异 _require_readable 改名 E01 红。
Linux CI 红=#1106 守卫是脚本式(pytest 收集 0 件,test_gate_coverage 判 「两条腿都没走到」)。修法:包 test_ 入口进程内直调 _run_assertions() (E01/E02/E03 三钉+B 组对照),与 python -X utf8 直跑同判据。
This was referenced Oct 29, 2026
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.
Summary
修复 lingshu #1106 两现象(异常边界穿透 handler、1MiB 收发不对称),净增量镜像自 PR #1150(@STARDUSTLC666 修复与守卫原样):
dispatch补OverflowError/RecursionError边界(before_rowid=10**100的 sqlite INTEGER 越界、occurred_at时区越界的astimezone——合法 JSON 触发,曾穿透 handler ⇒ 客户端只收 EOF);_receive的深层 JSONRecursionError与JSONDecodeError统一转WriteError(业务可回执)。structure_writer新增_require_readable——写入前按读取视图估算响应尺寸,超MAX_RECORD_BYTES(1 MiB−4 KiB)即拒,保证「可写入 ⊆ 可读出」(改前 1 MiB 内可写入但响应发不出 ⇒ 已提交但不可读)。Tests
tests/test_issue1106_structure_service_bounds.py(253 行,来自 fix(core): structure_service 业务异常回执 + 写入前可读尺寸校验 #1150 原样:E01/E02/E03 三钉+B 组对照+E 组源码钉)—— 10/10(镜像分支);基线(合并前 main9746af3)3 钉红 ⇒ 鉴别力。_require_readable改名 ⇒ E01 红(直跑失败计数 1)后恢复。test_structure_writer/test_issue712/test_structure_read_deadline(fix(core): 结构写服务整帧读取共享超时预算(lingshu #1139,镜像 #1140 净增量) #1146)/test_structure_grant_arrays(fix(core): 服务启动时拒绝会拆分授权的字符串名单(lingshu #1132,镜像 #1132 净增量) #1153)/test_issue1107_structure_service_validation(fix(core): 结构服务启动校验三处收口(lingshu #1107,镜像 #1149 净增量) #1154)⇒ 33 passed,无回归。tools/verify_manifest.py --strict64/64,exit 0。