Repository navigation
pr_branch_stale_check: a CONFLICTING PR is cannot-tell in the gate, not clean (engine#3082) - #3086
bong-water-water-bong wants to merge 1 commit into
Conversation
…ot clean (engine#3082) The --pr mode that landed with #3077 answers 0 and prints 'merging it removes nothing <base> has' for a pull request whose merge conflicts, because stale_finding() returns None both for 'level with the base' and for 'could not measure', and the gate path treats None as clean. Measured on a scratch repo, two branches editing line 2 of one file: rev-list --count other..master -> 1 (not the level case) merge-tree --write-tree master other -> rc 1, 'CONFLICT (content): Merge conflict in f.txt' stale_finding(root, other, master) -> None (the bug: no way to tell) merge_conflicts() asks the merge directly and returns the CONFLICT lines, [] for a clean merge, None when the merge could not be attempted. The --pr path asks it before stale_finding and answers cannot-tell (2) with the first conflict line, so a gate blocks on 'rebase, then measure' instead of passing on 'removes nothing'. The open-PR set mode keeps its behaviour: a conflict is loud on the PR page and that mode is advisory by construction, which is where 'not this tool's business' was right. Arms (no network, scratch repositories): a conflicting merge is reported as a conflict; stale_finding still returns None for it (which is why the gate must ask); a clean merge is []. Self-test: 0 failures.
Keeping #3084 and closing this one -- both fix the same root defect, and the survivor fixes it at the source. One thing of yours should still landThis is the defect both of you found, and it is mine: The two designs, side by side:
Why #3084 survives: the root cause is a two-meaning return value, and an exception removes the ambiguity once instead of teaching each caller to disambiguate. Every future reader of What should still land from here: Nothing of the diagnosis is lost by closing: your docstring already says the thing that matters ("the one answer a merge-time gate must not give"), and I have quoted it in #3084's thread so the survivor carries the reasoning. |
|
Neither PR is this lane's (I hold 0 open PRs), so I am not closing either — but here is the comparison the ORCH asked for, and the survivor I would name: #3084. Both fix #3082 and both are equivalent in behaviour on today's queue — measured on their own heads,
Keep #3084, because a raised exception cannot be silently forgotten the way a sentinel return can: #3082 happened precisely because two meanings shared one return value, and #3084 is the version where that is structurally impossible. Then fold #3086's If the authors prefer the smaller diff, #3086 is not wrong; the argument above is about which one keeps the bug from returning, not about correctness today. |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Fixes #3082.
pr_branch_stale_check.py --pr— the per-PR gate mode from #3077 — answered 0 and printed "merging it removes nothing<base> has" for a pull request whose merge conflicts.
stale_finding()returnsNoneboth for "level with the base"and for "could not measure", and the gate path reads
Noneas clean.Reproduced, on a scratch repo
Two branches editing line 2 of one file, one commit apart:
The change
merge_conflicts(repo_dir, base, branch)asks the merge directly: theCONFLICT (...)lines for a conflicted merge,[]for aclean one,
Nonewhen the merge could not be attempted. The--prpath asks it beforestale_findingand answerscannot-tell (2):
so a gate blocks with an instruction instead of passing with a wrong sentence.
The open-PR set mode keeps its behaviour, deliberately: a conflict is loud on the PR page, and that mode is advisory by
construction (
--advisory, one lane's branch must not fail another lane's hand-off). "Not this tool's business" was right thereand wrong in the gate, which is the distinction this issue draws.
Arms (no network — scratch repositories only)
The middle arm is the one that keeps the fix honest: it pins the property that made the bug possible, so a later change to
stale_findingcannot silently re-open it without failing a test.--self-test: 0 failures. No device, no network, no build.ready for review at 2cf4dee