From 8b66fb370964138bc0109afbef9714259dc92835 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Nov 2026 06:35:21 +0000 Subject: [PATCH 1/2] fix(pm): landing-operations names the --land dogfood gate; label-write pins its rule path and three nits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remainder 2 of #34204 (part 1 landed as #34303). - landing-operations.md: the `--land` line now owns a continuation that says `--land` refuses a `!`/`(narrowing)` pull unless the card's newest trusted os-dev-report pins the battery on the head, pointing to os-dev.md. Paid by deleting line 11, a true duplicate of contract-review.md:56-57 (post-landing owed L2: backfill on the landed head, file findings, never fix a closed PR). - label-write --self-test: an ↔ case binds that line to the gate and the gate's LAND_DOGFOOD_RULE_PATH to os-dev.md, which holds the rule and its key. - N1: a null-`pr` report is not this pull's in the sibling fallback (pinned; header says so). N2: an inline-key near miss refuses (pinned). N3: a card thread answering 404 also names "or correct the card the body names". Claude-Session: https://claude.ai/code/session_01ADHkmPoqLCQHtTFH1fsaSB Co-authored-by: Claude --- .../references/landing-operations.md | 2 +- scripts/pm/label-write.mjs | 23 ++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.claude/skills/pm-dispatch/references/landing-operations.md b/.claude/skills/pm-dispatch/references/landing-operations.md index 2a43854b685..782bcf3d479 100644 --- a/.claude/skills/pm-dispatch/references/landing-operations.md +++ b/.claude/skills/pm-dispatch/references/landing-operations.md @@ -8,7 +8,6 @@ - 声明肢 = 认领评论声明 `Clause-②: yes`,与路径无关;错误的 `no` 是可审计的假申报。 - 子代理起不来 ⇒ L2 缺席,PR 带 `needs:contract-review` 留 draft 队列外;旁路仅维护者逐次亲审 - PASS ⇒ Tier S ready、auto-merge;Tier H 经 SKILL.md ③ 交棒;FAIL ⇒ 撤挂,补丁轮;⛔ 免 L2 不放行。 -- 落地后见欠 L2 ⇒ 按 `contract-review.md` 补审落地 head、发现照立卡门入卡,⛔ 不修已关 PR。 - DELIBERATE CORRECTION 红(`check-empty-changeset`)⛔ 不等维护者;确认件皆须点名每个被改 note: - diff 只改 release 文字或注释者:派发席 ACCEPT 确认,逐句引改前与改后,免第二次同 head L2。 - 其余(含改代码)照全套:同 head 达档 L2 PASS 记录即确认,记录逐句判改写句。 @@ -58,6 +57,7 @@ - 车道 PM 的权责三件:验收(L1 清单)、首次入队、确认 MERGED;落地执行在案判决,非自批。 - 首次入队:ACCEPT 后挂 6–9 分钟 flip 定点,到点核门禁 job 结论。 - 绿即落地评论与 `pr_ready`+`automerge_enable` 一笔中继:`label-write --land`;未绿按阶梯重挂定点。 + `--land` 拒 `!`/`(narrowing)` PR,除非卡上最新受信 os-dev-report 的 dogfood 钉 head(`os-dev.md`)。 - 写节流拒(exit 10) ⇒ 待 `node scripts/pm/write-pace.mjs --status` 现空槽再重试。 - CI success webhook 不可靠:⛔ 不坐等,也 ⛔ 不忙轮询;定点文本照定时器写法纪律。 - undraft 429 ⇒ 卡记 `resets at`,到点一次重试裸 op(`rest-channel.md`),⛔ 不重发评论、不报阻塞。 diff --git a/scripts/pm/label-write.mjs b/scripts/pm/label-write.mjs index 6ebc9313283..4800f5359f6 100644 --- a/scripts/pm/label-write.mjs +++ b/scripts/pm/label-write.mjs @@ -198,7 +198,8 @@ * report the NEWEST `os-dev-report` on the card the pull delivers (`deliveredCardNumber`) among comments by the * relay's identity or a governed approver (`recordAuthorTrusted`) — newest-of, marker and payload * candidates are the patrol's readers, called, ⛔ never a second parser. When that report's `pr` names - * ANOTHER pull (siblings on one card), the newest trusted report whose `pr` names THIS pull, or none. + * ANOTHER pull (siblings on one card), the newest trusted report whose `pr` names THIS pull, or none — a + * null or URL-less `pr` names no pull, so in that fallback it is not this pull's and is passed over too. * sha its `dogfood_battery` must open with a sha that is the pull's head, or that a first-parent walk from the * head reaches over merges of the base alone: each step's commit has exactly two parents, the second one * on the base branch (`GET /compare/{parent2}...{base}` answers `ahead` or `identical`). @@ -1549,7 +1550,10 @@ export async function landDogfoodGate({ repo, issue, card, doCall }) { ); } const listed = await doCall('comments-list', `/repos/${repo}/issues/${delivered.card}/comments?per_page=100&page=${page}`, {}); - if (listed.verdict !== 'ok') return unread(`card #${delivered.card}'s thread`, listed, 'land again once the card reads'); + if (listed.verdict !== 'ok') { + // A 404 is as likely the body naming the wrong card as the platform failing to answer: name both remedies. + return unread(`card #${delivered.card}'s thread`, listed, `land again once the card reads${listed.status === 404 ? `, or correct the card the body names (#${delivered.card})` : ''}`); + } if (!Array.isArray(listed.json)) return refuse(`card #${delivered.card}'s thread answered no list on page ${page}`, 'land again once the card reads'); rows.push(...listed.json); if (listed.json.length < 100) break; @@ -2434,7 +2438,7 @@ const SELF_TEST_BATTERIES = Object.freeze({ [FOLD_BATTERY]: 28, [REAL_TRANSPORT_BATTERY]: 5, [STATELESS_BATTERY]: 19, - [LAND_DOGFOOD_BATTERY]: 46, + [LAND_DOGFOOD_BATTERY]: 50, }); const SELF_TEST_BATTERY_FLOOR = 17; const UNATTRIBUTED_BATTERY = '(unattributed)'; @@ -3072,6 +3076,7 @@ export async function selfTest() { 'an UNREADABLE title': [pull({ title: '' }), 'its title did not read'], 'a MALFORMED `Clause-②:` line on an unmarked title': [pull({ title: 'fix: x', body: 'Fixes #8\n\nClause-②: maybe\n' }), 'reads malformed'], 'a NEAR-MISS `Clause-②:` line on an unmarked title': [pull({ title: 'fix: x', body: 'Fixes #8\n\nClause-2: no (narrowing)\n' }), 'reads as a near miss (spelling)'], + 'an INLINE-KEY `Clause-②:` near miss on an unmarked title': [pull({ title: 'fix: x', body: 'Fixes #8\n\nThe claim says Clause-②: no (narrowing) here.\n' }), 'reads as a near miss (inline-key)'], 'a pull that does not read': [{ ...pull(), hooks: { 'pull-read': [{ status: 404 }] } }, 'the pull did not read', EXIT_PREREQUISITE], 'a pull read with no full head sha': [pull({ head: 'abc' }), 'no full head sha'], 'NO CARD — no closing keyword, no `Part of`, no dev branch': [pull({ body: 'A body naming nothing.\n', ref: 'feature/x' }), 'why: no card'], @@ -3105,6 +3110,9 @@ export async function selfTest() { const oneShorter = await land({ ...atCap, commits: { ...atCap.commits, [(LAND_MERGE_HOP_CAP).toString(16).padStart(2, '0').repeat(20)]: undefined, [(LAND_MERGE_HOP_CAP - 1).toString(16).padStart(2, '0').repeat(20)]: [BELOW, MAIN_SIDE] } }); t(`…while a battery exactly ${LAND_MERGE_HOP_CAP} merges below the head passes — the cap is the hop count, not one short of it`, [oneShorter.exit, oneShorter.text.includes(`ran ${LAND_MERGE_HOP_CAP} merge(s)`)], [EXIT_OK, true], oneShorter.text.slice(-400)); const pageCount = (await land(cases['a TRUNCATED listing'][0])).fake.calls.filter((c) => c.op === 'comments-list').length; + const card404 = await land(cases['a card thread that does not read'][0]); + const cardLimited = await land(cases['a RATE-LIMITED card thread read'][0]); + t('…a card thread answering 404 also names the body\'s card as the thing to correct; a rate-limited read does not', [card404.text.includes('HTTP 404'), card404.text.includes('or correct the card the body names (#8)'), cardLimited.text.includes('or correct the card the body names')], [true, true, false], card404.text.slice(-400)); t('…the truncated listing read exactly the page cap and stopped', pageCount, LAND_COMMENT_PAGE_CAP); // Whose report, and which one. @@ -3119,11 +3127,20 @@ export async function selfTest() { t('sibling pulls on one card: a newer report whose `pr` names ANOTHER pull is passed over for the newest naming THIS pull', [sibling.exit, sibling.text.includes('report comment 800')], [EXIT_OK, true], sibling.text.slice(-400)); const noPr = await land(pull({ cards: { 8: [report(RAN_HEAD, { id: 810, at: '2026-11-08T12:00:00Z', pr: 'https://github.com/objectstack-ai/objectstack/pull/9' }), report(NA, { id: 811, at: '2026-11-08T13:00:00Z', pr: null })] } })); t('…while a newest report whose `pr` is null stays the newest — only a report naming another pull moves the gate', [noPr.exit, noPr.text.includes('comment 811')], [EXIT_USAGE, true]); + const nullFallback = await land(pull({ cards: { 8: [report(RAN_HEAD, { id: 820, at: '2026-11-08T12:00:00Z', pr: null }), report(NA, { id: 821, at: '2026-11-08T13:00:00Z', pr: 'https://github.com/objectstack-ai/objectstack/pull/9' })] } })); + t('⛔ …and in the sibling fallback a null-`pr` report is NOT this pull\'s: under a newest naming another pull, an older null-`pr` run on the head refuses', [...refused(nullFallback), nullFallback.text.includes('no trusted report names this one'), nullFallback.text.includes('comment 821')], [...REFUSED, true, true], nullFallback.text.slice(-400)); t('the `pr` reading: this pull, another pull (number or repo), and null for no URL', [reportNamesPull(report(NA).body, { repo: 'objectstack-ai/objectstack', number: 7 }), reportNamesPull(report(NA, { pr: 'https://github.com/objectstack-ai/objectstack/pull/70' }).body, { repo: 'objectstack-ai/objectstack', number: 7 }), reportNamesPull(report(NA, { pr: 'https://github.com/objectstack-ai/cloud/pull/7' }).body, { repo: 'objectstack-ai/objectstack', number: 7 }), reportNamesPull(report(NA, { pr: null }).body, { repo: 'objectstack-ai/objectstack', number: 7 })], ['this', 'other', 'other', null]); const absent = await land(pull({ title: 'fix(pm): no declaration', body: 'Fixes #8\n\nNo declaration line at all.\n', cards: {} })); t('an ABSENT `Clause-②:` line on an unmarked title is not judged — as Check Changeset reads it', [absent.exit, absent.text.includes('not judged')], [EXIT_OK, true]); const approver = await land(pull({ cards: { 8: [report(RAN_HEAD, { login: GOVERNED_APPROVERS[0] })] } })); t('…a report written by a governed approver is trusted, as the record leg trusts it', approver.exit, EXIT_OK); + // ↔ the rules text names this gate where `--land` is taught, and the gate's rule path is still the file that holds the rule. + const landingText = readFileSync(new URL('.claude/skills/pm-dispatch/references/landing-operations.md', REPO_ROOT), 'utf8'); + const gateLine = landingText.split('\n').find((l) => l.includes('`--land`') && l.includes('`(narrowing)`')) ?? ''; + const ruleText = readFileSync(new URL(LAND_DOGFOOD_RULE_PATH, REPO_ROOT), 'utf8'); + t('↔ landing-operations.md names the gate on a `--land` line (`!`, `(narrowing)`, dogfood, os-dev.md); the gate\'s rule path is os-dev.md and holds the `!`/`(narrowing)` rule and its report key', + [gateLine.includes('`!`'), gateLine.includes('dogfood'), gateLine.includes('`os-dev.md`'), LAND_DOGFOOD_RULE_PATH, ruleText.includes('(narrowing)') && ruleText.includes(`"${LAND_DOGFOOD_REPORT_KEY}"`)], + [true, true, true, '.claude/agents/os-dev.md', true]); // Ordering and shape. const early = await land(pull({ cards: { 8: [report(NA)] } })); From 6082d7d69a04f1f246d2b746023fc2e6da5f3a1f Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Nov 2026 07:12:43 +0000 Subject: [PATCH 2/2] =?UTF-8?q?fix(pm):=20label-write's=20=E2=86=94=20case?= =?UTF-8?q?=20binds=20one=20os-dev.md=20rule=20line;=20the=20404=20remedy?= =?UTF-8?q?=20names=20the=20card=20the=20pull=20delivers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review#2 record 6909926666 on #34326: - S1: the ↔ case's gate side now requires ONE line of LAND_DOGFOOD_RULE_PATH (os-dev.md) carrying dogfood, `!` and `(narrowing)` together, as the text side binds landing-operations.md; renamed to say so. - N1: a 404 card thread's remedy says "or correct the card this pull delivers (#N)", true when the card comes from the branch name too. Claude-Session: https://claude.ai/code/session_01ADHkmPoqLCQHtTFH1fsaSB Co-authored-by: Claude --- scripts/pm/label-write.mjs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/pm/label-write.mjs b/scripts/pm/label-write.mjs index 4800f5359f6..68eafde9c5b 100644 --- a/scripts/pm/label-write.mjs +++ b/scripts/pm/label-write.mjs @@ -1551,8 +1551,8 @@ export async function landDogfoodGate({ repo, issue, card, doCall }) { } const listed = await doCall('comments-list', `/repos/${repo}/issues/${delivered.card}/comments?per_page=100&page=${page}`, {}); if (listed.verdict !== 'ok') { - // A 404 is as likely the body naming the wrong card as the platform failing to answer: name both remedies. - return unread(`card #${delivered.card}'s thread`, listed, `land again once the card reads${listed.status === 404 ? `, or correct the card the body names (#${delivered.card})` : ''}`); + // A 404 is as likely the pull delivering the wrong card (its body or its branch) as the platform failing to answer. + return unread(`card #${delivered.card}'s thread`, listed, `land again once the card reads${listed.status === 404 ? `, or correct the card this pull delivers (#${delivered.card})` : ''}`); } if (!Array.isArray(listed.json)) return refuse(`card #${delivered.card}'s thread answered no list on page ${page}`, 'land again once the card reads'); rows.push(...listed.json); @@ -3112,7 +3112,7 @@ export async function selfTest() { const pageCount = (await land(cases['a TRUNCATED listing'][0])).fake.calls.filter((c) => c.op === 'comments-list').length; const card404 = await land(cases['a card thread that does not read'][0]); const cardLimited = await land(cases['a RATE-LIMITED card thread read'][0]); - t('…a card thread answering 404 also names the body\'s card as the thing to correct; a rate-limited read does not', [card404.text.includes('HTTP 404'), card404.text.includes('or correct the card the body names (#8)'), cardLimited.text.includes('or correct the card the body names')], [true, true, false], card404.text.slice(-400)); + t('…a card thread answering 404 also names the body\'s card as the thing to correct; a rate-limited read does not', [card404.text.includes('HTTP 404'), card404.text.includes('or correct the card this pull delivers (#8)'), cardLimited.text.includes('or correct the card this pull delivers')], [true, true, false], card404.text.slice(-400)); t('…the truncated listing read exactly the page cap and stopped', pageCount, LAND_COMMENT_PAGE_CAP); // Whose report, and which one. @@ -3137,10 +3137,10 @@ export async function selfTest() { // ↔ the rules text names this gate where `--land` is taught, and the gate's rule path is still the file that holds the rule. const landingText = readFileSync(new URL('.claude/skills/pm-dispatch/references/landing-operations.md', REPO_ROOT), 'utf8'); const gateLine = landingText.split('\n').find((l) => l.includes('`--land`') && l.includes('`(narrowing)`')) ?? ''; - const ruleText = readFileSync(new URL(LAND_DOGFOOD_RULE_PATH, REPO_ROOT), 'utf8'); - t('↔ landing-operations.md names the gate on a `--land` line (`!`, `(narrowing)`, dogfood, os-dev.md); the gate\'s rule path is os-dev.md and holds the `!`/`(narrowing)` rule and its report key', - [gateLine.includes('`!`'), gateLine.includes('dogfood'), gateLine.includes('`os-dev.md`'), LAND_DOGFOOD_RULE_PATH, ruleText.includes('(narrowing)') && ruleText.includes(`"${LAND_DOGFOOD_REPORT_KEY}"`)], - [true, true, true, '.claude/agents/os-dev.md', true]); + const ruleLine = readFileSync(new URL(LAND_DOGFOOD_RULE_PATH, REPO_ROOT), 'utf8').split('\n').find((l) => l.includes('dogfood') && l.includes('`!`') && l.includes('`(narrowing)`')) ?? ''; + t('↔ both ends name the same rule, one line each: landing-operations.md\'s `--land` line carries `!`, `(narrowing)`, dogfood and `os-dev.md`, and the gate\'s rule path (os-dev.md) has ONE line carrying dogfood, `!` and `(narrowing)` together', + [gateLine.includes('`!`'), gateLine.includes('dogfood'), gateLine.includes('`os-dev.md`'), LAND_DOGFOOD_RULE_PATH, ruleLine !== ''], + [true, true, true, '.claude/agents/os-dev.md', true], `rule line: ${JSON.stringify(ruleLine)}`); // Ordering and shape. const early = await land(pull({ cards: { 8: [report(NA)] } }));