Repository navigation
fix(pm): count the human-merge size rename-aware, as GitHub does - #30766
Merged
Merged
Conversation
dispatch-gates changedLinesFromGit and check-governed-merges --branch and sweep summed git --numstat with --no-renames, so a moved file read as a whole delete plus a whole add (PR #30594: 4324 lines against GitHub's 1806). The size reads now pass -M; the --name-only gate-derivation lists keep --no-renames so a rename still names both paths. Self-tests pin a renamed file counting +1/-1 over one file in both scripts. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cy385N3ELe3hf8qLkd
Contributor
Author
|
domain:devx#1 · os-elon-musk · session_016WV4cymvo9YoyLwKCXXBNw 席位核对 · ACCEPT · #30718 · 2026-11-06T01:56ZHead-sha:
|
objectstack-fleet
Bot
requested review from
hotlong and
os-zhuang
as code owners
November 6, 2026 01:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Elon · project thread
domain:devx#1 · os-elon-musk · session_016WV4cy385N3ELe3hf8qLkd
Fixes #30718
Clause-②: no
Metadata-protocol: none
维护者速读
dispatch-gates和check-governed-merges(--branch与 sweep)统计改动行数时,改为识别重命名(git --numstat -M),与 GitHub 的 additions+deletions 一致;用来推导门禁的文件名列表仍保留--no-renames,重命名仍同时列出新旧两条路径。scripts/pm/工具,不发布;尺寸只会比原来小、且等于 GitHub 的数;git 未配对的移动仍按整删整增算(只会偏大不会偏小)。回滚即 revert。check-governed-merges.mjs的commitChanges(sweep 现在两次本地读:路径--no-renames,尺寸-M);②deriveBranchPaths的 numstat 一行;③dispatch-gates.mjs的changedLinesFromGit。node scripts/pm/check-governed-merges.mjs --self-test,预期✓ … 543 assertions,其中含 dispatch-gates / check-governed-merges count changed lines with --no-renames, so a rename-heavy PR reads far over the 3000-line threshold that GitHub's additions+deletions (the authority) puts it under #30718 重命名用例。What changes
The human-merge size reading now counts renames the way GitHub does. The threshold's authority is the PR's additions + deletions (pm-dispatch SKILL.md), and GitHub pairs a moved file and counts only its content change.
dispatch-gates.mjschangedLinesFromGitgit diff --numstat --no-renames MBgit diff --numstat -M MBcheck-governed-merges.mjs--branch(deriveBranchPaths)git diff --numstat --no-renames MB REFgit diff --numstat -M MB REFcheck-governed-merges.mjssweep (commitChanges)diff-tree --numstat --no-renamesfor paths and sizediff-tree --numstat -Mfor the sizeWhat stays: every
--name-only --no-renamespath list used for gate derivation (dispatch-gates.mjschangedPathsFromGit,check-governed-merges.mjs--branch), and the sweep's path list, keep--no-renames, so a rename still reaches the predicate as both of its paths.-Mis spelled out, so adiff.renames=falseconfig cannot turn it off. A move git does not pair (an unstagedmvwhose new path is untracked, or a pair past git's rename limit) still counts as a delete plus an add. That reads over GitHub's number, never under.The header prose of
check-governed-merges.mjs(the rename paragraph and the per-mode "where the number comes from" table) and thechangedLinesFromGitdoc comment now say this. The--branchderivation line namesgit diff --numstat -M.Tests
check-governed-merges.mjs --self-test: the injected-git fixtures move fromdiff --numstat --no-renamestodiff --numstat -M. A new recording-git case pins that the--branchsize read is-Mand never--no-renameswhile the path list keeps--no-renames. A new real-repo fixture (withdiff.renames=falseset) moves a 400-line file with one line edited. Its--no-renamescontrol reads +400/−400 over 2 files.--branchreads +1/−1 over 1 file and still lists both paths.commitChangesreads the same +1/−1 and both paths.dispatch-gates.self-test.mjs: the same fixture shape driveschangedLinesFromGit(+1/−1 over 1 file), its--no-renamescontrol, andchangedPathsFromGit(both paths listed, same rename-aware size).Before/after on the card's three PRs (head d87643b; before = origin/main 05a30e6)
Each PR head was checked out detached. Both
origin/mainand this branch's modules were imported, thenchangedLinesFromGitandderiveBranchPathswere run on the PR head's merge base, andcommitChangeson the landed squash commit.Acceptance notes
skip-changeset.check-governed-merges.mjs --teston the three changed paths: NOT governed (ordinary queue landing). The size reading of this PR is 181 lines.--no-renamescontrol, which proves the fixture is a real rename where the two reads differ.Verification
All local readings below are on the final head
dae76a1922(the branch mergedorigin/main6b2129f918; none of main's 177 files touch the three scripts).node scripts/pm/dispatch-gates.mjs --commandsderived 34 families. All 34 exit 0.node scripts/pm/dispatch-gates.mjs --rananswers✓ dispatch-gates --ran: 34 derived famil(ies) accounted for — 34 run, 0 NOT-MEASURED.node scripts/pm/check-governed-merges.mjs --self-test: exit 0,✓ check-governed-merges --self-test: 543 assertions(also derived aspnpm check:pm-governed-merges, exit 0 ondae76a1922).node scripts/pm/dispatch-gates.mjs --self-test: exit 0,✓ dispatch-gates self-test: 2243 cases pass.This ran ond87643bf23. The merge after it changed none of the three scripts, so it was not re-run ondae76a1922.Run record on dae76a1 (COMMAND :: exit N)
🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4cy385N3ELe3hf8qLkd
Generated by Claude Code