From 94dbce5d54ed0221df061522e06babc96463e35c Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 19:19:19 +0000 Subject: [PATCH] pm: the sweep's favourable answer covers the raw status read only; PD14 names the arm's rows, not the catalogs Carries PR #33975's round-5 contract-review fixes. AGENTS.md Prime Directive 14 says CODEOWNERS routes every Tier H surface but the low-risk arm's rows, which include the root ADR tree since #33975. favourableArmGitRead answers only the `diff-tree --raw` status read, so an ADR landing whose `diff-tree -p` patch read alone fails stays NOT MEASURED in the post-merge sweep instead of reading Tier H on a stand-in; one row pins it, and an ablation reds it. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01ADHkmRrk1KF2ZJk57PwVU9 --- AGENTS.md | 2 +- scripts/pm/check-governed-merges.mjs | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index ac145fd08fc..15419777891 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -303,7 +303,7 @@ See `ui/AGENTS.md` for the app-id / localStorage / auth gotchas. membership), so ask the maintainer at once to remove a queued PR by hand — then confirm from the remote that it is in neither the queue nor `origin/main`. **Draft is no barrier by itself — the barrier is this directive**, and a spent approval or a standing record IS the review record, ⛔ not a relaxation. Behind it: the queue guard refuses a - governed diff without its tier's record; CODEOWNERS routes every Tier H surface but the low-risk catalogs to the + governed diff without its tier's record; CODEOWNERS routes every Tier H surface but the low-risk arm's rows to the approvers, the relay asks per pull on drafts (no barrier); the post-merge audit (`check-governed-merges.mjs`) lists every governed-surface merge with its approver and merger — a merger the maintainer does not recognise, any agent approval, or a Tier S merge without a PASS record is a seat violation, filed and rolled back. No seat judges this. diff --git a/scripts/pm/check-governed-merges.mjs b/scripts/pm/check-governed-merges.mjs index c6561b2affc..e26d96c6747 100644 --- a/scripts/pm/check-governed-merges.mjs +++ b/scripts/pm/check-governed-merges.mjs @@ -5005,12 +5005,13 @@ const ARM_FAVOURABLE_CHANGESET = "---\n'@objectstack/skills': patch\n---\n\nClau /** * The answer to one of the arm's git reads that gives the arm no reason (#33765 N-a): a clean changeset for the - * guard's `show SHA:PATH`, and every path a modified regular file for its `diff-tree`; null for any other read, - * which then cannot be answered the arm's way. Pure. + * guard's `show SHA:PATH`, and every path a modified regular file for its `diff-tree --raw` status read; null for + * any other read — the ADR leg's `diff-tree -p` patch read included (#33539: a status listing is no patch, and + * no stand-in patch is favourable) — which then cannot be answered the arm's way. Pure. */ export function favourableArmGitRead(argv, paths) { if (argv?.[0] === 'show' && ARM_CHANGESET_SHOW.test(String(argv[1] ?? ''))) return ARM_FAVOURABLE_CHANGESET; - if (argv?.[0] === 'diff-tree') return (Array.isArray(paths) ? paths : []).map((p) => `:100644 100644 ${'0'.repeat(40)} ${'0'.repeat(40)} M\0${p}\0`).join(''); + if (argv?.[0] === 'diff-tree' && argv.includes('--raw') && !argv.includes('-p')) return (Array.isArray(paths) ? paths : []).map((p) => `:100644 100644 ${'0'.repeat(40)} ${'0'.repeat(40)} M\0${p}\0`).join(''); return null; } @@ -10284,7 +10285,18 @@ async function selfTest() { await unmeasured({ git: diffTreeThrows }, /could not read `git diff-tree/) === true && await unmeasured({ git: gitWith((a) => { if (a[0] === 'diff-tree') throw new Error('fatal: bad object'); if (a[0] === 'show') throw new Error('fatal: unable to read'); if (a[0] === 'ls-tree') return `${CS}\0`; }) }, /could not read `git show.*`git diff-tree/) === true); assert('⛔ #33765-N-a-an-unread-read-the-arm-has-no-favourable-answer-for-stays-NOT-MEASURED', favourableArmGitRead(['rev-parse', 'x'], [SK]) === null && - favourableArmGitRead(['show', `${LANDED}:${CS}`], [SK]) !== null && favourableArmGitRead(['diff-tree', LANDED], [SK]).includes(`M\0${SK}\0`)); + favourableArmGitRead(['show', `${LANDED}:${CS}`], [SK]) !== null && favourableArmGitRead(['diff-tree', '--raw', LANDED], [SK]).includes(`M\0${SK}\0`)); + // #33539 S7: the ADR leg's patch read has no favourable answer; one that fails alone leaves the landing NOT MEASURED. + const ADRP = 'docs/adr/0097-upstream-availability.md'; + const adrPatchThrows = (args) => { + if (args[0] === 'diff-tree' && args.includes('-p')) throw new Error('fatal: bad object'); + if (args[0] === 'diff-tree') return `:100644 100644 ${'1'.repeat(40)} ${'2'.repeat(40)} M\0${ADRP}\0`; + return runGit(args); + }; + assert('⛔ #33539-S7-an-ADR-landing-whose-patch-read-alone-fails-stays-NOT-MEASURED-only-the-raw-read-has-a-favourable-answer', + await unmeasured({ paths: [ADRP], git: adrPatchThrows }, /could not read `git diff-tree/) === true && + favourableArmGitRead(addOnlyDiffArgv(['diff-tree', '-p', '--no-commit-id', '-m', '--first-parent'], [LANDED], ADRP), [ADRP]) === null && + favourableArmGitRead(['diff-tree', '-r', '--no-commit-id', '--no-renames', '--raw', '-z', '-m', '--first-parent', LANDED], [ADRP]) !== null); // #33765 N-b: an unread labels list is an unread input, though no git read failed. assert('⛔ #33765-N-b-an-unread-labels-list-alone-is-NOT-MEASURED-not-tier-h', await unmeasured({ pull: { labels: null } }, /could not read its labels/) === true && armReadsNotMeasured([], { measured: true }, runGit, null).includes('its labels') && armReadsNotMeasured([], { measured: true }, runGit).length === 0);