Skip to content

fix(change-window): accept empty Git reference transactions - #4171

Merged
huangruiteng merged 1 commit into
mainfrom
codex/git-empty-transaction-repair
Sep 10, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/git-empty-transaction-repair

Conversation

@huangruiteng

@huangruiteng huangruiteng commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Treat empty Git reference transactions as no change rather than malformed input. Git 2.55 emits an empty preparing callback during a normal pull --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

  • Tested revision: 76246ee22 (same two changed files as the previously qualified 4c4abe89b).
  • Run state: completed
  • Input classes: synthetic
Check kind Result Public-safe evidence / limitation
regression_parity passed Git 2.55.0 real fetch/pull fails before the fix and passes afterward; new local commits still rejected. Older Git 2.39 and isolated Linux Git 2.47 pass the original scenario.
unit passed Both empty preparing/prepared regressions fail before the fix; 23 change-window tests pass after it, including prior-hook failure and provider drift.
integration passed Fresh 23-test run on the main-based patch passed; earlier 154 Python and 979 TS tests including isolated PostgreSQL 16.15 passed on the identical patch atop the pre-merge source.
static passed Supported Ruff, diff check, DCO and public-boundary scan.

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

  • Bug fix
  • Test update

LoopX Area

  • Capability or extension (providers, adapters, skills)

Technical Direction

  • Core control-plane hardening
  • Target base branch: main

Shared-authority RFC fixture impact

N/A: no Todo/provider/promotion change.

Boundary Checklist

  • No private state, credentials, raw traces, internal links or local machine paths.
  • No benchmark work.
  • Scoped to empty reference-transaction compatibility.
  • Every commit includes DCO sign-off.

Signed-off-by: huangruiteng <huangrt01@163.com>
@huangruiteng
huangruiteng merged commit ce7dddb into main Sep 10, 2026
18 checks passed
@huangruiteng
huangruiteng deleted the codex/git-empty-transaction-repair branch September 10, 2026 09:53

@huangruiteng huangruiteng 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.

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.

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