目标
让所有受管仓库的仓库级 allow_auto_merge = true 真正开启,并纳入 expected-state.json 期望状态与 drift-check.sh 漂移对账。这是"有人按 merge 按钮"的第一步替代——auto-merge 是仓库 setting 而非 ruleset,最容易静默漂移,必须机器对账。
背景(源自 #81 §2.1)
GOVERNANCE.yaml BP-4 的 intent 已声明 "auto-merge 开",但现状只有 repo_baseline.squash_only / delete_branch_on_merge 进了期望状态对账,allow_auto_merge 没有被声明、没有被对账。ruleset 管不到这个开关,它一掉(建仓遗漏、UI 误点、API 变更)auto-merge 全链路就静默死掉,而没有人会发现。
涉及文件
governance/expected-state.json(repo_baseline 段)
governance/drift-check.sh(repo settings 对账段)
governance/apply.sh(step5 仓库基线幂等修复)
governance/REPOS.yaml(如需标记豁免仓)
governance/GOVERNANCE.yaml(BP-4 的 platform/verify 声明保持同步)
执行步骤
expected-state.json 的 repo_baseline 增加 "allow_auto_merge": true。
drift-check.sh 增加 repo settings 对账:遍历 REPOS.yaml 全部受管仓,用 gh api repos/{owner}/{repo} --jq .allow_auto_merge 断言为 true,漂移则按现有通道开 issue(复用 GM-1 的漂移 issue 机制)。
apply.sh step5 增加幂等修复:gh api -X PATCH repos/{owner}/{repo} -f allow_auto_merge=true。
- 对现有全部受管仓跑一次
apply.sh,把现状补齐为 true。
- 同步 GOVERNANCE.yaml BP-4 的 verify 声明(drift-check 覆盖 repo settings)。
验收标准
- 所有受管仓
allow_auto_merge == true(gh api 逐仓断言)。
- 手动把任一仓关掉后,1 小时内 drift-check 报漂移开 issue;跑 apply.sh 后恢复;再跑 drift-check 该 issue 按既有机制自动关闭。
- gate 的 JSON 校验通过(expected-state.json 为合法 JSON 对象)。
测试方法(预先指定)
T1 漂移注入测试(核心,负向)
- 选定测试仓
Cloudbird-Software/Use-up-Plan(非关键路径仓),记录当前 allow_auto_merge 值(应为 true)。
- 手动关闭:
gh api -X PATCH repos/Cloudbird-Software/Use-up-Plan -F allow_auto_merge=false。
- 手动触发
governance-drift workflow(gh workflow run),等其完成。
- 断言:workflow 产生一条标题含
Use-up-Plan 且内容指明 allow_auto_merge 漂移的 issue(gh issue list --search "Use-up-Plan in:title")。
- 执行修复:
bash governance/apply.sh(或单仓 patch),再次触发 drift-check。
- 断言:漂移 issue 被自动关闭,
gh api repos/Cloudbird-Software/Use-up-Plan --jq .allow_auto_merge 返回 true。
T2 全量对账测试(正向)
- 对 REPOS.yaml 中每个仓执行
gh api repos/Cloudbird-Software/{name} --jq '.name + " " + (.allow_auto_merge|tostring)',断言全部输出 true。任一 false 即不通过。
T3 回归
- 向
.github 仓提交仅修改 expected-state.json 的 PR,断言 gate 全绿(JSON 校验段不红)。
依赖
无。Phase 1 首卡,所有后续卡的前提。
目标
让所有受管仓库的仓库级
allow_auto_merge = true真正开启,并纳入expected-state.json期望状态与drift-check.sh漂移对账。这是"有人按 merge 按钮"的第一步替代——auto-merge 是仓库 setting 而非 ruleset,最容易静默漂移,必须机器对账。背景(源自 #81 §2.1)
GOVERNANCE.yaml BP-4 的 intent 已声明 "auto-merge 开",但现状只有
repo_baseline.squash_only / delete_branch_on_merge进了期望状态对账,allow_auto_merge没有被声明、没有被对账。ruleset 管不到这个开关,它一掉(建仓遗漏、UI 误点、API 变更)auto-merge 全链路就静默死掉,而没有人会发现。涉及文件
governance/expected-state.json(repo_baseline段)governance/drift-check.sh(repo settings 对账段)governance/apply.sh(step5 仓库基线幂等修复)governance/REPOS.yaml(如需标记豁免仓)governance/GOVERNANCE.yaml(BP-4 的 platform/verify 声明保持同步)执行步骤
expected-state.json的repo_baseline增加"allow_auto_merge": true。drift-check.sh增加 repo settings 对账:遍历 REPOS.yaml 全部受管仓,用gh api repos/{owner}/{repo} --jq .allow_auto_merge断言为true,漂移则按现有通道开 issue(复用 GM-1 的漂移 issue 机制)。apply.shstep5 增加幂等修复:gh api -X PATCH repos/{owner}/{repo} -f allow_auto_merge=true。apply.sh,把现状补齐为 true。验收标准
allow_auto_merge == true(gh api逐仓断言)。测试方法(预先指定)
T1 漂移注入测试(核心,负向)
Cloudbird-Software/Use-up-Plan(非关键路径仓),记录当前allow_auto_merge值(应为 true)。gh api -X PATCH repos/Cloudbird-Software/Use-up-Plan -F allow_auto_merge=false。governance-driftworkflow(gh workflow run),等其完成。Use-up-Plan且内容指明allow_auto_merge漂移的 issue(gh issue list --search "Use-up-Plan in:title")。bash governance/apply.sh(或单仓 patch),再次触发 drift-check。gh api repos/Cloudbird-Software/Use-up-Plan --jq .allow_auto_merge返回true。T2 全量对账测试(正向)
gh api repos/Cloudbird-Software/{name} --jq '.name + " " + (.allow_auto_merge|tostring)',断言全部输出true。任一 false 即不通过。T3 回归
.github仓提交仅修改expected-state.json的 PR,断言 gate 全绿(JSON 校验段不红)。依赖
无。Phase 1 首卡,所有后续卡的前提。