Skip to content

Commit 7a3b4cc

Browse files
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. ⚠️ It is a login test: a seat session on an approver's account reads as that approver's close (see S1). - [x] **N12** every ruling card within the horizon counts, not only the newest closed card. - [x] **N13** keyed rows outside every section the audit reads (a reworded heading, a row moved above the first heading) are counted and named in the refresh comment. - [x] **N14/N16/N17** the section reader skips fenced blocks, stops at the LAST footer (or its second line alone), and the comment says when no footer was found. - [x] **N15** the ruled horizon is its own constant (`AUDIT_CARD.ruledHorizonDays`, 10, pinned ≥ 7 d + the 1 h skew budget); `AUDIT_HISTORY_DAYS`'s comment says it is the clone depth only, and the overstated "a reused key is never hidden" is gone. - [x] **N18** the card body states the day bound and who rules. - [x] **S1** (review 6896878561, delta 6897204057) worded as the login test it is: the header, the docstring, the card text and this body say a close rules only when its actor login is in `GOVERNED_APPROVERS` and it names no commit, and name the residual (a seat session on an approver's account reads as that approver's close). The close event's `performed_via_github_app` is passed through as served and read best-effort, by presence: absent ⇒ unreadable, rules nothing; an object (named or not) ⇒ rules nothing; null ⇒ the login test decides. The platform serves it null on every close event today (measured 2026-11-15 on the issue-events and timeline endpoints), so the object branch does not fire today. - [x] **S2** a fence on the card closes only on its own marker (same character, at least as long, nothing after it); a fence left open is reported in the refresh comment; the quoted stderr defuses tilde fences as well as backticks. - [x] **S3** BREACH rows that do not fit the card are named by key in the refresh comment, split into this run's (in its run log and artifact) and carried ones (held by no run's reading, so the comment is their last record); the body no longer claims the run log holds carried rows. The dropped-key list is capped (500 per group, then a count), and a row that did not fit is no longer announced as new to the card. - [ ] **N1** left open: the record-carry leg diffs the reviewed head against the landed head (`lowRiskRecordVerdict`), and the job's single-branch mirror holds no pull-request head commits. A fix needs the arm leg to name the commits it lacked (the arm region of this script, held by #33765) and the clone step to fetch them before a re-sweep; outside this card's surface. The job header now documents the gap. - [ ] **N7** left open: a row the runner can never read is answered only by leaving the window. A fix is either N1's fetch or a card that accepts a seat's local re-read as the answer, which changes the card's `Maintainer-action:` contract (the maintainer's ruling); the header documents the gap and the PR-less row's own text says a re-run reads it the same way. N4 widens this class by design (a PR-less governed landing can never be read by a re-run), so it stays under N7 on the card. ## Tests - New battery `⭐ the weekly audit card: every reading the job files on, both ways (#33814)`: 54 cases, floor pinned at 54; roster floor 38 → 39. Each fixed reading is pinned with its control (the neighbouring input that must still read as before); the card step's write order and the export names the job calls are read off the workflow file itself. - `node scripts/pm/check-governed-merges.mjs --self-test` → exit 0, `799 assertions`. - `node scripts/check-platform-checklist-watchdog.mjs --self-test` → exit 0 (53 assertions); the gate itself → exit 0. - Workflow YAML parses (`yaml`); both `github-script` bodies were run end to end against a fake `github` client (create and refresh scenarios), offline. - No forced test edits. ## Acceptance notes - `stale.yml` does not exempt the `governed-merges-audit` label (`exempt-issue-labels: 'pinned,security,roadmap,tracking'`), so an open audit card idle for 74 days is closed as not planned. After this PR such a close rules nothing (its rows are announced again while in the window), but its carried rows outside the window are lost. The fix is a one-word edit to another workflow file, outside this card's surface. carrier: domain:skills seat. ## Verification Gates: `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` on the final head, each command run, reconciled with `--ran` (head 77b6b46: 56 derived, 56 run, all exit 0; `--ran`: "56 derived famil(ies) accounted for — 56 run, 0 NOT-MEASURED". CI-run families are read from this PR's check-runs, not re-run locally). --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmQ9yJPqAUnGqQvBK47)_ <!-- signed: domain:skills#1 · os-steve · session_01ADHkmPd7uRqHauEehGPr19 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent e5c2d76 commit 7a3b4cc

3 files changed

Lines changed: 754 additions & 243 deletions

File tree

0 commit comments

Comments
 (0)