refactor: 近一周 PR 技术债清扫(行为保持) - #125
Conversation
对近一周(#21..#124)全部 PR 复盘后的机械债清理:仅删除 AST 级验证 「全仓零引用」的未用导入/未用名,不改任何判定逻辑、阈值、白名单或 policy 数据。逐文件出处: - pipeline/adversary/cnb_bridge.py:删未用 `from typing import Any`(#73/#74) - pipeline/adversary/golden_set.py:删未用 `from typing import Any`(#80/#82/#83) - pipeline/adversary/holdout_registry.py:删未用 `from typing import Any`(#81/#82) - pipeline/adversary/e2e/e2e-runner.py:删未用 `from typing import Any`(#89) - pipeline/adversary/llm_verifier.py:删未用 `import math`;可选库导入行去掉 未用名 extract_score(call_verifier/create_openai_client 均在用,保留)(#72/#76) - pipeline/entropy/tests/test_e2e.py:删未用 `import sys`(#56) - pipeline/selftest-c/tests/test_registry.py:删未用 `import copy`(#103) - pipeline/trust-gate/tests/test_adjudicate.py:删未用 `import copy`(#63) - pipeline/trust-gate/tests/test_cli.py:from-import 去掉未用名 PREDICATES/UNLOCK_STATE(保留 trust_gate 可导入性冒烟导入与 noqa 惯例)(#63) - scripts/dep-supply-chain-check.py:删未用 `import copy`(#36/#43) 刻意不动(已核验非死代码):各模块 `from __future__ import annotations`; fuzz/sast/symbolic 的 `_yamlmini` 双模式导入守卫(noqa F401,保证包路径); golden_set 等 try-import yaml 的环境 fail-closed 守卫;org-gate / suppression-gate / adversary-gate 等关卡 workflow 与 policy/suppressions.yaml 基线数据——门语义一概不变。 验证: - py_compile 全部 scripts/pipeline *.py 通过;bash -n 全部 *.sh 通过 - workflows/policy/pipeline 共 62 个 YAML 解析通过 - scripts/test-integrity-fixtures/run.sh、scripts/suppression-budget-selftest.sh 通过 - python -m unittest:trust-gate test_adjudicate+test_cli 17 例、 selftest-c tests.test_registry 14 例、entropy tests.test_e2e 10 例——全绿
PR Summary by QodoRemove unused imports across pipeline and gate tooling
AI Description
Diagram
High-Level Assessment
Files changed (10)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can start a comment with 'qodo' or '@qodo' to chat about any finding |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
💤 Files with no reviewable changes (8)
Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthrough本次变更删除多个生产代码和测试文件中的未使用导入。运行逻辑、公共接口和测试行为未改变。 Changes导入清理
Suggested labels: Merge Risk: ⚪ Minimal · up to This PR removes unused imports and names without changing workflow gates or runtime behavior; the localized cleanup is merge-ready after normal checks, with no actionable merge-blocking risk remaining. 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
范围与结论
对 2026-08-19 之后本仓全部 99 个 PR(#21..#124) 逐一复盘(title/body/files/diff)。本仓创建于上周内,故「近一周」即全量 PR 史。结论:代码面整体紧致——无死文件、无 bare except、shell 均有
set -euo pipefail。仅清理 12 处 AST 级验证全仓零引用的未用导入/未用名(10 文件,+2/−11)。门语义零改动:不触碰关卡 workflow 求值逻辑、verdict 语义、抑制基线数据、action SHA。全部 PR 一览(处置)
ISSUE-263 前期质量工具波(均落地,未动):
scripts/flaky-retry.sh,无债trust-gate(#63)— 本 PR 重构对象之一:
tests/test_adjudicate.py未用import copy;tests/test_cli.pyfrom-import 中未用名 PREDICATES/UNLOCK_STATE(保留import trust_gate可导入性冒烟导入)adversary ISSUE-263 波:
scripts/t14-holdout-lookup.py)— 文档化操作员 CLI 入口,保留import math、可选库导入行未用名 extract_score(call_verifier/create_openai_client 在用保留)from typing import Anytyping.Any;feat(ISSUE-263): W2-C4 holdout 注册/校验与上报回路 (#276) #81 holdout_registry v1 → 重构:删未用typing.Anytyping.Any质量仪器波(IR-0004):
_yamlmini双模式导入守卫(noqa F401)为刻意保路径手法,非死码,保留import copy运营/配置/策略类(不可动或纯数据):
重构明细(行为保持论证)
from typing import Anyfrom typing import Anyfrom typing import Anyfrom typing import Anyimport math;可选导入行去 extract_scoreimport sysimport copyimport copy_helpers模块仍完整导入import copy验证证据(本地实跑)
python -m py_compile(触达 10 文件 + 全仓 scripts/pipeline *.py)— 通过bash -n全部 scripts/pipeline *.sh — 通过bash scripts/test-integrity-fixtures/run.sh— 通过(与 ci.yml 同款自测)bash scripts/suppression-budget-selftest.sh— 通过(同款)python -m unittest:trust-gate test_adjudicate+test_cli 17 例 OK;selftest-c test_registry 14 例 OK;entropy test_e2e 10 例 OK(共 41 例全绿)门语义声明
本 PR 不修改:org-gate / suppression-gate / adversary-gate / diff-coverage / dep-review 的判定与求值逻辑;任何 verdict/threshold/EXPECTED_SKIP/exemption 语义;policy/suppressions.yaml 及一切基线数据;任何 pinned action SHA。所有变更均为导入语句级的机械删除。
Summary by CodeRabbit
重构
测试