Repository navigation
Commit 7a3b4cc
ci(fleet-patrols): the weekly audit card's readings move into check-governed-merges, each with a self-test row (#33982)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9JLcUHV5gm4BLjjD38Giz8P)_
Part of #33814
domain:skills#1 · os-steve · session_01ADHkmQ9yJPqAUnGqQvBK47
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:每周治理合并审计(Fleet Patrols 的
`governed-merges-audit`)开卡/刷新卡的读法,从工作流里的内联脚本搬进
`scripts/pm/check-governed-merges.mjs`,并修掉评审留下的读法缺陷;工作流只保留 API 调用。
- 为什么改:这些读法以前没有自测,评审挑出的十几处(没有 PR
号的治理提交被读成干净、卡片正文可能超长被拒、非审批人账号(中继机器人、stale
机器人)或合并时的关闭关键字关卡被当成你的裁决等;仍有一个已写明的残余:席位用审批人账号关卡,会被读成该审批人的裁决)都只能靠人看;现在每处都有正反两向的自测行。
- 风险与回滚:只影响审计卡怎么写,不改排程、不改卡的标签和标题、不改审计的范围;方向都是宁可多报一行。回滚就是 revert 本 PR。
- 先看:① `.github/workflows/fleet-patrols.yml` 的「File or refresh the audit
card」一步(先发评论再改正文、读关卡事件);② `scripts/pm/check-governed-merges.mjs` 新增的
`ruledAuditRows` / `auditCloseRuling`(谁关卡才算裁决,按账号判断);③ 同文件
`composeAuditCard` 的正文长度限制。
- 两分钟验证:`node scripts/pm/check-governed-merges.mjs --self-test`,应看到 `✓
check-governed-merges --self-test: 799 assertions`,结尾提到 weekly audit
card。
- 需要你做的:审一下这个 draft PR,同意后批准(工作流文件是受管面,需要 GOVERNED_APPROVERS 批准后由席位落地)。
## What changes
The weekly governed-merges audit job's two `github-script` steps now
import their readings from `scripts/pm/check-governed-merges.mjs` and
keep only the I/O: `readAuditSweep` (sweep JSON → findings),
`readAuditCardRows` (card body → keyed rows), `ruledAuditRows` /
`auditCloseRuling` (closed cards → the rows they rule),
`composeAuditCard` (findings + open card → next body and comment). The
job's schedule, card identity (label, marker, title), state label and
what it audits are unchanged.
Review follow-ups of PR #33766, triaged per item:
- [x] **N4** a governed landing whose subject names no PR now reads NOT
MEASURED (it read clean: the sweep lists it but reads no merge, review
or record for it).
- [x] **N5** the watchdog header says five jobs on five clocks.
- [x] **N8** the body is fitted under 60,000 characters (GitHub refuses
over 65,536): the quoted stderr, then NOT MEASURED rows, then BREACH
rows from the tail; one row's text is cut at 1,000 characters. The
BREACH heading and the refresh comment count the rows ON the card and
name the overflow apart.
- [x] **N9** the refresh comment is posted BEFORE the body is rewritten
(a failed comment now leaves the old body, so the rows are announced
again rather than never); a carried row the run read in another state
says which state.
- [x] **N10** a closed card rules only when the actor login of its last
`closed` event is in the queue guard's `GOVERNED_APPROVERS` and the
event names no commit: any other account's close (the relay bot, the
stale bot), a closing keyword (the event names a commit) or an
unreadable event rules nothing. 1 parent e5c2d76 commit 7a3b4cc
3 files changed
Lines changed: 754 additions & 243 deletions
File tree
- .github/workflows
- scripts
- pm
0 commit comments