Skip to content

refactor(testing): retire unused quota and envelope packet factories - #8963

Open
loopx-agent wants to merge 1 commit into
mainfrom
codex/c1-retire-test-packet-factories-20261118t223401
Open

loopx-agent wants to merge 1 commit into
mainfrom
codex/c1-retire-test-packet-factories-20261118t223401

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

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

Criterion Disposition Evidence
无实际 caller 或明确兼容合同的 wrapper 退出 implemented 全树代码、脚本、测试及文档检索仅命中这两个定义;没有增加兼容 shim
历史对照与实际消费者保留 implemented source/paired-input builders 与历史 raw/v0、完整 C1 capture 测试保持原文;其余模块 AST 不变
  • Self-check: 已阅读完整差异、仓库规则和现有调用链;没有改写模型对照、引入新生成器或运行 live provider。

Scope And Continuation

本片独立完成无调用生成器退役;source 和 paired-input builders 继续由原消费者使用,TypeScript 组合与校验 owner 保持原边界。普通 quota 默认完整 C1 的生产切换仍由 #8956 交付;本片不包含其历史,也不将这次清理视为 C1 全部完成、安装采用或成果/完整成本资格。没有新增任务、协议、配置或测试框架。

Validation

  • Tested revision: ac63488684c23fcd4cc246032e79d292353b0f10;base 为 6a007683b7dd90545a93ff7d00732c4518a21d54。
  • Run state: finished;Input classes: synthetic, public_fixture。
Check kind Result Evidence / limitation
regression_parity passed 原始 ae95a6a3 与最终 head 的同一组 74 项测试均通过;中间主干集成只变更 Frontier clock 文件,未变本片模块/测试。排除删除的定义和 import 后,两模块其余 AST 相同
unit / integration passed test_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 double
real_entrypoint passed 两个现有 release qualifier 的 --help 正常;原 runner fixture 测试验证实际脚本及物理/符号链接目录入口,0 model calls;不声称真实模型资格
static passed Ruff 两模块;仓库配置的 mypy 17 文件;diff hygiene、全树无调用核对及源代码 AST 对照
static passed 精确 diff 的 strict change-quality 回执 cqr_5dee9eca003b433d61b5 为 pass/valid;本地 quick premerge:6 direct + 2 catalog,全过,0 timeout/skip/manual hold;默认 120s 未改
manual not_run 远端 CI 未查询;本片未改变 authority、持久化、Host、安装或 UI,不宣称这些真实产品旅程或 PG/Windows 资格

Frontend / Visual Evidence

  • UI impact: none。本片仅删除无 caller 的内部测试生成器;没有新增或修改用户操作路径,截图不适用。

Type of Change

  • Refactoring (no functional changes)

LoopX Area

  • Control plane (testing support only)

Shared-authority RFC fixture impact

N/A:未改 authority、provider、runtime routing 或兼容投影。

Boundary Checklist

  • 差异及正文不含私有状态、凭证、原始轨迹、内部链接或本机路径。
  • 未重复维护者 benchmark 或 live model 工作。
  • 仅退役已核无调用者的两个生成器;无新功能或顺带格式化。
  • 未修改 RFC 镜像;本地双语差分检查通过。
  • UI impact 为 none。
  • 唯一贡献 commit 包含 DCO sign-off。作者不合并,独立评审与维护者合并分别进行。

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(-)):

关键代码讲解

  1. 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)均保持原样。
  2. 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-checks diagnostic):gh run view --job 134437049389 --log-failed 显示远端仅在基线共享测试文件 tests/control_plane/test_contract_health.py:10 触发 F401(loopx.paths.display_report_text imported 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 matches
    • uv 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).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant