Repository navigation
refactor(issue_fix): slim correction_settlement to zero-Any typed modules - #9448
loopx-agent merged 2 commits into
Conversation
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)
动机 / Motivation
受影响对象与触发场景:开发与维护 loopx/capabilities/issue_fix/correction_settlement.py 及其调用方 (pr_lifecycle.py、cli.py 与运维/自动化 PR 生命周期轮询任务) 的开发者。
改造前后对照:修改前,1,212 行的 correction_settlement.py 将公开安全输入清洗、provider 事件投影、admission/effect-gate 校验、Todo settlement 编排与跨 Goal origin-request 回传耦合在同一模块内,包含 43 处 AST Any 与 29 条 mypy 报错,导致严格静态类型检查无法收口、局部修改易波及无关路径;修改后 (1e97948),PR 将其拆分为 correction_settlement_input.py (484 行)、correction_settlement_gates.py (524 行) 与 correction_settlement.py (607 行) 三个零 AST Any、零 type: ignore 模块,并将 pr_lifecycle.py 中的 todo_intent 装配收敛为 attach_correction_todo_intent 调用 (1,160 -> 1,153 行,0 新增 Any)。
可观察收益与边界:在 File 与 SQLite 两条真实 CLI 后端路径上,v0/v1 校验、provider event 门禁、重放去重、非维护者拒批与 origin 回传保持等价,同时新增了严格类型检查收口 (4 个新/重构模块与契约测试 mypy --strict 零报错) 及对非序列字符串 missing_authority_scopes 的 fail-closed TypeError 保护。 非目标边界:本次不包含将 pr_lifecycle.py (仍余 39 处 Any) 或历史测试文件改造为零 Any,也不更改修正单外置 schema、权限策略、module_metric_baseline.json 或 TypeScript 控制面代码。
若维持原状,每次调整 maintainer correction 的输入清洗或门禁规则都必须在千行级大文件中穿过 43 处 Any 与 29 条 mypy 报错,也无法将三层职责纳入 mypy --strict 门禁。本次在保持全部公开与私有调用契约不变的前提下,把三个拆分子模块及对应契约测试一次收口到零 Any 与可逆边界。
改动思路 / Approach
| 阶段 / 职责 | 归属模块 (1e97948b01) |
关键设计约束 |
|---|---|---|
| 输入清洗与事件规范化 | correction_settlement_input.py (484 LOC) |
收拢 schema/status 常量、_public_source_reference、normalise_issue_fix_maintainer_correction_input 与 normalise_issue_fix_pr_source_events |
| 门禁判定与 Transition 构建 | correction_settlement_gates.py (524 LOC) |
仅从 .github_public 导入 MAINTAINER_ASSOCIATIONS,去重 _matching_observed_event_revision / _source_event_updated_at,新增 attach_correction_todo_intent |
| 账本编排与 Origin 回传 | correction_settlement.py (607 LOC) |
显式 re-export 全部 origin/main 符号,保留 _require_origin_registry (load_project_registry 唯一白名单调用点)、_inspect_origin_request、_deliver_origin_returns 与 _settle_maintainer_correction_entries |
| 调用点与契约护栏 | pr_lifecycle.py (1,153 LOC)、test_issue_fix_correction_settlement_contract.py (252 LOC) |
pr_lifecycle.py 复用 attach_correction_todo_intent(净减 7 行);契约测试锁定 <700 LOC / 零 Any / 身份复用与 fail-closed 边界 |
架构拆分评估(change_proportionality.architecture_assessment):将无状态公开输入清洗与 schema/事件规范化固定在 correction_settlement_input.py,将纯内存 admission/effect-gate 判定、transition preview 与 todo_intent 装配固定在 correction_settlement_gates.py,而将依赖持久化账本读写、_require_origin_registry 隔离校验与跨 Goal origin-request 回传投递保留在 correction_settlement.py,并通过显式 re-export 与 Protocol 签名保持 cli.py、pr_lifecycle.py 及测试 monkeypatch 接缝稳定。 当前 PR 边界仅覆盖 correction_settlement* 三模块拆分、pr_lifecycle.py 单处装配 helper 收口与契约测试;pr_lifecycle.py 其余 Any 与历史测试文件的类型清理留作安全后续项。
对于从 pr_lifecycle.py 下沉的 attach_correction_todo_intent,未在 pr_lifecycle.py 保留双份装配逻辑,而是直接以类型收窄后的单一 helper 对 admission["entries"][0]["todo_intent"] 赋值;针对 _roundtrip.report 与 _inbox.reply_status 的动态接缝,在 _deliver_origin_returns 中采用局部 Protocol(_ReportFn / _ReplyStatusFn)和 cast,既满足 mypy --strict 无 Any,又不破坏已有单测对模块/函数属性的 monkeypatch。
具体改动 / Changes
依据可验证基线规范 docs/development/testing-and-quality.md(固定审计版本 50aa5b4fd1c88b7225fc30e58423120e3ad5d426,Refactor Real-Path Gate / 重构真实路径门),逐项核对如下:
RQ-PARITY:implemented — 真实python -m loopx.cli issue-fix pr-lifecycle --execute-transition在 File(观察指纹d8e0dfa64db30d01)与 SQLite(观察指纹c1123a5c5c7f9f0b)双后端上的基线50aa5b4fd1与 Head1e97948b01输出完全一致(含v1接纳落盘、write/publishscope 传递、重放不新建重复 Todo、以及CONTRIBUTOR拒批转context_only);tests/capabilities/test_issue_fix_*.py、tests/architecture/与tests/canary/共2,299 passed, 6 skipped。RQ-SENSITIVITY:implemented — 通过在隔离临时工作树中故意令attach_correction_todo_intent丢弃required_write_scopes,同一 SQLite CLI 契约用例的独立验收断言立即失败(todo_required_write_scopes变为None),恢复未改动1e97948b01后即通过(["write", "publish"])。RQ-OWNERS:implemented —tests/architecture/test_source_session_registry_denial.py(核验load_project_registry在correction_settlement.py中仅允许存在于_require_origin_registry)与tests/architecture/test_issue_fix_maintainer_association_owner.py(核验MAINTAINER_ASSOCIATIONS is github_public.MAINTAINER_ASSOCIATIONS)全部原样通过,且loopx/*.py == 112与module_metric_baseline.json未被改动。
关键代码讲解
normalise_issue_fix_maintainer_correction_input:接收Mapping[str, object](兼容MappingProxyType),校验字段白名单、v0/v1与source_event的互斥/必填约束,通过_public_source_reference与_compact_public_text拒绝本机路径、内网/本地主机 URL、查询参数及<!--/-->标记,并返回零Any的标准化载荷与correction_fingerprint。evaluate_issue_fix_maintainer_correction_admission:基于规范化事件与normalise_issue_fix_pr_source_events提供的无正文 provider 事件执行 5 项门禁(存在性与updated_at瞬时匹配、禁止旧修订回退stale_revision、禁止[bot]作者、通过github_public.MAINTAINER_ASSOCIATIONS校验维护者身份、拒绝MERGED/CLOSED终态),并在newer修订时将前序条目标记为superseded。attach_correction_todo_intent:替代此前内联在pr_lifecycle.py的字典拼接逻辑,对entries[0]、role与required_write_scopes做显式运行时类型收窄,确保agentTodo 保留完整写入作用域而userTodo 为None。此外maintainer_correction_transition对直接传入非序列字符串missing_authority_scopes改为显式抛出TypeError,避免逐字符拆解字符串。_settle_maintainer_correction_entries:结合拆出的_inspect_origin_request与_deliver_origin_returns管理两段持久化流程——在创建 Todo 前通过_goal_stopped_for_correction、recheck_issue_fix_maintainer_correction_effect_gates与 origin-request 状态复核 fail-closed 拒批,并在已完成后针对新head持久化pending_return后调用_roundtrip.report(通过_ReportFn/_ReplyStatusFnProtocol 维持零Any与 monkeypatch 兼容性)。
对主干的风险 / Risks
- 阻断项:无(No blocking findings)。
- 已验证负向与边界路径:
36组基线50aa5b4fd1vs Head1e97948b01成对对照探针全部符合预期(35组字节等价;1组显式安全收敛改进:maintainer_correction_transition拒绝直接传入str型missing_authority_scopes,此前基线将其误拆为单字符列表['w','r','i','t','e'],现抛出TypeError)。- 通过
pr-lifecycleCLI 与单测验证本地/不安全source_ref拒绝、bot/CONTRIBUTOR拒批、中断故障 env (LOOPX_ISSUE_FIX_FAULT_BEFORE_CORRECTION_TODO) 恢复、以及origin_request缺失/篡改/取消 fail-closed 拦截。
- 非阻断观察与残余风险(Residual risk):
tests/capabilities/test_issue_fix_maintainer_correction_admission.py:615直接索引normalized["source_event"]["body_captured"],因返回注解从dict[str, Any]收严为dict[str, object],单独对未标注类型的测试文件执行mypy时该文件报错由基线65条变为66条(相邻test_issue_fix_correction_origin_return.py由73降为72条;tests/不在pyproject.toml [tool.mypy].files门禁范围内,且全部生产代码及cli.py、pr_lifecycle.py与新契约测试均为0mypy 错误)。correction_settlement_gates.py:23中_CorrectionTodoIntentTypedDict(及correction_settlement.py:22的重导入)目前未被任何签名引用,属可安全后续清理的无害冗余符号。correction_settlement.py:446-462,584-600中若外部人为伪造空的origin_request: {}写入 ledger,if raw_origin:会跳过_inspect_origin_request但origin_map为非None空字典,触发ValueError("origin request identity unavailable");在真实 CLI (_resolve_origin_request) 中只会持久化None或完整非空字典,不构成现实可达风险。- 本 PR 验证范围覆盖静态检查、
canary premerge、issue_fix/architecture/canary共2,299项pytest与 TS digest 单测,未运行仓内其余非issue_fix全量 pytest 用例及远程 GitHub Actions(wait_for_ci: false)。
我的整体评价 / Verdict
- Long-horizon 与 UX 评估:
long_horizon为preserved——File 与 SQLite 双后端上的真实 CLI 多轮重放、中断恢复、修订 supersede 与 origin 回传投递行为完全一致;user_experience为preserved——CLI 响应字段、Todo 写入与可读诊断信息保持一致且新增类型安全保障。visual_review:not_applicable(本次仅修改 Python capability 内部模块与 CLI 链路,未涉及前端界面、TUI 或渲染输出变更 (已核查 loopx/capabilities/issue_fix/ 下 4 个运行时文件与 1 个测试文件)。 未验证范围:none)。 - 代码体积与语义词汇对齐:本次拆分让
correction_settlement*三模块全部控制在<= 607LOC、0ASTAny、0 # type: ignore(此前单文件1,212LOC /43ASTAny/29mypy 错误),pr_lifecycle.py净减7LOC(1,160 -> 1,153LOC,仍保留39Any不变);语义词汇上完全复用既有github_public.MAINTAINER_ASSOCIATIONS与原MAINTAINER_CORRECTION_*封闭常量集,未新增或改名控制面词汇。 - 验证摘要 (
1e97948b01, 本地验证,不等待远端 CI):ruff5/5PASS;mypy --strict(correction_settlement*+ 契约测试4/4) PASS;跨调用方mypy(cli.py+pr_lifecycle.py2/2) PASS;npm run typecheck:control-plane与tests/control_plane_ts/content_digest_single_owner.test.ts(17/17) PASS;scripts/check_rfc_bilingual.pyPASS;Goalloopx check(5files,0errors) PASS;Goalcanary premerge --from-git-diff --git-diff-base 50aa5b4fd1c88b7225fc30e58423120e3ad5d426PASS(direct=6/6,catalog=9/9,failures=0,manual_holds=0);定向pytest -n 6306 passedPASS;pytest -n 6 tests/capabilities/test_issue_fix_*.py tests/architecture/ tests/canary/2,299 passed, 6 skippedPASS(6skips 均为 macOS APFS 不支持非 UTF-8/root 文件名)。架构与未来扩展评审:将无状态公开输入清洗与 schema/事件规范化固定在 correction_settlement_input.py,将纯内存 admission/effect-gate 判定、transition preview 与 todo_intent 装配固定在 correction_settlement_gates.py,而将依赖持久化账本读写、_require_origin_registry 隔离校验与跨 Goal origin-request 回传投递保留在 correction_settlement.py,并通过显式 re-export 与 Protocol 签名保持 cli.py、pr_lifecycle.py 及测试 monkeypatch 接缝稳定。 当前 PR 边界仅覆盖 correction_settlement* 三模块拆分、pr_lifecycle.py 单处装配 helper 收口与契约测试;pr_lifecycle.py 其余 Any 与历史测试文件的类型清理留作安全后续项。
English Verdict: APPROVE — Clean three-module zero-Any split of correction_settlement.py (484/524/607 LOC, 0 AST Any, 0 # type: ignore, 0 strict mypy errors) that shrinks pr_lifecycle.py by 7 lines, preserves every architecture guard (_require_origin_registry, MAINTAINER_ASSOCIATIONS) and File/SQLite CLI parity across 2,299 tests and canary premerge with no blocking findings.
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
受影响的是依靠 issue-fix PR lifecycle 回执续跑更正结论的操作者和跨会话接收方。
分别用 File 与 SQLite 建立隔离 Goal 和本地请求,完成更正 Todo 并读回 queued 后,让原请求文件暂时不可读。随后以另一 revision 重进同一原生 CLI。 两版在请求可用时排队一次。原请求恢复后重放返回 queued,结论正文与已保存记录均保持原样。
本轮核对已排队结论的恢复可观测性。原请求暂不可用时,File 与 SQLite 的基线都继续返回上一条 queued,候选两种 backend 都省略 return_delivery。回传存储与 ledger 项仍存在,两版这一步均未排队新结论。
使用两个隔离本地 provider,实际写入临时 Todo 与本地回传队列。未连接真实外部回传渠道或远程 CI。 验收依据
改动思路 / Approach
更正结算继续用既有 lifecycle 账本、原请求控制与 manager return owner,保持来源修订匹配、请求身份和权限隔离。 验证经过 loopx issue-fix pr-lifecycle --execute-transition 的隔离原生 CLI。
把有权排队新回传的检查与既有回执读回分开。保留原请求不可用时对新回传的拒绝,按同一绑定返回已保存的回执,或明确返回该笔已有结果的未验证状态。
具体改动 / Changes
精确 head 1e97948b018d682150833674fc12204030b7ec0c,目标分支快照与实际分叉基线均为 50aa5b4fd1c88b7225fc30e58423120e3ad5d426。改动 5 文件,增加 1,690 行、删除 1,042 行。输入与 admission 拆成两个模块。主模块负责原请求、Todo 与回传。精确匹配事件修订后读取同一条 provider 记录,原请求异常时读回分支发生变化。
关键代码讲解
_settle_maintainer_correction_entries。当前把识别原请求与已经排队回执的读取放在相同条件。 源码_inspect_origin_request。就原请求不可读返回拒绝,阻止新结果入队。 源码_deliver_origin_returns。同时执行报告入队和既有结果状态投影。 源码evaluate_issue_fix_maintainer_correction_admission。先核验确切源事件修订与当前决定。 源码
对主干的风险 / Risks
[P2] 原请求不可用时已排队回执从结果中消失
原请求暂不可用时,File 与 SQLite 的基线都继续返回上一条 queued,候选两种 backend 都省略 return_delivery。回传存储与 ledger 项仍存在,两版这一步均未排队新结论。
在恢复窗口,候选回执无法显示先前的结果是否仍在队列。操作者少了从同一入口判断等候原结论或开始恢复所需的证据。 相关源码
独立验证
168 passed in 443.56s (0:07:23)。 候选本地标准 premerge 通过。 两版在请求可用时排队一次。原请求恢复后重放返回 queued,结论正文与已保存记录均保持原样。
我的整体评价 / Verdict
REQUEST_CHANGES。 把有权排队新回传的检查与既有回执读回分开。保留原请求不可用时对新回传的拒绝,按同一绑定返回已保存的回执,或明确返回该笔已有结果的未验证状态。 请用同一组输入复验修复,并保留基线读回。
English verdict: REQUEST_CHANGES at 1e97948. Preserve established return-delivery readback when request inspection is unavailable, while continuing to block any new enqueue.
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
处理维护者更正的操作者通过 issue-fix PR lifecycle 观察已完成的补丁 Todo 和发给原发起人的结论。
结论已排队时,原请求文件可能暂时读不到。主干在拒绝新增回传的同时仍显示已排队回执;上一候选丢了这个状态,操作者无法判断之前是否成功,可能反复触发重试。
当前提交保留已保存回执的读回,临时不可用时没有新回传,恢复后可按新提交正常推进。现有来源、去重和授权门禁继续适用。
验证仅覆盖临时 File 与 SQLite Goal 和本机回传队列。外部消息实际送达和远程 CI 均未验证。
按 loopx/capabilities/issue_fix/README.md 中已接受的合同复审,规范版本 50aa5b4fd1c88b7225fc30e58423120e3ad5d426。
- CORRECTION-01。v0 保留 host-asserted 诊断,v1 仍需要可核验的当前 provider 事件,写 Todo 前再查角色、修订、停止与终态。 在
evaluate_issue_fix_maintainer_correction_admission / recheck_issue_fix_maintainer_correction_effect_gates对照验证。 - CORRECTION-02。同一 operation 和提交至多一次回传,未证实或已取消的原请求不允许新 enqueue,已保存回执可独立读回。 在
_inspect_origin_request / _deliver_origin_returns对照验证。
改动思路 / Approach
在现有 issue-fix 能力内保留一套 admission、Todo 和 return owner。故障时既有读回与新增回传的授权沿原边界分开。
当前 PR 交付同一 lifecycle CLI 的 typed 重构和同头恢复,保留 v0 输入与 v1 事件契约。
这里需要比较原调用者的结果与负例。已有评审和类型统计提供范围线索,实际的验收来自同一输入在三个提交的对照。
具体改动 / Changes
精确头 229b5e672ef23f521288488ee128bd533c0feaad,基线 50aa5b4fd1c88b7225fc30e58423120e3ad5d426。复审用前次候选 1e97948b018d682150833674fc12204030b7ec0c 确认回归敏感性,并核对完整变更路径。
normalise_issue_fix_maintainer_correction_input。从高风险自由文本边界选出受限 v0/v1 输入字段。evaluate_issue_fix_maintainer_correction_admission。依事件和当前参与者身份判断既有准入。recheck_issue_fix_maintainer_correction_effect_gates。写入前重查事件修订、归属、停止和终态。_deliver_origin_returns。只在授权时尝试新排队,独立读回既有回执。_attach_correction_todo_intent。生命周期调用合规的单一 Todo 意向装配。
差异覆盖 6 个文件,+1738 / -1042。拆分降低局部耦合,重导出维持一个真实实现。显式类型与失效检查增加了总行数。
对主干的风险 / Risks
原生 CLI 经 File 和 SQLite。基线和现头同一测试 14 passed,覆盖普通去重、取消、账本写失败后从旧发布重放、原请求短时不可读并恢复。
旧候选在 File/SQLite 两臂均丢失已有 return_delivery(2 failed, 12 passed)。主干与现头同夹具均 14 passed。
本地定向检查 170 passed in 551.10s。Ruff 与 strict mypy 通过。首次标准风险检查结果为 failed,直接检查全部通过,下面列出未过项及后续证据。
远端发送与实际收件界面没有连接。已验证的是本机 durable queue 与原生读回。 并行 premerge 中 vocabulary 探测最初缺少 npm 依赖,lifecycle smoke 到达并行时限。补齐依赖后两项在同一精确头各自通过,完整并行门未冒称绿色。
provider metadata 是固定合成输入,执行路径使用真实本机 File 和 SQLite ledger、Todo、请求与 outbox。没有触发外部报告。
我的整体评价 / Verdict
APPROVE。现头关闭了上一轮复现的缺口,仍从现有入口保留普通调用和失效恢复。合并条件由 GitHub 和维护者另行判断。上述风险仍留在各自的检查范围和原始回执中。
English verdict: APPROVE. 229b5e6 preserves stored return readback without re-enqueue when origin input is unreadable. File and SQLite replay passed.
229b5e6 to
c09a321
Compare
…ules Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…equest is unreadable Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
c09a321 to
76db22e
Compare
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · deepseek-flash · DeepSeek · runtime_reported · high
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
处理维护者更正的操作者通过 issue-fix PR lifecycle 观察已完成的补丁 Todo 和发给原发起人的结论。
结论已排队时,原请求文件可能暂时读不到。主干在拒绝新增回传的同时仍显示已排队回执;上一候选丢了这个状态,操作者无法判断之前是否成功,可能反复触发重试。
当前提交保留已保存回执的读回,临时不可用时没有新回传,恢复后可按新提交正常推进。现有来源、去重和授权门禁继续适用。
验证仅覆盖临时 File 与 SQLite Goal 和本机回传队列。外部消息实际送达和远程 CI 均未验证。
按 loopx/capabilities/issue_fix/README.md 中已接受的合同复审,规范版本 50aa5b4fd1c88b7225fc30e58423120e3ad5d426。
- CORRECTION-01。v0 保留 host-asserted 诊断,v1 仍需要可核验的当前 provider 事件,写 Todo 前再查角色、修订、停止与终态。 在
evaluate_issue_fix_maintainer_correction_admission / recheck_issue_fix_maintainer_correction_effect_gates对照验证。 - CORRECTION-02。同一 operation 和提交至多一次回传,未证实或已取消的原请求不允许新 enqueue,已保存回执可独立读回。 在
_inspect_origin_request / _deliver_origin_returns对照验证。
改动思路 / Approach
在现有 issue-fix 能力内保留一套 admission、Todo 和 return owner。故障时既有读回与新增回传的授权沿原边界分开。
当前 PR 交付同一 lifecycle CLI 的 typed 重构和同头恢复,保留 v0 输入与 v1 事件契约。
这里需要比较原调用者的结果与负例。已有评审和类型统计提供范围线索,实际的验收来自同一输入在三个提交的对照。
具体改动 / Changes
精确头 76db22e6645ff6af9b91fce022ac5f6f81c2a754,基线 50aa5b4fd1c88b7225fc30e58423120e3ad5d426。复审用前次候选 1e97948b018d682150833674fc12204030b7ec0c 确认回归敏感性,并核对完整变更路径。
normalise_issue_fix_maintainer_correction_input。从高风险自由文本边界选出受限 v0/v1 输入字段。evaluate_issue_fix_maintainer_correction_admission。依事件和当前参与者身份判断既有准入。recheck_issue_fix_maintainer_correction_effect_gates。写入前重查事件修订、归属、停止和终态。_deliver_origin_returns。只在授权时尝试新排队,独立读回既有回执。_attach_correction_todo_intent。生命周期调用合规的单一 Todo 意向装配。
差异覆盖 6 个文件,+1738 / -1042。拆分降低局部耦合,重导出维持一个真实实现。显式类型与失效检查增加了总行数。
对主干的风险 / Risks
原生 CLI 经 File 和 SQLite。基线和现头同一测试 14 passed,覆盖普通去重、取消、账本写失败后从旧发布重放、原请求短时不可读并恢复。
旧候选在 File/SQLite 两臂均丢失已有 return_delivery(2 failed, 12 passed)。主干与现头同夹具均 14 passed。
本地定向检查 170 passed in 551.10s。Ruff 与 strict mypy 通过。首次标准风险检查结果为 failed,直接检查全部通过,下面列出未过项及后续证据。
远端发送与实际收件界面没有连接。已验证的是本机 durable queue 与原生读回。 并行 premerge 中 vocabulary 探测最初缺少 npm 依赖,lifecycle smoke 到达并行时限。补齐依赖后两项在同一精确头各自通过,完整并行门未冒称绿色。
provider metadata 是固定合成输入,执行路径使用真实本机 File 和 SQLite ledger、Todo、请求与 outbox。没有触发外部报告。
当前 exact head 复核 / Rebased-head validation
PR #9448 已无冲突 rebase 到 origin/main e9bcad9aab48842459252c7347bd8fdbdde866db,当前精确头为 76db22e6645ff6af9b91fce022ac5f6f81c2a754。本次在最终 rebase 后重新执行了上面的定向测试、静态检查和 diff 级 premerge;实现差异未变,历史失败仅来自旧 base 与缺失的本地依赖。
Final rebased exact head checks: 80 correction-settlement/lifecycle tests, strict mypy on 5 files, Ruff and diff checks passed. The standard premerge gate passed all 6 direct checks and all 9 selected catalog canaries with zero failures or manual holds.
我的整体评价 / Verdict
APPROVE。现头关闭了上一轮复现的缺口,仍从现有入口保留普通调用和失效恢复。合并条件由 GitHub 和维护者另行判断。上述风险仍留在各自的检查范围和原始回执中。
English verdict: APPROVE. 76db22e preserves stored return readback without re-enqueue when origin input is unreadable. File and SQLite replay passed.
Summary
Modularize
loopx/capabilities/issue_fix/correction_settlement.py(1,212LOC,44Any,29baselinemypyerrors) into three< 630LOC strict Zero-Anymodules insideloopx/capabilities/issue_fix/, preserving every architecture guard, monkeypatch seam, and public/caller symbol:loopx/capabilities/issue_fix/correction_settlement_input.py(484LOC,0ASTAny,0 # type: ignore): owns maintainer-correction schema/status constants,_upper_label,_timestamp,build_issue_fix_transition_preview,_compact_public_text,_public_source_reference,_normalise_provider_event_id,_normalise_author_login,_normalise_event_timestamp,normalise_issue_fix_maintainer_correction_source_event,normalise_issue_fix_maintainer_correction_input,issue_fix_maintainer_correction_operation_id, andnormalise_issue_fix_pr_source_events.loopx/capabilities/issue_fix/correction_settlement_gates.py(524LOC,0ASTAny,0 # type: ignore): importsMAINTAINER_ASSOCIATIONSsolely from.github_public, deduplicates_matching_observed_event_revisionand_source_event_updated_at, ownsevaluate_issue_fix_maintainer_correction_admission,recheck_issue_fix_maintainer_correction_effect_gates,maintainer_correction_transition,attach_correction_todo_intent,_goal_stopped_for_correction,_CorrectionTodoIntent,_write_maintainer_correction_todo,_maintainer_correction_todo_write_receipt, and_correction_todo_readback_receipt.loopx/capabilities/issue_fix/correction_settlement.py(624LOC,0ASTAny,0 # type: ignore): explicitly re-exports allorigin/mainconstants and helpers, keeps_require_origin_registry(withload_project_registryisolated to that exact allowlisted function pertests/architecture/test_source_session_registry_denial.py), preserves_resolve_origin_request_identityand_settle_maintainer_correction_entries, and separates new enqueue authorization from savedreturn_deliveryreadback in_deliver_origin_returns(identity: _OriginRequestIdentity | None)so temporarily unreadable original request files still block new enqueues while preserving savedreturn_deliverystatus across File and SQLite backends.loopx/capabilities/issue_fix/pr_lifecycle.py(1,160 -> 1,153LOC,0newAny,0 # type: ignore): calls_attach_correction_todo_intent(maintainer_correction_admission, transition)instead of indexing unnarroweddict[str, Any]scopes directly, yielding0errors acrosscli.pyandpr_lifecycle.py.tests/capabilities/test_issue_fix_correction_settlement_contract.py(252LOC,0ASTAny,0 # type: ignore): verifies<700LOC /0ASTAny/0 # type: ignore,MAINTAINER_ASSOCIATIONS&_input/_gatesowner identity,MappingProxyTypenormalization and local/unsafe path rejection,attach_correction_todo_intent, admission & effect-recheck revision/terminal gates, and_resolve_origin_request_identityfail-closed rejection.tests/capabilities/test_issue_fix_correction_origin_return.py(462LOC,0ASTAny,0 # type: ignore): adds paired[file, sqlite]regression testtest_temporary_unreadable_origin_request_preserves_saved_return_deliveryproving0new enqueues and savedreturn_delivery(status: "queued") preservation when the original request file is unavailable, plus clean replay after restoration (verified to fail onHEAD~1and pass on229b5e672e).Boundaries & Guards
loopx/*.py == 112unchanged;loopx/canary/module_metric_baseline.jsonuntouched.tests/architecture/test_source_session_registry_denial.py(_require_origin_registry+load_project_registry) andtests/architecture/test_issue_fix_maintainer_association_owner.py(github_public.MAINTAINER_ASSOCIATIONSsingle owner) pass unchanged.issue_fixadmission and origin-return suites remain green across both File and SQLite backends.Verification (
HEAD229b5e672ef23f521288488ee128bd533c0feaad)mypy --strict --follow-imports=silent(5 files) &mypy --no-incremental --follow-imports=silent(6 files incl.cli.py&pr_lifecycle.py):0errors;ruff check(6/6files): passed.HEAD~1check (test_temporary_unreadable_origin_request_preserves_saved_return_delivery[file, sqlite]):FAILEDonHEAD~1(KeyError: 'return_delivery'),PASSEDonHEAD.pyteston clean detached checkout229b5e672e:125 passed in 287.72s(test_issue_fix_correction_origin_return.py,test_issue_fix_correction_settlement_contract.py,test_issue_fix_maintainer_correction_admission.py,0skipped) and2,301 passed, 6 skipped in 255.51sacrosstests/capabilities/test_issue_fix*.py,tests/canary/, andtests/architecture/(6APFS filename/root skips intest_git_path_display.py,0failures).npm run typecheck:control-planeclean,node --test tests/control_plane_ts/content_digest_single_owner.test.ts(17/17),scripts/check_rfc_bilingual.py(passed),examples/control_plane/control-plane-maintainability-ratchet-smoke.py(ok),examples/semantic-vocabulary-drift-smoke.py(34/34,62/62), repositoryloopx check(6files,0errors), Change Quality Receipt (status: valid), andloopx canary premerge --from-git-diff --git-diff-base origin/main(gate.status: passed,direct: 6/6,catalog: 9/9,failures: 0,manual_holds: 0).