fix(change-window): accept empty Git reference transactions - #4171
Conversation
Signed-off-by: huangruiteng <huangrt01@163.com>
huangruiteng
left a comment
There was a problem hiding this comment.
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
审阅 head:76246ee229bd1bfca4c2430dedcf4e4f9b072dc8。未发现剩余代码阻塞;合并等待本 head 的 CI 完成。
动机
Git 2.55 会在正常 pull --ff-only 中发出没有 ref 更新的 preparing 回调。原有 hook 把它当成非法输入,导致正常拉取失败。这是 Git 回调兼容问题,不是需要放宽时间门禁。
改动思路
只修现有分类器:零字节输入意味着没有待检查的 ref 变化,不调用时间策略。保留外层 provider 完整性检查和 previous-hook 委托,不跳过整个 hook,也不按 pull 命令名走特例。
具体改动
_reference_transaction_introduces_commit在验证 phase 后识别空事务;非空但只有空白的非法行仍拒绝。run_git_hook_provider的完整性、旧 hook 和 exit-code 处理保持原状;回归验证空事务下旧 hook 的失败码仍传播,篡改 managed hook 仍报告 drift。- 现有 Git 测试辅助函数在失败时输出捕获的合成错误,新增 preparing/prepared 参数化用例,没有增加生产模块或配置。
对主干的风险
核心反例是“修复拉取时顺便放过新 commit”。真实 Git 2.55 的安装后 fetch/pull/commit 路径已验证:修复前 pull 稳定失败,修复后成功,新本地 commit 仍被门禁拒绝。旧 Git 2.39、隔离 Linux Git 2.47 的原场景保持通过。
当前 main 基线上的 23 项门禁测试通过;新增两个空事务用例在修复前失败。Ruff、diff、DCO 与公开信息边界检查通过。较早的相同两文件补丁另有 154 Python、979 TS(含隔离真实 PostgreSQL 16.15)验证,但不冒充当前 head 的全套测试。未改动或测试生产 Goal、安装配置、发布流程;线上 CI 仍在完成最后分片。
我的整体评价
范围适当:五行生产修复放在唯一现有 owner,恢复正常 Git 使用而不减弱门禁。相关收敛检查未发现需要新增抽象的理由。批准代码;待当前 CI 通过后,按维护者授权自合并。发布/部署任务因 PR 场景跳过属于预期,不代表已升级本机。
English verdict: APPROVE 76246ee229bd1bfca4c2430dedcf4e4f9b072dc8, conditional on final CI. The existing classifier now accepts truly empty Git transactions without bypassing provider integrity, previous hooks, or commit admission. Real Git 2.55 before/after reproduction and 23 focused tests passed; no installation or production-state mutation was performed.
Summary
Treat empty Git reference transactions as no change rather than malformed input. Git 2.55 emits an empty
preparingcallback during a normalpull --ff-only; the prior hook rejects it and prevents the pull.Keep phase validation, malformed nonempty-row rejection, provider integrity checks, previous-hook delegation, and new-commit blocking unchanged. Improve the synthetic Git test helper to expose captured errors on failure.
Issue Or Task
Follow-up to the inherited CI failure diagnosed in #4101. No archive or provider-authority changes.
Validation
76246ee22(same two changed files as the previously qualified4c4abe89b).Coverage and gaps: no production Goal, live registry, external model or release change. This is a reference-transaction classifier correction, not a time-policy bypass. Hosted Python Tests run 34462222257 completed successfully, including both test shards, all three stage2c lanes and compatibility checks. The change remains in the existing built-in repository-change-window Git-hook owner; no additional abstraction or new authority is needed.
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
N/A: no Todo/provider/promotion change.
Boundary Checklist