Repository navigation
fix(core): structure_service 输入校验收口——参数类型错误不再谎报 StorageError - #1149
Closed
STARDUSTLC666 wants to merge 2 commits into
Closed
STARDUSTLC666 wants to merge 2 commits into
STARDUSTLC666 wants to merge 2 commits into
Conversation
- event_history/structure_history:limit 必须是 1..200 整数(bool 也拒), before_rowid/before_revision 必须是正整数或 None;不再让 SQLite 类型序把 字符串游标判为恒真(静默回第一页)、NaN 绑 NULL、超大整数 OverflowError。 - get_proposal/target_status/approve/review 的 id/aggregate_key 过 _text; review(note=None)、propose(event_id='')、record_version_result(instance_id=123) 等不再穿透成 sqlite3.IntegrityError/ProgrammingError。 - load_service 的 grant 解析提取为 _parse_grant:capabilities/instances 必须是 字符串数组;字符串不再被 frozenset() 拆成单字符集(授权面反转),缺字段/ 非数组启动即拒(fail-closed)。 - 新增 tests/test_issue1107_structure_service_validation.py:24 断言 + 3 定点变异; 基线 2/24、修复后 24/24;structure 相关回归 49 passed / 2 skipped。
FuRongJun-1999
added a commit
that referenced
this pull request
Oct 29, 2026
Linux CI 红=#1149 守卫是脚本式(pytest 收集 0 件、未列 SCRIPT_TESTS, test_gate_coverage 判「两条腿都没走到」)。修法:包 test_ 入口进程内直调 _run_assertions()(断言组 24 检查),与 python -X utf8 直跑同判据。
Owner
维护侧处置(值守第 162 轮):净增量已镜像合并,关闭指向你的 #1107 三处校验(E01 本端读数:守卫 关闭指向 #1154。感谢高质量修复——「登记成功、step 才抛」的时序问题定位准确。 |
Owner
|
处置见上帖——关闭指向已合并修法。感谢贡献。 |
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.
修复 #1107(medium×3,
core/structure_service输入校验缺口):改了什么 / 为什么
event_history/structure_history:limit必须是 1..200 的整数(bool也拒),before_rowid/before_revision必须是正整数或None。旧实现靠max(1, min(limit, 200))静默归一,字符串游标在 SQLite 里因类型序恒真(静默回第一页),NaN绑成 NULL,超大整数OverflowError。get_proposal/target_status/approve/review的proposal_id/aggregate_key过_text;review(note=None)要求note是文本;propose(event_id='')、record_version_result(instance_id=123)等参数类型错误在进入 SQL 前抛WriteError。load_service的 grant 解析提取为_parse_grant:capabilities/instances必须是字符串数组;字符串不再被frozenset()拆成单字符集(授权面反转),缺字段/非数组启动即拒(fail-closed)。验证方式与读数
3552ec3limit=2.5/TrueWriteError(点名 limit)before_rowid='abc'WriteError(点名 before_rowid)before_rowid=10**100WriteError(越界)get_proposal({})WriteError(proposal_id)review(note=None)WriteError(note)instances='instance-1'capabilities具名反面对照(--mutate)
event_history的limit整数校验 ⇒ A01/A02/A03 红。instances数组校验 ⇒ B03/B04 + E03 红。review的note类型校验 ⇒ A13 + E02 红。三条变异各自恰好命中期望红集;变异后源码字节级还原。
边界与不做项
limit越界(如 1000)从「静默钳制到 200」改为「结构化拒绝」;before_rowid非整数从「静默回第一页」改为拒绝(issue 期望行为)。capabilities仍是字符串集合、instances仍是实例集合;只收类型。OverflowError/RecursionError回执与 1 MiB 收发不对称(另案)。Fixes #1107