Skip to content

Commit 8559ee1

Browse files
fix(pm): label-write --land refuses a breaking or narrowing pull with no dogfood battery on its head (#34303)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9RUGLxu1bfxBpvBrdeUz4Ky)_ Part of #34204 Remainder 2 stays on the card: review#2's S3 (a clause on `landing-operations.md:60` that `--land` judges this, plus one ↔ case binding that text to the gate). It touches governed rules text, so it waits until open PR #34301 merges on the same file; the seat keeps the card open. Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:`label-write --land`(席位落地 PR 的那一笔)现在先看 PR 是不是破坏性(标题 `!`)或收窄(`Clause-②:` 带 `(narrowing)`);是的话,必须在卡上最新的可信 `os-dev-report` 里看到 `dogfood_battery` 跑在当前 head(或 head 之下只隔着合并 main 的提交)上,否则拒绝落地、一笔都不写。 - 为什么改:PR 侧 CI 按设计不跑 dogfood 分片,这类 PR 全靠 dev 手跑;#31518 七天复读里没跑就入队的 6 个根因带出 18 次连坐弹出。拒绝挪到入队之前,省下整批队列。 - 风险与回滚:只碰 `scripts/pm/label-write.mjs` 一个文件,不发布;无标记的 PR 不判、行为与读取次数不变;读不出就拒(宁可误拦),平台没答的读以 exit 3 报前提不足、判定拒绝以 exit 2。回滚 = revert 本 PR。本 PR 用 `Part of`:S3(`landing-operations.md` 一处补句)等 #34301 合并后另做。 - 先看:`scripts/pm/label-write.mjs` 的 `landDogfoodGate`(合并链的判定)、`foldStroke` 里闸门的位置(在评论判定和任何发送之前)、自测新电池 `the --land dogfood gate`。 - 两分钟验证:`node scripts/pm/label-write.mjs --self-test`,预期 `273 cases pass across 17 batteries`。 - 需要你做的:无,席位落地(落地闸门,席位先交 review#2 做契约复审)。 ## What changes `scripts/pm/label-write.mjs` only. - **The gate** (`landDogfoodGate`, header section "`--land` on a breaking or narrowing pull"). On a `--land` stroke, before the verdict comment is judged and before anything is packed or sent: - **Marker**, read off step ①'s own card read (the issues endpoint answers a pull's `title` and `body`, so an unmarked pull costs zero extra reads): everything before the title's first colon, ending in `!` (`titleBreakingMarker`), or a `(narrowing)` arm on the body's `Clause-②:` line read by `clause2-line.mjs`'s one reader (`readClause2Line`). The title form agrees with the changeset-side reader (`check-adr-0087-registration.mjs`, type, optional scope, `!:`) on all 1331 bang subjects among the 8521 commit subjects of `origin/main` at `22438726f`, 0 disagreeing; the header says so. A `malformed` or `near-miss` `Clause-②:` line is unreadable and refuses ("make the `Clause-②:` line read"), following that file's own fail-closed direction; a body with no `Clause-②:` line at all is not judged, as Check Changeset reads it. No marker means not judged; the stroke lands exactly as today. - **Report**: the card the pull delivers (`deliveredCardNumber` from `record-recognisers.mjs`), its whole thread paged (`LAND_COMMENT_PAGE_CAP` = 30 pages of 100), filtered to trusted authors (`recordAuthorTrusted` / `recordTrustedAuthors(RELAY_COMMENT_AUTHOR)`, the record leg's set: the relay identity and `GOVERNED_APPROVERS`), then the newest `os-dev-report` by `latestMarkedComment(…, OS_DEV_REPORT_MARKER)`, and its `dogfood_battery` read through `devReportPayloadCandidates` (the shape `check-handover.mjs`'s `reportedStatus` uses). No second parser. When that report's `pr` field names another pull (sibling pulls on one card), the gate takes the newest trusted report whose `pr` names this pull, or refuses when none does; a `pr` of null keeps the newest. - **Sha**: the battery text must open with a 7 to 40 hex sha. It passes when that sha prefixes the pull's head, or when a first-parent walk from the head reaches it over merges of the base alone. The exact test at each step: `GET /repos/R/commits/C` must answer exactly two parents; `GET /repos/R/compare/P2...BASE` must answer `ahead` or `identical` (the base branch holds the second parent); then step to the first parent. At most `LAND_MERGE_HOP_CAP` = 20 hops. - **Fail closed**: an unreadable title or `Clause-②:` line, a pull with no full head sha, no card, a truncated thread or a page that is no list, no trusted report (or none naming this pull), no readable `dogfood_battery`, `n/a`, no sha, a one-parent commit, a second parent the base does not hold, or a walk past the cap: each is a judged refusal, exit 2, zero writes (no `pr_ready`). A gate read the platform did not answer (the pull, a thread page, a commit or a compare: refused, failed or rate-limited) is exit 3, PREREQUISITE, like every other unread in this file, also with zero writes. The line quotes the title (capped at `quoteLine`'s 160) and names the marker, the report comment id and its `dogfood_battery` text, the reason, and what clears it (`landDogfoodRefusal`). A truncated thread's remedy is to report it to the maintainer. - The ✓ line says `sha judged only`: whether the battery was full and its reds fixed or reported stays `l1-review-checklist.md:48`'s. - Header and `--help` text describe the gate; exit 2 now also covers its refusal. - Both round-0 choices were accepted by the seat and review#2 (record 6908045917): untrusted-author reports are ignored, and the `(narrowing)` marker is read from the body's `Clause-②:` line. ## Tests New self-test battery `the --land dogfood gate` (46 cases, pinned; `SELF_TEST_BATTERY_FLOOR` 16 → 17). The card's rows both ways: `!` + `n/a` refused; `!` + run on the head passes; `(narrowing)` + run on an older non-merge ancestor refused; `!` + run one (and two) main merges below the head passes; no marker is not judged and makes the same four reads as before; every fail-closed case refuses with its own reason; newest-trusted-report ordering both ways; a newer untrusted report ignored; the hop cap exactly at and one past. Round 1 added: the quoted title and its cap; a near-miss `Clause-②:` line refused and an absent one not judged; exit 3 for each unread (pull, thread, rate-limited thread, commit, compare) beside exit 2 for judged refusals; a sibling pull's newer report passed over, none naming this pull refused, a null `pr` kept; a thread page answering no list; `sha judged only` on the ✓ line. **Forced test edits:** none of the existing assertions changed. `fakeBoard` gained fields (`title`, `body`, `head`, `baseRef`, `cards`, `commits`, `onBase`) and two ops (`commit-read`, `compare-read`), and step ①'s card read now answers `title`/`body`, because the gate refuses a pull whose title does not read: without a title the existing verdict-fold cases would have been refused. ## Acceptance notes - No rules text changed: `l1-review-checklist.md` line 48 (the L1 check for `!` / `(narrowing)`) and `landing-operations.md` line 60 (`label-write --land`) do not say the check is manual only, so neither contradicts the gate. - A merge-of-main commit with conflict resolutions still counts as a merge of the base; the card's rule is "later commits are only merges of main", and the gate tests exactly that. ## Verification Round 1, all on head `524fac67` (= `01ad0b0e` with `origin/main` `22bcc7699` merged in: main had moved in `check-half-states.mjs` and `record-recognisers.mjs`, two files this gate imports from, so the merge came first and every run below is on the merged head). `git diff --name-only origin/main...HEAD` = `scripts/pm/label-write.mjs` only (+456 / -3). After the round, main moved again to `3b1307ede`; none of the new commits touches this file or the readers it imports. - `node scripts/pm/label-write.mjs --self-test`: `✓ label-write self-test: 273 cases pass across 17 batteries` (round 0: 264; the new battery is pinned at 46 cases, `SELF_TEST_BATTERY_FLOOR` 17). - Self-tests of the imported owners on the merged head: `check-half-states.mjs`, `record-recognisers.mjs`, `post-stamped.mjs` exit 0. - `pnpm exec eslint --no-inline-config scripts/pm/label-write.mjs`: exit 0. - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack`: 64 commands, each run and recorded `CMD :: exit N`, all exit 0; `--ran`: `64 derived, 64 run, 0 NOT-MEASURED, 0 UNRUN`. The same 64 were green on `01ad0b0e` before the merge. <details><summary>Round 1 ablations: one per new branch, 8 of 8 red, each restored to blob == HEAD</summary> Same tool and command as round 0. B2 and B4 were first sent with a replacement that is a substring of the anchor; `ablation-replace.mjs` refused those (its count check: the replacement's count fell instead of rising by 1), so they did not count, and they were re-run with a distinct replacement. | ablated branch | failing cases | |:--|:--| | B1 S1 title quoted | 3 | | B2 S1 title cap | 2 | | B3 S2 near miss refuses | 3 | | B4 N2 sha judged only | 2 | | B5 N3 unread exits 3 | 6 | | B6 N4 sibling report passed over | 3 | | B7 N4 none names this pull | 0 (TypeError) | | B8 no-list page | 0 (TypeError) | </details> <details><summary>Round 0 ablations (head 88a02ae): one per branch, 21 of 21 red, each restored to blob == HEAD</summary> Each through `node scripts/ablation-replace.mjs --file scripts/pm/label-write.mjs --anchor … -- node scripts/pm/label-write.mjs --self-test` (anchor hit 1, restore verified by the tool). The count is the self-test's failing cases; `0` means the self-test died on a TypeError (the guard is what keeps a null from being read), which is exit 1 too. | ablated branch | failing cases | |:--|:--| | A1 title bang | 28 | | A2 narrowing arm | 3 | | A3 malformed unreadable | 3 | | A4 gate wired into fold | 24 | | A5 pull unread | 2 | | A6 no full head | 2 | | A7 no card | 2 | | A8 truncated | 3 | | A9 thread unread | 0 | | A10 trusted authors | 4 | | A11 no report | 0 | | A12 no battery string | 3 | | A13 n/a | 2 | | A14 no sha | 2 | | A15 head match | 6 | | A16 commit unread | 2 | | A17 two parents | 2 | | A18 compare unread | 2 | | A19 on base | 2 | | A20 hop cap | 2 | | A21 ancestor reached | 4 | </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmPoqLCQHtTFH1fsaSB)_ <!-- signed: domain:skills#2 · os-steve · session_01ADHkmPoqLCQHtTFH1fsaSB --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 5a75579 commit 8559ee1

1 file changed

Lines changed: 456 additions & 3 deletions

File tree

0 commit comments

Comments
 (0)