fix(ci): correct gitlink detection in submodule gate and pr governance - #9
Merged
Conversation
Drill D5 exposed that a real SHA-bump PR reported not-applicable: git diff --raw headers are ':oldmode newmode oldsha newsha status', so awk $4 tested the new SHA instead of the mode, and the Python parser checked cols[2] (old SHA) against '160000' while extracting cols[3]/cols[4] (status letter). Match mode at cols[1] and take SHAs from cols[2]/cols[3].
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.
演练发现的真实缺陷(M4 观察期产出)
D5 演练(PR #8,真实 SHA-bump)暴露:Submodule Gate 报告 not-applicable,
而该 PR 明确包含 bt_api_ctp 的 gitlink 变更。
根因(本地已复现)
git diff --raw头部格式为:oldmode newmode oldsha newsha status:awk '$4 ~ /160000/'测试的是新 SHA 字段而非 mode → count 恒为 0cols[2] == "160000"检查的是旧 SHA;old/new 提取索引错位(取到 status)修复
按真实字段位置匹配
cols[1] == "160000"/awk '$2 == "160000"',SHA 取 cols[2]/cols[3]。验证
git diff --raw f338199b..24ad0762 | awk '$2 == "160000"' | wc -l→ 1(修复前为 0)risk:r1 — 仅 CI 检测逻辑;area:ci。