Repository navigation
refactor(testing): retire unused quota and envelope packet factories - #8963
Conversation
Signed-off-by: LoopX Agent <[email protected]>
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)
已针对 PR #8963 exact head ac63488684c23fcd4cc246032e79d292353b0f10 完成完整证据核验与本地验证(审查结论:APPROVE,无 P0/P1/P2 阻断问题)。
动机 / Motivation
受影响调用方与维护者:使用 loopx/control_plane/testing/ 场景构造器的模型行为评测、release qualifier 脚本(scripts/qualify-doubao-model-behavior-live.py)与控制面测试维护者。
修改前(6a007683b7dd):actual_default_model_behavior_portfolio.py 与 control_plane_composition_scenarios.py 各自保留了一个在全仓已无任何调用者的冗余 packet factory——build_actual_default_model_behavior_scenario_packets 仅对 build_actual_default_model_behavior_scenario_inputs 做丢弃 sources 的二次包装,build_control_plane_composition_scenario_packets 仅在单测外重建 v0 build_turn_envelope;两者继续滞留不仅增加维护面,还可能误导后续迁移继续沿用旁路工厂。修改后(ac63488684c2):直接删除上述两个无调用者工厂函数及唯一因此变为未用的 build_turn_envelope 导入,净减 25 行。
可观测结果:全仓 rg 确认 0 处残留引用;AST 对比确认两文件除删除这两个定义及该导入外其余结构完全不变;10 组相关测试套件 444 passed(含语义词表漂移与可维护性棘轮测试)、ruff、mypy(17 个核心文件)、release qualifier --help 与 canary premerge --tier quick 全部通过。
非目标边界:本 PR 仅退役这两个已确认无调用者的测试支持工厂,不改变 build_actual_default_model_behavior_scenario_inputs、build_control_plane_composition_scenario_sources、v0 envelope 对照测试或生产默认行为,也不授予自动合入权限。
改动思路 / Approach
本片改动严格在现有测试支持所有者 loopx/control_plane/testing/ 内部完成减法收敛:经全仓检索确认现有调用链(test_actual_default_model_behavior_portfolio.py 与 scripts/qualify-doubao-model-behavior-live.py)均已直接消费 build_actual_default_model_behavior_scenario_inputs 与 build_control_plane_composition_scenario_sources,不存在保留兼容 wrapper 的外部或持久化契约需求,因此直接删除死代码与失效导入,不引入新 shim 或抽象层。
当前 PR 边界:范围锁定于删除 build_actual_default_model_behavior_scenario_packets、build_control_plane_composition_scenario_packets 及失去调用方的 build_turn_envelope 导入(-25 行);与本片无关的远端共有 kernel-static-checks 基线 F401(test_contract_health.py:10)以及真实 Ark live 模型调用保持在独立边界之外。
- 淘汰端口袋包包装器(
loopx/control_plane/testing/actual_default_model_behavior_portfolio.py):移除原 L780-788 仅转调build_actual_default_model_behavior_scenario_inputs(root)返回第二元素的build_actual_default_model_behavior_scenario_packets(root),主调用方保留直接解包(sources, packets)的单一路径。 - 淘汰组合场景 v0 envelope 旁路工厂(
loopx/control_plane/testing/control_plane_composition_scenarios.py):移除原 L214-226 的build_control_plane_composition_scenario_packets及 L6 不再被调用的from ..quota.turn_envelope import build_turn_envelope,model_behavior_corpus.py等仍实际需要的build_turn_envelope调用保持不动。
具体改动 / Changes
本次 diff 仅触及 2 个 Python 测试支持模块(0 insertions(+), 25 deletions(-)):
关键代码讲解
loopx/control_plane/testing/actual_default_model_behavior_portfolio.py(L771-785 附近):保留build_actual_default_model_behavior_scenario_inputs(root: Path)及其上游build_control_plane_composition_scenario_sources组合调用(L730-735),删除无调用者的build_actual_default_model_behavior_scenario_packets(root: Path)(9 行)。经rg与 AST 校验,其余导出常量与场景评估函数(如_turn_expected_contract)均保持原样。loopx/control_plane/testing/control_plane_composition_scenarios.py(L1-210):保留build_control_plane_composition_scenario_sources(*, goal_id: str, agent_id: str)及其 3 个组合场景源(_required_vision_replan_source、_scoped_gate_successor_replan_source、_capability_monitor_repair_source),删除无调用者的build_control_plane_composition_scenario_packets(15 行)与唯一失效导入build_turn_envelope(1 行)。
规范依据与条款映射:对照 docs/architecture/rfcs/controller-executor-unified-contract-v0/contract-and-context.md(baseline revision 6a007683b7dd90545a93ff7d00732c4518a21d54)与仓库范围收敛原则:
C1-SHARED-OWNERS:implemented — 既有build_actual_default_model_behavior_scenario_inputs与build_control_plane_composition_scenario_sources及下游单测与 qualifier 入口保持原样,未新增平行适配器。SCOPE-FIT-RETIRE-DEAD-FACTORIES:implemented — 全仓检索确认零活跃调用方后直接删除两处冗余 factory 及无用导入,无兼容 shim。
对主干的风险 / Risks
- 符号引用完整性:全仓
rg(含loopx/、tests/、examples/、scripts/、benchmark/)对build_actual_default_model_behavior_scenario_packets与build_control_plane_composition_scenario_packets均返回0命中;唯一残余build_turn_envelope导入仍在loopx/control_plane/testing/model_behavior_corpus.py:8正常使用且未被误删。 - 公共边界与默认行为:纯内部测试支持函数清理,不涉及任何运行时默认路径、权限、持久化或外部边界;
loopx check --scan-path ...报ok=True(errors=0, warnings=0)。 - 远端 CI 失败归因(
kernel-static-checksdiagnostic):gh run view --job 134437049389 --log-failed显示远端仅在基线共享测试文件tests/control_plane/test_contract_health.py:10触发F401(loopx.paths.display_report_textimported but unused),该文件在6a007683b7dd已存在相同未用导入且本 PR 未触碰,属pre_existing_unrelated。 - 本地完整验证结果(exact head
ac63488684c23fcd4cc246032e79d292353b0f10):rg -n 'build_actual_default_model_behavior_scenario_packets|build_control_plane_composition_scenario_packets' .:0 matchesuv run --extra test ruff check loopx/control_plane/testing/actual_default_model_behavior_portfolio.py loopx/control_plane/testing/control_plane_composition_scenarios.py:PASS(All checks passed)uv run --extra test mypy:PASS(Success: no issues found in 17 source files)uv run --extra test python -m pytest -q(10 个套件:test_actual_default_model_behavior_portfolio.py、test_actual_default_model_behavior_live.py、test_model_behavior_corpus.py、test_model_behavior_retained_cases.py、test_model_behavior_qualification.py、test_host_prompt_behavior.py、test_goal_task_map_composition.py、test_quota_action_portfolio.py、test_semantic_vocabulary_drift.py、test_maintainability_ratchet.py):PASS(444 passed in 142.10s,0 failed,0 skipped)uv run --extra test python scripts/qualify-doubao-model-behavior-live.py --help:PASS(exit 0,0 model calls)uv run --extra test loopx canary premerge --tier quick --from-git-diff --git-diff-base 6a007683b7dd90545a93ff7d00732c4518a21d54:PASS(ok=true,failures=0,selected=2,manual_holds=0,覆盖 4 项 direct checks、py_compile、control-plane-maintainability-ratchet-smoke.py与semantic-vocabulary-drift-smoke.py)loopx check --scan-path ...:PASS(ok=True,errors=0, warnings=0)
我的整体评价 / Verdict
- Long-horizon 影响:
preserved— 清除 2 个已无调用者的测试支持旁路工厂与 1 处无用导入,保留全部现役 source/paired-input 调用链与历史测试契约。 - User-experience 影响:
not_applicable— 仅影响内部测试支持模块loopx/control_plane/testing/,无 CLI/UI/用户流程改动;visual_review为not_applicable(无视觉或前端渲染改动,unverified_scope:none)。 - 可观测语义 / 兼容与范围 / 词表:
observable_semantics为equivalent,repository_reuse为reused,code_volume为necessary(compatibility_assessment为not_applicable,全仓零外部/持久化消费方),default_off_isolation为not_applicable(无功能开关),authority_semantics为not_applicable(无角色或权限语义变更),semantic_alignment为not_applicable(未增改任何共享状态词表或契约键)。
本 PR 为干净的无行为变化减法重构(-25 行),全部静态扫描、444 项单测与 premerge quick 门禁在 exact head ac63488684c23fcd4cc246032e79d292353b0f10 均已通过;无任何阻断问题。由于属于作者自有 loopx/control_plane/** PR,正式合入仍需维护者授权及主干 test_contract_health.py 上游 lint 同步。
English verdict: APPROVE exact head ac63488 (author-owned COMMENTED approval review); cleanly removes two unreferenced testing packet factories and one dead import (-25 lines) with zero remaining callers, 444 passing pytest cases, clean ruff/mypy, and passing quick premerge canary (remote kernel-static-checks failure is pre-existing F401 in untouched test_contract_health.py:10).
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
维护现有 C1 组合验证和默认模型行为资格工具的开发者。 旧测试支持模块同时保留只返回 packet 的旧辅助入口和活跃的成对输入 builder。 基线对两个工厂名的全树检索各有一个结果,均为定义。当前头两名均无匹配,剩余两模块的 AST 与基线一致。两侧 74 项相同调用方测试均通过。 成对 source/packet builder 和历史兼容测试仍由原调用方读取,移除 25 行停止使用的辅助代码。 范围为内部测试与发布资格的 fixture helper。用户操作入口、模型执行、权威状态和记录格式沿用原流程。
改动思路 / Approach
现有成对 source/packet builder 与标准 C1 capture 保持原所有权,测试支持目录直接移除两条闲置包装路径。 当前 PR 删除两个无调用工厂,以及唯一只服务于旧 envelope 工厂的一个导入。 分别核对字符串调用、生产语法树、真实入口帮助和活跃的文件型资格用例。历史对照需要真实消费者,保留原 tests 与 source 构造即可。
具体改动 / Changes
准确头 ac63488,merge base 6a00768,2 个文件,+0/-25。REMOVE-UNUSED-FACTORIES、RETAIN-SOURCE-PAIR、RETAIN-RAW-V0-CONTROLS 均已验证。 按修订 6a00768 的现有规范核对各项要求。 目标规范
关键代码讲解
build_actual_default_model_behavior_scenario_inputs保留原 sources 与 compact packets。删去只丢掉 sources 的包装后,release qualifier 的原调用和合成 File 路径继续通过。 成对输入build_control_plane_composition_scenario_sources继续生成场景 source。另一个闲置包装器与唯一对应的build_turn_envelope导入一并移除。历史 envelope 测试仍通过现有 owner 验证。 场景 sourcequalify-doubao-model-behavior-live.py的调用方仍使用原成对构造器。真实帮助和现有测试载入路径在准确头保留,既有代码不需要经过新 adapter。 资格入口
对主干的风险 / Risks
现有 release qualifier 的 --help 在两侧逐字相同。准确头七个发布资格入口用例通过,其中保留失败诊断、候选源码优先和只读检查。 纯测试模型用例仍覆盖缺少资格和来源漂移的拒绝,历史 raw/v0 与正常 C1 组合保持原测试控制。没有调用这些已删包装器的受支持用法。 准确头较广套件 244 项通过,额外 release CLI 7 项通过。Ruff、仓库 mypy 17 个源文件、quick premerge 六项直接及两项选定检查均通过。 树内检索纳入脚本、测试、文档和当前主干,主干仍有一处定义、无命名调用方。独立验证使用公开夹具和测试替身,实际在线模型、安装态、远端 CI 与 C1 整体迁移资格留给各自的资格流程。
我的整体评价 / Verdict
批准。现有成对 source/packet builder 与标准 C1 capture 保持原所有权,测试支持目录直接移除两条闲置包装路径。 当前 PR 删除两个无调用工厂,以及唯一只服务于旧 envelope 工厂的一个导入。 当前补丁收敛了测试支持表面,现存资格入口仍能产生原结果。真实模型与安装资格是独立验收项。
English verdict: APPROVE at ac63488. The two test-only wrappers have no active repository references. The remaining AST, seventy-four paired test outcomes and the live qualifier help match.
Goal And Delivered Outcome
清理 C1 迁移旁路中两个已经没有树内调用者的 packet factory:
build_actual_default_model_behavior_scenario_packets和build_control_plane_composition_scenario_packets。后者仍能重建 v0 envelope;两者均已被现有 source/paired-input 调用链替代。本次直接删除它们及唯一失去用途的 constructor import。Author Declaration
Scope And Continuation
本片独立完成无调用生成器退役;source 和 paired-input builders 继续由原消费者使用,TypeScript 组合与校验 owner 保持原边界。普通 quota 默认完整 C1 的生产切换仍由 #8956 交付;本片不包含其历史,也不将这次清理视为 C1 全部完成、安装采用或成果/完整成本资格。没有新增任务、协议、配置或测试框架。
Validation
ac63488684c23fcd4cc246032e79d292353b0f10;base 为6a007683b7dd90545a93ff7d00732c4518a21d54。finished;Input classes:synthetic,public_fixture。regression_paritypassedae95a6a3与最终 head 的同一组 74 项测试均通过;中间主干集成只变更 Frontier clock 文件,未变本片模块/测试。排除删除的定义和 import 后,两模块其余 AST 相同unit/integrationpassedtest_actual_default_model_behavior_portfolio.py、test_model_behavior_corpus.py、test_model_behavior_retained_cases.py、test_host_prompt_behavior.py、test_actual_default_model_behavior_live.py:74 passed,0 skipped;保留拒绝/漂移、历史对照及真实 File fixture 准备,provider 使用 test doublereal_entrypointpassed--help正常;原 runner fixture 测试验证实际脚本及物理/符号链接目录入口,0 model calls;不声称真实模型资格staticpassedstaticpassedcqr_5dee9eca003b433d61b5为 pass/valid;本地 quick premerge:6 direct + 2 catalog,全过,0 timeout/skip/manual hold;默认 120s 未改manualnot_runFrontend / Visual Evidence
none。本片仅删除无 caller 的内部测试生成器;没有新增或修改用户操作路径,截图不适用。Type of Change
LoopX Area
Shared-authority RFC fixture impact
N/A:未改 authority、provider、runtime routing 或兼容投影。
Boundary Checklist