Repository navigation
refactor(testing): slim cli_output_differential to zero-Any typed modules - #9445
Conversation
…ules Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · Gemini · Google · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
本次审核在独立干净 detached worktree(/tmp/rev-9445-f532daa1)中对 PR #9445(codex/slim-cli-output-differential-zero-any-20261126 -> main,精确提交 f532daa1953dfbffa45542989f358128dbdab7c1,实际分叉与目标基线 50aa5b4fd1c88b7225fc30e58423120e3ad5d426)完成了全量基线对比、58 项符号再导出校验、配对语义与畸形输入反例实验、ruff 与 strict mypy、跨调用方 mypy、TS 控制面静态与单测、2,883 项跨套件 pytest 以及 Goal loopx check / canary premerge / change-quality 验真。PR #9445 无阻断缺陷,所有新增/拆分文件均实现 Zero-Any 且低于 525 行。
动机 / Motivation
当维护者与预合并门禁通过 compare_cli_output_receipts、select_cli_output_base_ref 以及 cli-output-base-head-differential-smoke.py 校验代理 CLI 热路径与冷路径输出退化时,此前单个 loopx/control_plane/testing/cli_output_differential.py 已增长至 1,412 行并包含 59 处 Any 注解,规则表、迁移条件、载体契约与行对比逻辑混杂在同一文件中且authoring_inputs 等字典读取缺乏先期映射校验。在基线提交 50aa5b4fd1c88b7225fc30e58423120e3ad5d426 上,未触发对应 surface 条件分支的异常非映射 authoring_inputs (如字符串 "bad")会在 _authoring_input_migration 短路后静默放行,而错把 turn_plan_controls.field_sha256 设为字符串时会在 _compare_row 直接抛出裸 AttributeError: 'str' object has no attribute 'keys';同时单文件超过千行且依赖 59 个 Any,无法通过控制面 strict mypy 与 Zero-Any 约束。在当前提交 f532daa1953dfbffa45542989f358128dbdab7c1 中,代码按内聚边界拆分为四个严格零 Any 且均不超过 520 行的模块,并经由 tuple_field、mapping_field、shape_paths 与 _rows_by_id 对非映射/非可迭代输入显式抛出确定性 TypeError / ValueError,配对对比 58 项基线常量/函数导出与核心迁移行为完全一致。当前提交在不新增任何顶层 loopx/*.py 文件(维持 112 个)、不修改 docs/development/module_metric_baseline.json 且保持默认 cli_output_differential.py 全部 58 个符号与兼容再导出的前提下,将单模块瘦身为 510 / 511 / 520 / 372 行的零 Any 类型安全组件并新增 184 行契约测试;未在此次拆分中修复历史 smoke 脚本 cli-output-base-head-differential-smoke.py 既有的两处裸 dict mypy 注释与预存在 quota_should_run 基线字符超限问题,亦未将str(作为 Python Iterable)额外视作非法可迭代序列(保持与基线 tuple/set 解析兼容)。
改动思路 / Approach
cli_output_differential.py (510 LOC: 编排入口 + 58 项显式 as 兼容再导出)
├─ cli_output_differential_allowances.py (511 LOC: Schema 常量、Metric/TypedDict、tuple_field/mapping_field/shape_paths/_rows_by_id/_removed)
├─ cli_output_differential_migrations.py (520 LOC: _none_to_single_version_migration、_schema_migration_state、_complete_quota_source_migration)
└─ cli_output_differential_carriers.py (372 LOC: _task_step_read_fence_migration、_authoring_input_migration、_continuation_instruction_migration、_turn_projection_migration)
说明(基于精确提交 f532daa1953dfbffa45542989f358128dbdab7c1 源码推导,非运行时覆盖率追踪):cli_output_differential.py、cli_output_differential_allowances.py。
将常量/类型/基础字段解析(cli_output_differential_allowances.py)、schema 迁移判定(cli_output_differential_migrations.py)、carrier/Stride 迁移限额(cli_output_differential_carriers.py)与差异汇总编排(cli_output_differential.py)按变更耦合度解耦,并用显式 as 再导出保持既有导入零破坏,并且以无状态纯函数(tuple_field、mapping_field、shape_paths、_rows_by_id)替代原本散落且隐式 or []/or {} 容错读取,在入口处显式 fail-closed 拦截畸形结构;仅围绕 cli_output_differential 拆分四个低于 525 行的零 Any 模块及对应契约单测(当前 PR 边界),复用现有 Metric、GrowthAllowance 与 JsonObject 类型所有权;调用端历史遗留的 cli-output-base-head-differential-smoke.py:134,141 mypy 旧错误与上游 cli_output_budget 预存在基线字符数均保留在独立后续边界内处理,不扩面夹带无关改动。
具体改动 / Changes
精确提交 f532daa1953dfbffa45542989f358128dbdab7c1(相对基线 50aa5b4fd1c88b7225fc30e58423120e3ad5d426 共改动 5 个文件,+1,856 / -1,171 行,1/1 DCO 提交):将原本 1,412 行、59 处 Any 的 cli_output_differential.py 拆分为 cli_output_differential.py(510 LOC)、cli_output_differential_allowances.py(511 LOC)、cli_output_differential_migrations.py(520 LOC)与 cli_output_differential_carriers.py(372 LOC),并新增 tests/control_plane/test_cli_output_differential_contract.py(184 LOC)。经 AST 扫描全部 5 个文件均为 0 个 Any 与 0 个 type: ignore,顶层 loopx/*.py 保持 112 个且 module_metric_baseline.json 未改动。依据规范 docs/reference/contracts/interface-budget-contract.md(固定基线 50aa5b4fd1c88b7225fc30e58423120e3ad5d426):
| Criterion ID | Requirement | Disposition (f532daa1953dfbffa45542989f358128dbdab7c1) |
Evidence |
|---|---|---|---|
CLI-DIFF-REGRESSION-PARITY |
保留 compare_cli_output_receipts、select_cli_output_base_ref、预算/迁移配额判定与全部 58 项导出兼容 |
Implemented | 58/58 导出恒等、test_cli_output_differential.py 211 passed, 1 skipped、2,883 passed, 8 skipped |
CLI-DIFF-FAIL-CLOSED |
对非法 schema_version、重复 row_id、非映射 authoring_inputs/field_sha256 与非可迭代键集合 fail-closed 报错 |
Implemented | test_cli_output_differential_contract.py 5 passed in 0.36s + 配对 50aa5b4fd1 vs f532daa1953dfbffa45542989f358128dbdab7c1 畸形输入探针 PASS |
CP-STATIC-ZERO-ANY |
拆分全部控制面模块 <700 LOC、Zero-Any 且不突破 loopx/*.py == 112 与可维护性棘轮 |
Implemented | 510/511/520/372/184 LOC、0 AST Any、ruff 5/5、strict mypy 5/5、maintainability-ratchet 0 未评审发现 |
关键代码讲解
compare_cli_output_receipts/_compare_row/_compare_row_growth(源码):保留对surface/evidence_log_thin/退役语义(经replan_context替代)、heartbeat_agent_input_v1、turn_plan_controls(缺失映射时显式抛TypeError)及candidate_only行的完全等价处理,并以_record_schema_migration与_missing_items_message消除重复判定样板。tuple_field/mapping_field/shape_paths/_rows_by_id/_removed(源码):集中约束可选字段和回执顶层校验,对非映射authoring_inputs/quota_controls与非可迭代semantic_json_keys/json_shape_paths立即抛出可读TypeError/ValueError,同时为str等既有兼容可迭代输入保持与基线一致的降级边界。_none_to_single_version_migration/_schema_migration_state/_complete_quota_source_migration(源码):收拢planning_horizon、guided_todo_delta、planning_inventory_detail与todo_work_counts的重复none -> v0检测,保留19项field_sha256对照与配额迁移语义。_continuation_instruction_migration/_turn_projection_migration(源码):隔离指令迁移与 Stride / execution profile / inline agent_context 结构路径契约,零行为偏移。
对主干的风险 / Risks
经 50aa5b4fd1 与 f532daa1953dfbffa45542989f358128dbdab7c1 独立配对对比及 13 组正反例核验,PR #9445 对主干行为零破坏:正常比较、超限失败(chars grew by 300; allowance is 128)、键移除(semantic_json_keys removed: status)、evidence_log_thin 退役、Stride turn_projection、连续性指令迁移及 horizon_migration 与基线 100% 一致;针对畸形 authoring_inputs="bad",基线因条件短路错误返回 passed 而 f532daa1953dfbffa45542989f358128dbdab7c1 显式抛出 TypeError: authoring_inputs must be a mapping;针对非映射 field_sha256="bad",由基线 AttributeError 规范化为 TypeError: turn_plan_controls.field_sha256 must be a mapping。跨调用方 mypy 检查 qualification_profiles.py 与 quality_surface_catalog.py 均零错误,仅 examples/control_plane/cli-output-base-head-differential-smoke.py:134,141 留有原本的 2 处未参数化 dict 注释与本次拆分无关。
语义与 CI 对齐
本 PR 未新增或修改任何公共状态枚举、RFC 或默认 CLI/控制面策略;check_rfc_bilingual、semantic-vocabulary-drift-smoke.py(34/34、62/62、conflicting_values_semantic=0/0)、control-plane-maintainability-ratchet-smoke.py(unreviewed_count=0)、Goal loopx check(5/5、0 错误/0 警告)、Goal canary premerge(direct=4/4、catalog=3/3、risk_profile=8/8、failures=0、manual_hold_count=0)与 Goal change-quality(cqr_76d3a78924fbdbd8a5c5 valid)均已在 f532daa1953dfbffa45542989f358128dbdab7c1 全部通过。
我的整体评价 / Verdict
APPROVE(Author-owned COMMENTED 等效批准结论)。 在长程维度上(long_horizon: preserved),CLI 回归比对、预算基线演进契约与退役路径识别完全保持稳定,且 Zero-Any 拆分(<=520 LOC)消除了 59 处类型盲区;在用户体验维度上(user_experience: preserved),所有调用方兼容再导出与异常可诊断性均提升而无额外干预成本;visual_review 为 not_applicable(本次仅重构测试用 Python 输出差异模块与对应契约单测,未改动前端界面、HTML/CSS、渲染卡片或终端排版布局,visual_review 不适用。 unverified_scope: 受本机 macOS / APFS / 无 PowerShell 7 环境限制,test_cli_output_differential.py:73(PowerShell 7)、test_cli_output_budget.py:2057(临时目录 depth-12 路径长度)及 test_git_path_display.py(6 项 APFS 文件名/root 跳过)在 2,883 passed, 8 skipped 中跳过;另在 .venv(Python 3.14.8)直接执行 cli-output-base-head-differential-smoke.py 时,基线 50aa5b4fd1 与 HEAD f532daa195 在 cli_output_budget.py:900 均同态触发预存在的 quota_should_run/small/json 26,386–26,388 vs 26,000 基线天花板失败(而 canary premerge 中 Python 3.12 运行的 cli-output-budget-regression-smoke.py 3/3 全部通过)。)。本地独立全套验证在 f532daa1953dfbffa45542989f358128dbdab7c1 均已通过:ruff(5/5)、strict mypy(5/5)、tsc 控制面类型检查、content_digest_single_owner.test.ts(17/17 PASS)、test_cli_output_differential_contract.py(5/5 PASS)、test_cli_output_differential.py(211 passed, 1 skipped)、跨 6 套件 pytest(2,883 passed, 8 skipped)、semantic-vocabulary-drift-smoke、maintainability-ratchet-smoke、Goal loopx check、canary premerge 及 change-quality verify,无开放审阅讨论串,建议合入。
English verdict: APPROVE at f532daa. Modularized cli_output_differential (1,412 LOC, 59 Any) into four Zero-Any modules (<=520 LOC each) preserving all 58 exports, fail-closed mapping/iterable checks, and 2,883-test parity across differential, budget, canary, and architecture suites.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
动机 / Motivation
把 CLI 输出资格比较拆成可分别维护的回执比较、额度规则、协议迁移和 carrier 模块。
在 PR 运行 CLI 输出资格和预合并 smoke 的维护者,及读取受预算约束输出的调用方。 本次收敛测试比较器的源码结构及现有 CLI 夹具判定。
使用同一固定公共夹具实际运行两份 CLI 源码,诊断收集各 98 行,逐行比较没有超限增长、额外候选或新审阅信号。对象格式的 action_portfolio_schema_versions 在基线报 KeyError 并拒绝,当前头把键当版本,返回 ok=true 并把字符额度从普通 200 放宽到 1600。
按两项现有验收复核。匹配实际输入要求冻结 fixture 并保留语义字段。形状与有界余量要求有效版本列表先通过验证,再使用声明的迁移额度,候选绝对预算仍需检查。 接口预算依据
改动思路 / Approach
各模块按比较、迁移、额度、carrier 分工,仍保留原公开入口。 整理并保持 CLI 输出质量检查,与生产 CLI 和授权执行无新增连接。 真实 CLI fixture 由 probe 生成回执,比较器按 row_id 对齐,再检查语义差异和迁移可用的余量。字段类型应在进入迁移规则前校验。版本列表可在此边界转换为内部 tuple,但整个 JSON 对象应保留为无效输入。
具体改动 / Changes
精确提交 f532daa1953dfbffa45542989f358128dbdab7c1,分叉基线 50aa5b4fd1c88b7225fc30e58423120e3ad5d426。5 个文件增加 1856 行、删除 1171 行。
-
compare_cli_output_receipts对齐行并返回整体资格和每行诊断。 源码 -
tuple_field接受任意 Iterable,把迭代所得元素交给迁移规则。 源码 -
_action_portfolio_schema_migration允许正式版本迁移,_compare_row_growth使用该判断授予额度。 迁移规则 额度检查 -
_SchemaMigrationState把已识别的版本变化和适用的增长额度交给同一比较流程,保留按行报告和调用者的既有导入。
对主干的风险 / Risks
[P2] 对象格式的版本字段被认作有效迁移
同一组回执的候选比基线增长 1000 字符。版本列表为空时,两版都按普通 200 字符额度拒绝。合法版本列表使两版都应用 1600 字符额度。关联差异见上文的对象输入。比较结果带可读的迁移诊断,调用者可能因此把错误形状计为有效迁移。
在迁移前校验版本字段为合法数组及字符串元素。用同一公共比较入口检验对象输入被拒绝、普通增长仍失败、合法版本数组仍获得原有的有界额度。 触发位置
同头补审增加了版本字段容器形状的配对用例,覆盖了既有评审中的形状验证范围。 同头评审
验证
267 项定向测试通过,2 项跳过。标准 premerge 通过。用同一夹具实跑基线和候选,诊断对照了 98 个 CLI 输出行,未出现相对变化。默认严格 differential 另有一条两版共同的本机预算超限,quota_should_run/small/json 在基线和候选均为 26388 字符,高于 26000;单独的诊断采集保留了这条失败。本次验证使用本机源码和隔离夹具。
我的整体评价 / Verdict
REQUEST_CHANGES。 先校验版本列表的类型,再判断能否给该次迁移额外额度。保留正常迁移、原额度和候选绝对预算检查。复验时将原始数组和错误对象一起纳入同一公开比较入口。
English verdict: REQUEST_CHANGES at f532daa. The refactor accepts a malformed version container as a declared migration and gives that row extra growth allowance. Validate the version array before assigning the allowance.
…migrations Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
|
Addressed
|
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · Gemini · Google · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
本次复审在独立干净 detached worktree(/tmp/rev-9445-7f04614a)中对 PR #9445(codex/slim-cli-output-differential-zero-any-20261126 -> main,当前精确提交 7f04614afaf31a6afd018fbcfe0a9b284f876118,分叉目标基线 50aa5b4fd1c88b7225fc30e58423120e3ad5d426)完成了全量 50aa5b4fd1..7f04614afaf31a6afd018fbcfe0a9b284f876118 评审与上轮 [P2] 修复复验(f532daa1953dfbffa45542989f358128dbdab7c1..7f04614afaf31a6afd018fbcfe0a9b284f876118)。
上轮评审后修复确认(f532daa1953dfbffa45542989f358128dbdab7c1 -> 7f04614afaf31a6afd018fbcfe0a9b284f876118): 针对 gpt-6.2-sol [P2] 评审 #6064913539,作者在 cli_output_differential_allowances.py 将 tuple_field 收紧为仅接受非 str/bytes/bytearray/Mapping 的 Sequence[str],并同步将 shape_paths 与 _removed 加固为拒绝 Mapping/字符串型伪可迭代对象;在 cli_output_differential_migrations.py _schema_migration_state 入口前置校验 action_portfolio_schema_versions、planning_horizon_schema_versions 与 planning_inventory_detail_schema_versions(连同 guided_todo_delta/todo_work_counts 覆盖全部 5 组版本列表字段),并在 tests/control_plane/test_cli_output_differential_contract.py 新增公共入口 compare_cli_output_receipts 对空列表、有效 [v0](1600 额度)、字典({v0: True} / {"unexpected": True} / {})、裸串与 [123] 的拒绝回归(6/6 通过)。配对反事实证实此前 f532daa195 将 {v0: True} 迭代成 ('quota_action_portfolio_v0',) 放行的问题已完全闭合。
动机 / Motivation
当维护者与预合并门禁通过 compare_cli_output_receipts、select_cli_output_base_ref 以及 cli-output-base-head-differential-smoke.py 校验代理 CLI 热/冷路径输出预算与迁移回归时,此前单文件 loopx/control_plane/testing/cli_output_differential.py 已膨胀至 1,412 行、含 59 处 Any 注解,且在上一评审头 f532daa195 中新增的 tuple_field 仍把任意 Iterable(包括 JSON 对象/字典 dict)迭代为版本号元组。在基线提交 50aa5b4fd1c88b7225fc30e58423120e3ad5d426 上,authoring_inputs="bad" 会因表层分支短路静默通过,field_sha256="bad" 抛出裸 AttributeError,而 action_portfolio_schema_versions={"quota_action_portfolio_v0": True} 触发 KeyError: '0';在上一评审头 f532daa195 中,tuple_field 仅检查 Iterable 并将上述字典键误解析为 ('quota_action_portfolio_v0',),使 gpt-6.2-sol [P2] 复现出误授 1,600 字符额度并通过的回归。在当前提交 7f04614afaf31a6afd018fbcfe0a9b284f876118 中,tuple_field、shape_paths 与 _removed 均严格拒绝 Mapping/str/bytes/bytearray 及非字符串元素并统一在入口前抛出确定性 TypeError,使畸形字典/字符串输入 fail-closed 拒签而有效列表与 59 项定义导出保持完整等价。当前提交在不新增顶层 loopx/*.py(维持 112 个)、不修改 docs/development/module_metric_baseline.json 且保持默认 cli_output_differential.py 全部 59 项本模块定义符号再导出的前提下,将核心拆分为 510 / 522 / 372 / 520 行的严格 Zero-Any 模块并补充 247 行契约测试(6/6 通过);未在此次拆分中修复历史 smoke 脚本 examples/control_plane/cli-output-base-head-differential-smoke.py:134,141 既有的两处裸 dict mypy 注释,亦未在 compare_cli_output_receipts 本身替代后续预算阈值调整;同时 tuple_field 刻意限定为非 Mapping/非字符串的 Sequence[str](若未来引入 set 输入须显式扩展而非隐式迭代)。
改动思路 / Approach
cli_output_differential.py (510 LOC: compare_cli_output_receipts / _compare_row / _compare_row_growth + 59 项定义符号再导出)
├─ cli_output_differential_allowances.py (522 LOC: 额度表、Metric/TypedDict、tuple_field[Sequence[str]] / mapping_field / shape_paths / _removed)
├─ cli_output_differential_migrations.py (520 LOC: _schema_migration_state 前置全部 *_schema_versions 校验 + _none_to_single_version_migration)
└─ cli_output_differential_carriers.py (372 LOC: _task_step_read_fence / _authoring_input / _continuation_instruction / _turn_projection)
说明(基于精确提交 7f04614afaf31a6afd018fbcfe0a9b284f876118 源码推导,非运行时覆盖率追踪):cli_output_differential.py、cli_output_differential_allowances.py、cli_output_differential_migrations.py。
将常量/类型/严格容器校验器(cli_output_differential_allowances.py)、schema 迁移判定与入口统一字段校验(cli_output_differential_migrations.py)、carrier/Stride 迁移限额(cli_output_differential_carriers.py)与差异汇总编排(cli_output_differential.py)按职责边界拆分并收敛 tuple_field/shape_paths/_removed 前置守卫,使所有版本列表、json_shape_paths、semantic_json_keys 与 markdown_headings 在进入迁移放宽逻辑前即统一拦截字典与字符串伪装,即使 base 与 candidate 双侧同时传入相同畸形字典也能直接抛出 TypeError;仅覆盖 cli_output_differential*.py 四模块 Zero-Any 拆分、容器输入前置校验加固及对应契约测试 tests/control_plane/test_cli_output_differential_contract.py(当前 PR 边界),保持所有生产与测试导入路径不变;旧 smoke 脚本 cli-output-base-head-differential-smoke.py:134,141 的预存在 dict 注解不在本 PR 范围内。
具体改动 / Changes
精确提交 7f04614afaf31a6afd018fbcfe0a9b284f876118(相对基线 50aa5b4fd1c88b7225fc30e58423120e3ad5d426 共改动 5 个文件,+1,930 / -1,171 行,2/2 DCO 提交;较 f532daa1953dfbffa45542989f358128dbdab7c1 增量改动 3 个文件 +95 / -21 行):拆分后四份产品文件行数分别为 510 / 522 / 372 / 520 LOC、契约测试 247 LOC,AST 扫描 0 Any、0 # type: ignore,loopx/*.py == 112 且 module_metric_baseline.json 未变动。依据规范 docs/reference/contracts/interface-budget-contract.md(固定基线 50aa5b4fd1c88b7225fc30e58423120e3ad5d426):
| Criterion ID | Requirement | Disposition (7f04614afaf31a6afd018fbcfe0a9b284f876118) |
Evidence |
|---|---|---|---|
CLI-DIFF-REGRESSION-PARITY |
保留 compare_cli_output_receipts、select_cli_output_base_ref、预算/迁移配额判定与全部 59 项定义导出兼容 |
Implemented | AST 59/59 定义导出恒等、test_cli_output_differential.py 211 passed, 1 skipped、6 套件 2,350 passed, 8 skipped |
CLI-DIFF-FAIL-CLOSED |
对非法 schema_version、重复 row_id、非映射 authoring_inputs/field_sha256、以及畸形 dict/str/非字符串版本集合与路径 fail-closed 报错 |
Implemented | test_cli_output_differential_contract.py 6 passed in 0.76s + 50aa5b4fd1/f532daa195 vs 7f04614afaf31a6afd018fbcfe0a9b284f876118 16 组正反例核验 PASS |
CP-STATIC-ZERO-ANY |
拆分全部控制面模块 <700 LOC、Zero-Any 且不突破 loopx/*.py == 112 与可维护性棘轮 |
Implemented | 510/522/372/520/247 LOC、0 AST Any、ruff 5/5、strict mypy 5/5、maintainability-ratchet unreviewed_count=0 |
关键代码讲解
tuple_field、shape_paths与_removed(源码):tuple_field将原先if not raw+isinstance(raw, Iterable)收紧为raw is None返回()、仅允许非str/bytes/bytearray的Sequence并逐项校验isinstance(item, str),彻底封堵 JSON 对象({...})与裸字符串被当作元素序列;shape_paths与_removed同步排除了str/bytes/bytearray/Mapping。_schema_migration_state与_projection_envelope_migration(源码):在计算portfolio_schema_changed/horizon_schema_changed/inventory_detail_schema_changed前显式对两端执行tuple_field,加上guided_todo_delta、todo_work_counts与projection_envelope原有的tuple_field路径,确保任何一端或双端同时包含{...}畸形字段均 fail-closed。compare_cli_output_receipts/_compare_row_growth/_compare_row(源码):保留对surface/evidence_log_thin/退役路径、普通 200 字符上限与合法版本迁移 1,600/3,200 额度的完整语义,并维持 59 项本模块定义符号再导出。test_action_portfolio_schema_migration_rejects_malformed_dict_and_enforces_list_allowance(源码):通过公共入口验证空列表拒绝(200)、有效列表放行(1,600)、五类畸形版本/容器输入及四类兄弟字段字典全部稳定抛出TypeError。
对主干的风险 / Risks
经 50aa5b4fd1 与 7f04614afaf31a6afd018fbcfe0a9b284f876118 执行 16 组配对反事实实验并与 f532daa195 比对,核心功能与主干完全兼容:
- 上轮
[P2]缺陷实证闭环:对action_portfolio_schema_versions={v0: True}(+1000 字符增长),50aa5b4fd1抛出KeyError('0'),f532daa195tuple_field返回('quota_action_portfolio_v0',)误授1,600额度,7f04614afaf31a6afd018fbcfe0a9b284f876118直接抛出TypeError: action_portfolio_schema_versions must be a sequence of strings;同时空字典{}、裸字符串及双侧同时存在同一字典(覆盖action_portfolio、projection_envelope、guided_todo_delta、todo_work_counts、json_shape_paths、semantic_json_keys)均 fail-closed 报错; - 正常/迁移用例完全等价:
identical、empty_portfolio_plus1000(200拒签)、valid_portfolio_migration_plus1000(1,600通过)、horizon_migration(3,200通过)及removed_key与50aa5b4fd1100% 一致;跨调用方mypy在qualification_profiles.py与quality_surface_catalog.py均为0错误,仅未改动的examples/control_plane/cli-output-base-head-differential-smoke.py:134,141保留既有的2处裸dict类型参数提示; - 旧评审挂起说明:前头
f532daa195存在两条旧COMMENTED评审(6064888274批准与6064913539[P2]要求修改),其中[P2]提出的容器校验、公共入口测试覆盖与合法/空列表/对象比对均已于7f04614afaf31a6afd018fbcfe0a9b284f876118逐条兑现;因approval_closeout工具契约声明dismissal_authorized=false,无须也未对旧评审执行删除或越权驳回。
语义与 CI 对齐
本 PR 未新增或修改任何公共状态枚举、RFC 或生产默认行为;scripts/check_rfc_bilingual.py、examples/semantic-vocabulary-drift-smoke.py(34/34、62/62、conflicting_values_semantic=0/0)、examples/control_plane/control-plane-maintainability-ratchet-smoke.py(unreviewed_count=0、stale_exception_count=0)、Goal loopx check(5/5、0 错误/0 警告)、Goal canary premerge(gate.status="passed"、direct=4/4、py_compile=1/1、catalog=3/3、risk_profile=8/8、failures=0、manual_hold_count=0)与 Goal change-quality verify(cqr_314e5ea843ba3057b581 valid)均已在 7f04614afaf31a6afd018fbcfe0a9b284f876118 全量通过。
我的整体评价 / Verdict
APPROVE(Author-owned COMMENTED 等效批准结论)。 在长程维度上(long_horizon: preserved),CLI 预算差分回归门禁、声明式迁移识别与退役替换语义完整保留,且单模块从 1,412 LOC / 59 Any 拆分并封堵了非序列版本容器漏洞;在用户体验维度上(user_experience: preserved),全量 59 项定义导出保持零破坏,对字典/字符串/非字符串序列误传入给出明确 TypeError;visual_review 为 not_applicable(本次仅重构 CLI 输出预算差分比较模块与对应契约单测,未改动前端界面、HTML/CSS、渲染卡片或终端排版视图,visual_review 不适用。 unverified_scope: 受本机 macOS / APFS / 无 PowerShell 7 环境限制,2,350 passed, 8 skipped 中跳过 test_cli_output_differential.py:73(PowerShell 7,1 项)、test_cli_output_budget.py:2057(depth-12 临时目录,1 项)及 tests/canary/test_git_path_display.py(APFS 文件名/root 跳过,6 项);未在本头额外独立直跑 cli-output-base-head-differential-smoke.py,canary premerge 已实际执行并全量通过 cli-output-budget-regression-smoke.py(3/3 catalog 与 8/8 risk profile)。)。全部本地校验在 7f04614afaf31a6afd018fbcfe0a9b284f876118 已重新执行并通过:ruff(5/5)、strict mypy(5/5)、CI mypy(17/17)、调用方 mypy(2/2)、TS typecheck:control-plane 与 content_digest_single_owner.test.ts(17/17 PASS)、test_cli_output_differential_contract.py(6/6 PASS)、test_cli_output_differential.py(211 passed, 1 skipped)、6 套件 pytest(2,350 passed, 8 skipped)、canary premerge 与 change-quality verify,无未决代码问题,建议合入。
English verdict: APPROVE at 7f04614. Modularized cli_output_differential (1,412 LOC, 59 Any) into four <530-LOC Zero-Any modules preserving all 59 defined exports, resolved the prior [P2] dict-container migration bypass via strict Sequence[str] validation across tuple_field/shape_paths/_removed and _schema_migration_state, and passed 2,350 non-env-skipped regression tests plus canary premerge.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
动机 / Motivation
同一冻结调用 fixture 比较精确 base 和 head。Quota 迁移增长例外须有明确来源观察,显式 null 是旧入口的合法观测。 基线遇到缺少 source_schema 的回执时停止比较。上一头将缺失字段解析为 null,允许本应被拒绝的增长。
依靠原生 CLI output differential 判定候选输出预算及发行资格的维护者。 本次核对Quota 迁移额度需要真实的来源观察。
从真实 quota should-run 提取同一组 19 个匹配控制摘要,只从基线回执删除 source_schema。基线抛 KeyError。当前头仍授予 2048 字符额度,允许增长 1500 并返回通过,未产生 review signal。
显式 null 的合法迁移保持 2048 字符额度。控制摘要变化、超限和普通不变回执均与基线相符。新增版本列表校验覆盖把对象键误当版本号的另一条旧反例。
用真实本地 CLI 获取控制观察,再构造两端比较回执。没有设备或远程 CI 结论。缺失字段不影响正常探针产生的合法回执,但已有残缺回执仍可进入比较。 基线合同
改动思路 / Approach
probe 产出来源与控制摘要,migrations 识别声明的迁移,allowances 持有预算,旧门面汇总比较和警告。
quota should-run / compare_cli_output_receipts。在 _complete_quota_source_migration 用字段存在性守卫区分缺失与显式 null。复用现有拒绝分支并加同一真实控制观察的两个用例。
具体改动 / Changes
精确提交 7f04614afaf31a6afd018fbcfe0a9b284f876118,分叉基线 50aa5b4fd1c88b7225fc30e58423120e3ad5d426。完整改动 5 个文件,增加 1,930 行、删除 1,171 行。已核对不变的分叉基线,2 个文件与上次审阅的对象相同,本轮逐行复核另 3 个修改文件。
_complete_quota_source_migration。此处把缺失的来源观察折进合法 null。 源码compare_cli_output_receipts。公开入口汇总结果、预算失败和 review signal。 源码tuple_field。要求版本字段是字符串序列,关闭版本对象误识别。 源码_turn_projection_migration。继续识别 turn carrier 的既有迁移。 源码test_action_portfolio_schema_migration_rejects_malformed_dict_and_enforces_list_allowance。配对覆盖有效版本和畸形版本,不涉及缺失来源字段。 源码
对主干的风险 / Risks
[P2] Quota 迁移额度需要真实的来源观察。 版本列表和 Quota 来源是两个独立的资格条件。正常控制见证与绝对尺寸的检查仍在。迁移例外分支需要把来源是否观察到作为独立字段检查。 源码
定向 pytest 268 passed, 2 skipped in 504.13s (0:08:24)。Success: no issues found in 5 source files。本地标准 premerge 的直接检查全部通过。首次并行执行另有超时,诊断项保留。独立全量差分 smoke 在精确基线自比和候选都先触发绝对上限(quota_should_run/small/json emitted 26390 chars; baseline ceiling is 26000),同一回执比较另外执行。
我的整体评价 / Verdict
REQUEST_CHANGES。 版本列表校验已经加固。来源字段缺失时仍存在独立的迁移额度误判。 需要在精确头上同时通过缺字段拒绝和显式 null 的正向对照。
English verdict: REQUEST_CHANGES at 7f04614. The version-array repair holds, but a missing source_schema still grants the 2,048-character migration allowance for a 1,500-character increase.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
维护 CLI 输出门禁的开发者在预合并检查中,用同一组场景比较主干及候选的输出回执。
当一次比较提交了多 1,000 字符的输出,未声明迁移应被 200 字符余量拦下,合格版本列表才可获得 1,600 字符余量。上一头误把畸形字典作为版本列表,新提交会在计算余量前拒绝。
普通输出增长和丢失语义字段仍会被报告,合法的迁移仍可使用既有余量。畸形版本对象能得到包含字段名的诊断。
变更范围是源码 checkout 的 CLI 质量检查。没有调高绝对输出上限、改变业务准入,也没有验证远端 CI。
按 docs/development/testing-and-quality.md 中已接受的合同复审,规范版本 50aa5b4fd1c88b7225fc30e58423120e3ad5d426。
- OUTPUT-01。同一固定场景用基线和候选跑真实 CLI,以对照发现输出膨胀或丢失决策语义。 在
compare_cli_output_receipts对照验证。 - OUTPUT-02。保留有效余量规则和绝对上限,未获授权的增长或缺少语义字段继续报错。 在
_compare_row_growth / tuple_field对照验证。
改动思路 / Approach
保留一套行配对和迁移规则。拆分后可以按责任核对历史兼容,不需要并行比较器或额外配置。
当前 PR 交付 typed receipt 比较与输入形状校验,继续由原预合并入口调用。
这里需要比较原调用者的结果与负例。已有评审和类型统计提供范围线索,实际的验收来自同一输入在三个提交的对照。
具体改动 / Changes
精确头 7f04614afaf31a6afd018fbcfe0a9b284f876118,基线 50aa5b4fd1c88b7225fc30e58423120e3ad5d426。复审用前次候选 f532daa1953dfbffa45542989f358128dbdab7c1 确认回归敏感性,并核对完整变更路径。
compare_cli_output_receipts。按 row_id 配对并输出结构化比较回执。_compare_row。组合各语义与预算不变量并返回真实失败理由。tuple_field。在 schema 迁移之前拒绝非字符串序列。_schema_migration_state。区分同版本、合法迁移与不可授权增长。_turn_projection_migration。保留相同 Turn carrier 迁移条件。
差异覆盖 5 个文件,+1930 / -1171。拆分降低局部耦合,重导出维持一个真实实现。显式类型与失效检查增加了总行数。
对主干的风险 / Risks
同一冻结的公开 fixture 中,基线和现头 98 条真实 CLI 场景全部配对通过,未召唤额外 review。原语义字段删除仍拒绝。同一 1,000 字符增长在缺少迁移时失败,合法迁移同时获 1,600 字符余量。
基线用 KeyError 拒绝错误字典,旧候选从字典键误得 1,600 字符余量并通过,现头以字段级 TypeError 拒绝。
本地定向检查 268 passed, 2 skipped in 161.17s。Ruff 与 strict mypy 通过。首次标准风险检查结果为 failed,直接检查全部通过,下面列出未过项及后续证据。
固定场景中的绝对上限有同样的超限行。surface/quota_should_run/multi_agent/markdown 基线 31095 / 现头 31095 / 上限 31000 字符;surface/quota_should_run/small/json 基线 26388 / 现头 26390 / 上限 26000 字符;surface/quota_should_run/small/markdown 基线 26487 / 现头 26489 / 上限 26000 字符。该上限在旧的 CLI 输出生成器内强制,早于差分比较器,变更未触及生成器或上限。门禁现象单列,差分规则和丢语义反例已独立验证。 首轮并行 premerge 的 vocabulary 扫描缺 npm 依赖,补齐后该扫描通过。组合预算检查超时,分开运行证明输出绝对上限既有超限。保留此合并风险。
合成 public fixture 保持真实 CLI 分发和模块加载,未测生产 Goal、其他机器或远程 CI。
我的整体评价 / Verdict
APPROVE。现头关闭了上一轮复现的缺口,仍从现有入口保留普通调用和失效恢复。合并条件由 GitHub 和维护者另行判断。上述风险仍留在各自的检查范围和原始回执中。
English verdict: APPROVE. 7f04614 preserves CLI receipt comparison and rejects malformed version mappings before migration allowances.
…e migration Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · Gemini · Google · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
本次复审在独立干净 detached worktree(/tmp/rev-9445-80ef9160)中对 PR #9445(codex/slim-cli-output-differential-zero-any-20261126 -> main,当前精确提交 80ef916013a19bd787e9df7e38282c87febfad50,实际分叉目标基线 50aa5b4fd1c88b7225fc30e58423120e3ad5d426)完成了全量 50aa5b4fd1..80ef916013a19bd787e9df7e38282c87febfad50 评审与上轮 [P2] 修复复验(7f04614afaf31a6afd018fbcfe0a9b284f876118..80ef916013a19bd787e9df7e38282c87febfad50)。
上轮评审后修复确认(7f04614afaf31a6afd018fbcfe0a9b284f876118 -> 80ef916013a19bd787e9df7e38282c87febfad50): 针对 gpt-6.2-sol [P2] 评审 #6065799303(行内讨论 PRRT_kwDOStEbEs68IiTj 已回复 PRRC_kwDOStEbEs8AAAABGD6Z1Q 并标记 resolved):
- 在
loopx/control_plane/testing/cli_output_differential_migrations.py_complete_quota_source_migration(L416)新增显式"source_schema" not in base_controls守卫,直接复用原有return False拒签分支,并在_complete_quota_source_allowance(L457)改回严格下标base_controls["source_schema"],既彻底区分「字段缺失」与「显式null」,又无冗余异常处理; - 在
tests/control_plane/test_cli_output_differential_contract.py:254-342新增test_complete_quota_source_migration_requires_explicit_source_schema_key,直接从quota should-run提取真实 19 项field_sha256+controls_sha256观察验证:显式"source_schema": None继续放行(2,048额度、ok=True),仅删除source_schema键即按普通热路径64字符 ceiling 拒绝增长1,500字符(7/7通过)。
动机 / Motivation
当维护者与预合并门禁通过 compare_cli_output_receipts、select_cli_output_base_ref 以及 cli-output-base-head-differential-smoke.py 校验代理 CLI 输出预算与声明式迁移回归时,此前 1,412 行、59 处 Any 的单文件模块难以满足 Zero-Any 上限,且在上一评审头 7f04614afa 中 _complete_quota_source_migration 用 base_controls.get("source_schema") 读取基线来源字段,将缺少 source_schema 键误同化为显式 None。在基线提交 50aa5b4fd1c88b7225fc30e58423120e3ad5d426 上,从真实 quota should-run(19 项匹配控制摘要)删除 quota_controls["source_schema"] 会直接触发 KeyError: 'source_schema' 并拒签;在上一评审头 7f04614afaf31a6afd018fbcfe0a9b284f876118 中,虽已收紧 tuple_field 拒绝字典/裸串版本容器,却因 .get("source_schema") 返回 None 而对缺键基线误授 2,048 字符迁移额度并通过增长 1,500 字符的候选(gpt-6.2-sol [P2])。在当前提交 80ef916013a19bd787e9df7e38282c87febfad50 中,_complete_quota_source_migration 前置 "source_schema" not in base_controls 复用既有拒绝分支并返回 ok=False(64 字符上限),而显式 "source_schema": None 与其余迁移/容错契约均与基线严格一致。当前提交在不新增顶层 loopx/*.py(维持 112 个)、不修改 docs/development/module_metric_baseline.json 且保持默认 cli_output_differential.py 全部 59 项本模块定义符号再导出的前提下,维持 510 / 522 / 372 / 523 行严格 Zero-Any 拆分并补充 342 行契约测试(7/7 通过);未在本 PR 中修复独立脚本 examples/control_plane/cli-output-base-head-differential-smoke.py:134,141 预存在的两处裸 dict mypy 注释,亦未在 compare_cli_output_receipts 中绕过任何既有绝对预算上限。
改动思路 / Approach
cli_output_differential.py (510 LOC: compare_cli_output_receipts / _compare_row / _compare_row_growth + 59 项定义符号再导出)
├─ cli_output_differential_allowances.py (522 LOC: 额度表、Metric/TypedDict、tuple_field[Sequence[str]] / mapping_field / shape_paths / _removed)
├─ cli_output_differential_migrations.py (523 LOC: _complete_quota_source_migration["source_schema" in base_controls] + _schema_migration_state)
└─ cli_output_differential_carriers.py (372 LOC: _task_step_read_fence / _authoring_input / _continuation_instruction / _turn_projection)
说明(基于精确提交 80ef916013a19bd787e9df7e38282c87febfad50 源码推导,非运行时覆盖率追踪):cli_output_differential.py、cli_output_differential_migrations.py、test_cli_output_differential_contract.py。
将额度/严格容器校验(cli_output_differential_allowances.py)、显式键存在性与版本迁移判定(cli_output_differential_migrations.py)、carrier 迁移限额(cli_output_differential_carriers.py)与差异编排(cli_output_differential.py)按不变式职责分层,使缺键字段统一复用 return False 拒签路径而不与显式 null 混淆;同时延续前序提交对非映射/非字符串序列版本容器(tuple_field / shape_paths / _removed)及全版本列表预校验的统一防线;仅包含 cli_output_differential*.py 四模块 Zero-Any 拆分、容器输入与 source_schema 键存在性守卫及 tests/control_plane/test_cli_output_differential_contract.py 契约验证(当前 PR 边界),所有既有导入与测试调用路径零破坏;旧 smoke 脚本预存的 dict 注解提示留待独立清理。
具体改动 / Changes
精确提交 80ef916013a19bd787e9df7e38282c87febfad50(相对基线 50aa5b4fd1c88b7225fc30e58423120e3ad5d426 共改动 5 个文件,+2,028 / -1,171 行,3/3 DCO 提交;较 7f04614afaf31a6afd018fbcfe0a9b284f876118 增量改动 2 个文件 +121 / -23 行):四份产品文件 510 / 522 / 372 / 523 LOC、契约测试 342 LOC,AST 扫描均 0 Any、0 # type: ignore,loopx/*.py == 112 且 module_metric_baseline.json 未修改。依据规范 docs/reference/contracts/interface-budget-contract.md(固定基线 50aa5b4fd1c88b7225fc30e58423120e3ad5d426):
| Criterion ID | Requirement | Disposition (80ef916013a19bd787e9df7e38282c87febfad50) |
Evidence |
|---|---|---|---|
CLI-DIFF-REGRESSION-PARITY |
保留 compare_cli_output_receipts、select_cli_output_base_ref、19 控制摘要迁移(含显式 source_schema: null)与全部 59 项定义导出 |
Implemented | AST 59/59 定义导出恒等、7 套件 2,902 passed, 8 skipped + 真实 quota should-run 显式 null (2,048) 等价 |
CLI-DIFF-FAIL-CLOSED |
对缺少 source_schema 键的 quota_controls、字典/字符串版本容器及非映射 quota_controls fail-closed 拒签 |
Implemented | test_cli_output_differential_contract.py 7 passed in 2.34s + 50aa5b4fd1 vs 80ef916013a19bd787e9df7e38282c87febfad50 5 组真实/畸形配对核验 PASS |
CP-STATIC-ZERO-ANY |
拆分全部控制面模块 <700 LOC、Zero-Any 且保持 loopx/*.py == 112 与可维护性棘轮 |
Implemented | 510/522/372/523/342 LOC、0 AST Any、ruff 5/5、strict mypy 5/5、maintainability-ratchet unreviewed_count=0 |
关键代码讲解
_complete_quota_source_migration与_complete_quota_source_allowance(源码):L416先判断"source_schema" not in base_controls立即return False进入普通64-char ceiling 拒签,既拒绝缺键回执又让显式"source_schema": None(explicit_null_base)与"loopx_turn_envelope_v0"合法迁移继续成立;L457直接下标base_controls["source_schema"]在门卫之后读取。tuple_field、shape_paths与_removed(源码):仅接受None或非Mapping/str/bytes/bytearray的Sequence[str],关闭此前字典键误作版本号迁移的通道。test_complete_quota_source_migration_requires_explicit_source_schema_key(源码):实际执行quota should-run提取 19 项控制摘要,验证显式None放行2,048而删去source_schema键严格拒签且零KeyError。
对主干的风险 / Risks
经在 50aa5b4fd1 与 80ef916013a19bd787e9df7e38282c87febfad50 上执行真实 quota should-run(19 项控制摘要)配对反事实与跨套件检验,对主干零回归:
- 配对真实
quota should-run核验闭环:explicit_null_base两端完全一致(ok=True, allowance=2048);missing_source_schema_base在基线抛KeyError('source_schema')、上一评审头7f04614afa误授2,048通过,当前80ef916013a19bd787e9df7e38282c87febfad50返回ok=False, allowance=64并报出output_contract_version changed/chars grew by 1500; allowance is 64/markdown_anchor changed;missing_source_schema_candidate两端完全一致(ok=False, 64);bad_dict_controls(quota_controls="bad")与p2_dict_portfolio({v0: True})均由基线AttributeError/KeyError规范化为可读TypeError; - 调用方类型检查边界:
cli_output_differential.py导出 59/59 AST 定义符号,qualification_profiles.py与quality_surface_catalog.pymypy均 0 错误;仅未涉及本 PR 改动的examples/control_plane/cli-output-base-head-differential-smoke.py:134,141保留既有的2处未参数化dict提示; - 旧评审与讨论收口:所有前头
[P2](6064913539与6065799303)均已于80ef916013a19bd787e9df7e38282c87febfad50闭合且PRRT_kwDOStEbEs68IiTj已解决(isResolved: true),工具契约dismissal_authorized=false,无任何开放阻断讨论串。
语义与 CI 对齐
本 PR 未新增或修改任何公共状态枚举、RFC 或默认生产逻辑;scripts/check_rfc_bilingual.py、examples/semantic-vocabulary-drift-smoke.py(34/34、62/62、conflicting_values_semantic=0/0)、examples/control_plane/control-plane-maintainability-ratchet-smoke.py(unreviewed_count=0、stale_exception_count=0)、Goal loopx check(5/5、0 错误)、Goal canary premerge(passed、direct=4/4、py_compile=1/1、catalog=3/3、risk_profile=8/8、failures=0、manual_hold_count=0)与 Goal change-quality verify(cqr_b39371824c77dc3e26c2 valid)全量通过。
我的整体评价 / Verdict
APPROVE(Author-owned COMMENTED 等效批准结论)。 在长程维度上(long_horizon: preserved),CLI 预算差分回归门禁、声明式 19 控制摘要迁移校验与退役替换语义完整保留,且前两轮发现的字典版本容器与缺失 source_schema 键边界缺陷已全部封闭;在用户体验维度上(user_experience: preserved),全量 59 项定义导出零破坏且畸形容器/缺键回执 fail-closed 可诊断,visual_review 为 not_applicable(本次仅重构 CLI 输出预算差分比较器与对应契约单测,未修改前端页面、HTML/CSS、交互组件或终端排版视图,visual_review 不适用。 unverified_scope: 受本机 macOS / APFS / 无 PowerShell 7 环境限制,7 套件 2,902 passed, 8 skipped 中跳过 test_cli_output_differential.py:73(PowerShell 7,1 项)、test_cli_output_budget.py:2057(depth-12 临时目录,1 项)及 tests/canary/test_git_path_display.py(APFS 文件名/root 跳过,6 项);cli-output-base-head-differential-smoke.py 的全量独立直跑不在本比较器重构范围,实际 canary premerge(含 cli-output-budget-regression-smoke.py 3/3 与 8/8 risk profile)已全量通过。)。全部本地独立检验在 80ef916013a19bd787e9df7e38282c87febfad50 已重新执行并通过:ruff(5/5)、strict mypy(5/5)、CI mypy(17/17)、canary 调用方 mypy(2/2)、TS typecheck:control-plane 与 content_digest_single_owner.test.ts(17/17 PASS)、test_cli_output_differential_contract.py(7/7 PASS)、7 套件 pytest(2,902 passed, 8 skipped)、canary premerge 与 change-quality verify,无开放审阅讨论串,建议合入。
English verdict: APPROVE at 80ef916. Modularized cli_output_differential (1,412 LOC, 59 Any) into four <530-LOC Zero-Any modules preserving all 59 defined exports, closed the prior [P2] missing source_schema bypass via explicit key-presence guard matching baseline rejection semantics while preserving explicit null migration (2,048 allowance), and passed 2,902 non-env-skipped tests plus canary premerge.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
这项差分检查决定维护者能否把 CLI 输出增长当作已验证的变更。权限匹配的证据字段缺失时,余量会掩盖回执不完整和增长一起出现的问题。
在相同 quota should-run 回执上保留 19 项 control witness,只移除基线 source_schema。旧头放行,现头走普通预算并拒绝增长。显式 null 的完整迁移仍由原规则接受。
现头可独立识别证据不完整的迁移,保留 98 条固定生产回执的配对判定,也保留真正迁移和普通预算的边界。
合并和远端 CI 状态属于后续独立判断。这个提案的边界是比较器及其测试。
按 docs/development/testing-and-quality.md 中已接受的合同复审,规范版本 50aa5b4fd1c88b7225fc30e58423120e3ad5d426。
- cli_receipt_semantics。已有响应行继续比较版本、语义字段和运行方式,超限可以追溯到具体回执。 在
compare_cli_output_receipts对照验证。 - bounded_explicit_migration。容量迁移仅使用显式、完整且匹配的证据,普通增长余量仍独立。 在
_complete_quota_source_migration对照验证。 - ordinary_budget_and_drift。比较门在真实命令和固定生产样本下保留容量与语义断言。 在
_complete_quota_source_allowance对照验证。
改动思路 / Approach
公共比较入口仍持有逐行决策,迁移类型和余量分别放入已有命名的职责模块。现头在迁移谓词内要求键存在,后续使用直接读取,与显式 null 区分。原普通分支和字段比较的责任清晰。
从相同回执建立 schema 迁移和容量约束,涉及读取、配对及诊断。在迁移谓词验证前,容量保持普通预算。
这里需要比较原调用者的结果与负例。用同一输入比对主干、上一版与当前提交,再检查入口的正例和失败分支。
具体改动 / Changes
精确头 80ef916013a19bd787e9df7e38282c87febfad50,基线 50aa5b4fd1c88b7225fc30e58423120e3ad5d426。复审用前次候选 7f04614afaf31a6afd018fbcfe0a9b284f876118 确认回归敏感性,并核对完整变更路径。
compare_cli_output_receipts。保留调用者的行标识、等价和复审判定入口。_compare_row。连接既有语义差异、文本和长度预算,输出逐行失败信息。_complete_quota_source_migration。先要求 source_schema 的基线键存在,再验证十九项来源与控制证据。_complete_quota_source_allowance。仅对通过匹配的迁移读取已验证字段并计算原 2,048 字符余量。test_complete_quota_source_migration_requires_explicit_source_schema_key。并列验证缺键、显式 null 和普通增长的不同结果。
差异覆盖 5 个文件,+2028 / -1171。拆分降低局部耦合,重导出维持一个真实实现。显式类型与失效检查增加了总行数。
对主干的风险 / Risks
用真实 quota should-run 输出取 19 项固定 control witness。显式 null 和合格候选得到 2,048 字符,缺候选 schema 或修改 witness 按 64 字符普通余量拒绝。在本轮核对生产器和 fixture 的相同 blob 后,用现头比较器重放 98 条冻结生产回执,配对全部通过,没有新 review 信号。
同一 1,500 字符增长场景中,删除源 source_schema,主干以 KeyError 拒绝,上一版给出 2,048 字符促成误放行。现头用 64 字符普通余量返回失败,并保留字段、长度和 anchor 诊断。
本地定向检查 269 passed, 2 skipped in 133.08s。Ruff 与 strict mypy 通过。本地标准 premerge 通过,6 项直接检查和 11 项选中检查均通过。
复用的冻结生产证据中有三条已知绝对上限超限,生产器和限额配置在三版 blob 相同。这一观察与差分结果分开保留。本轮标准 premerge 中实际执行的 output-budget regression smoke 通过。
固定场景的绝对上限是独立断言。冻结生产回执在前次匹配样本中有三行既有超限,精确修订的生产器与上限配置 blob 相同。本轮复用该生产证据,另以真实 CLI 重新取样,当前标准 premerge 通过。远端 CI 未纳入本次 review。
我的整体评价 / Verdict
APPROVE。现头关闭上一轮复现的问题,覆盖原入口的兼容行为和新增校验边界。当前本地验证通过,远端 CI、线上写入和合并授权各自按现有流程确认。
English verdict: APPROVE. 80ef916 distinguishes a missing source schema from explicit null and preserves valid CLI output migration allowances.
Summary
Modularize
loopx/control_plane/testing/cli_output_differential.py(1,412LOC,59Any) into four strict Zero-Anytyped modules underloopx/control_plane/testing/while preserving every public/test symbol re-export, single-ownerMetriccontract, and fail-closed receipt/fixture validation:loopx/control_plane/testing/cli_output_differential_allowances.py(511LOC,0ASTAny,0 # type: ignore): owns schema constants,Metric,MetricAllowance,JsonObject,GrowthAllowance,CliOutputRowComparison/CliOutputReceiptComparisonTypedDicts, fail-closedtuple_field/mapping_field/shape_pathshelpers, policy & migration allowance tables,_rows_by_id,_removed,_growth_limit,_has_decision_evidence, and per-surface allowance helpers.loopx/control_plane/testing/cli_output_differential_migrations.py(520LOC,0ASTAny,0 # type: ignore): owns declared schema and source migrations (_action_signature_migration,_action_portfolio_schema_migration, consolidated_none_to_single_version_migrationbacking horizon/guided-todo/inventory-detail/todo-work-counts transitions,_SchemaMigrationState,_complete_turn_plan_migration,_matching_quota_controls,_complete_quota_source_migration,_complete_quota_source_allowance,_projection_envelope_migration).loopx/control_plane/testing/cli_output_differential_carriers.py(372LOC,0ASTAny,0 # type: ignore): owns carrier & continuation migrations (_task_step_read_fence_migration,_authoring_input_migration,_continuation_instruction_migration,_turn_projection_migration).loopx/control_plane/testing/cli_output_differential.py(510LOC,0ASTAny,0 # type: ignore): preserves all origin/main exports explicitly, keepsselect_cli_output_base_ref, and runs_compare_row_growth,_compare_row, andcompare_cli_output_receiptsusing deduplicated_record_schema_migration/_missing_items_messagehelpers.tests/control_plane/test_cli_output_differential_contract.py(184LOC,0ASTAny,0 # type: ignore): verifies<700LOC /0ASTAny/0 # type: ignore, explicit owner-module re-export identity,select_cli_output_base_refsync-branch selection, fail-closed validation on malformed receipts/fields, and retiredevidence_log_thinhandling.Boundaries & Guarantees
loopx/*.py == 112unchanged;loopx/canary/module_metric_baseline.jsonuntouched.Metricremains single-owned in_allowances.pyand re-exported incli_output_differential.py).test_cli_output_differential.py,test_cli_output_budget.py,examples/control_plane/cli-output-base-head-differential-smoke.py) preserve compatibility and zero new mypy errors.Verification
mypy --strict --follow-imports=silent --no-incremental(5 changed files):0errors; baremypy --no-incremental(5 files):0errors; cross-callermypy(7 files incl. smoke & canary profiles):2pre-existing errors onexamples/control_plane/cli-output-base-head-differential-smoke.py,0new errors.ruff check(5 files): all checks passed.pytest -n 6(tests/control_plane/test_cli_output_differential.py,tests/control_plane/test_cli_output_differential_contract.py,tests/control_plane/test_cli_output_budget.py,tests/canary/,tests/architecture/,tests/test_python_ci_workflow.py) on clean detached checkout atf532daa195:2,883 passed, 8 skipped(0failures; platform-gated skips only).npm run typecheck:control-plane: passed;node --test tests/control_plane_ts/content_digest_single_owner.test.ts:17/17passed.scripts/check_rfc_bilingual.py,examples/control_plane/control-plane-maintainability-ratchet-smoke.py,examples/semantic-vocabulary-drift-smoke.py, Goalloopx check(5files,0errors), Goalchange-quality(cqr_76d3a78924fbdbd8a5c5,decision: pass), and Goalcanary premerge --from-git-diff --git-diff-base origin/main(status: passed,direct: 6/6,catalog: 3/3,risk_profile: 8/8,manual_holds: 0): all passed.