Repository navigation
fix(gates): exempt GitHub-integrated PR merges from master direct-push audit - #171
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
目标
修复
tools/check_master_commit_scope.py(Master Direct-Push Scope Gate)将 GitHub 的 squash 和 rebase PR 合并误判为人工直推的缺陷,并在 master 上保持严格防御。根因与实测数据
_list_commits使用--no-merges --first-parent划定直推范围。该规则仅能识别多父的 merge-commit 型合并;而 GitHub squash/rebase 合并生成的是单父提交,因而被划入直推审查对象,导致 refactor(rd): converge cards.js module state into cd-state.js #165 / fix(probe): stop the fabricated vm error after a static-layer failure #166 合并后 master push 触发门禁判红(因为 PR 全量文件集不在白名单中)。committer == "GitHub <noreply@github.com>":共 180 条(154 条多父 merge,26 条单父 squash/rebase)。其中 24 条无(#NNN)标题后缀(Dependabot 依赖升级)。若按标题正则判会漏掉 24/26 = 92%。committer == 人类:1135 条(1113 条单父直推审查对象,22 条多父 merge)。人类单父中标题以Merge开头者为 0。修法设计
_is_github_integrated(committer_name, committer_email)纯谓词(name 精确匹配 "GitHub",email 忽略大小写匹配 "noreply@github.com"),识别 GitHub 代写合并;_commit_meta中通过单次git log -1 --format=%s%x00%cn%x00%ce%x00%P提取元数据,大声打印豁免原因;_is_merge_subject(subject) and is_merge_commit(≥2 父才认 merge 标题),防范单父提交伪造Merge pull request #...标题绕过检查。TDD 与四重变异证明
tests/test_ci_hardening.py新增 6 条测试,66 passed。(#NNN))⇒ B(Dependabot)变红。2e7b503..07139ac(fix(probe): stop the fabricated vm error after a static-layer failure #166 真实提交)修复前 exit 1,修复后 exit 0 且大声输出豁免原因;99b678a..8bbc844保持 exit 0;门禁与文档
ruff check .全绿;mypy --strict delector tools与mypy tests0 错误;WORKMEMORY/PROJECT_OVERVIEW.md待办第 7 条闭环,基线更新;WORKMEMORY/work.log追加规范 DONE 事件;