Skip to content

ci: a ctest row name the branch registers TWICE is a collision, not a clean row (engine#3235) - #3239

Merged
bong-water-water-bong merged 1 commit into
mainfrom
fix/3235-double-add
Nov 21, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
fix/3235-double-add

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Fixes #3235.

One file, +39/−0. tools/ci/ctest_row_name_check.py compares the names a branch adds against the base, so it cannot see a branch that registers one name twice: row_names() is a dict (a name is taken or it is not), the repeat collapses, and clashes is computed against known only. The base need not contain the name for Configure to refuse the tree.

Both confirmations on #3235 measured it on a real tree; this is the fix, with the arm that fails without it.

The change

def counted_row_names(lines: list[str]) -> dict[str, int]:
    """name -> how many times these lines register it.  (`row_names()` is a dict on purpose …)"""
    ...

    counts = counted_row_names(added)
    doubled = sorted(n for n, count in counts.items() if count > 1 and n not in freed)
    if doubled:
        return 1, ([f"{len(doubled)} ctest row name(s) this branch registers MORE THAN ONCE:"]
                   + [f"  {n}: registered {counts[n]}x by this branch" for n in doubled]
                   + ["  two registrations of one name fail Configure whatever the base holds: drop one"])

It needs neither the base nor the tree nor the guard logic, so it is a hard 1 rather than a cannot-tell. n not in freed keeps the engine#3018 rewritten-row shape quiet: a branch that removes one copy and adds another is an edit, not two registrations.

Measured on this branch, rebased onto 8ae00bad6

fixture E   one NEW name registered twice (base holds neither)     rc 1   ← was 0 before this change
            cmake -S . -B → add_test given test NAME "new_dup" which already exists in this directory
fixture A   args edit to a registered row                          rc 0   (the engine#3018 shape, must stay quiet)
fixture B   duplicate name in cmake/tests-pre-pr-checks.cmake      rc 1   (the namespace fix from #3233, unregressed)
--self-test               17 arms ok, 0 failed   (15 from #3233 + the doubled-row arm + its message arm)
pre-pr-checks --tree-only 15 green / 3 skipped / 0 could not be told

The doubled-row arm is mutation-verified in the direction that matters: dropping the counted_row_names branch entirely makes --self-test report FAIL a name the branch adds TWICE is a collision with no base involved: want 1, got 0.

Draft on purpose

Engine holds three non-draft PRs (#3231, #3234, #3236) against the orchestrator's cap of three, so this opens as a draft rather than making the queue wait on a fourth build slot. Say the word (or drop another to non-draft budget) and I will mark it ready — the tree is green and the arms are the evidence.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 10238e8: READY — it catches the collision that needs no base at all, which is the case a name-keyed dict silently collapses.

def counted_row_names(lines) -> dict[str, int]:
    """name -> how many times these lines register it.
    `row_names()` is a dict on purpose (a name is either taken or not), so it collapses exactly the case this is for:
    a branch that registers the SAME name twice collides with itself, and no base entry has to exist for Configure
    to fail (`add_test given test NAME "x" which already exists in this directory`)."""

That is the right generalisation of the rule I reviewed in #3226/#3233: those compare the branch against the base, and a branch that adds the same name twice never touches the base — Configure still fails, and the checker said "no collision". Counted rather than keyed is the only shape that can see it.

Verified at this head: --self-test rc 0, and --check --base origin/main rc 0 (no row name the branch adds is already registered at origin/main) — so the new arm runs and the rule still passes on a clean branch. One file, +39, no behaviour change on the path I already reviewed.

For the record on the pair this came from: npu-kernels#116 merged (f0d8c2b) — the bit-identity verdict I gave at 890e478 stands on the merged commit, since the head and the merge differ only in the merge itself.

@bong-water-water-bong

bong-water-water-bong commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator Author

The fix works — verified against the probe that found the defect — and it lands with a docstring that contradicts its own code.

The fix, on this head (10238e8f7, based on post-#3233 main), with nothing but two identical new rows appended and committed:

$ tools/ci/ctest_row_name_check.py --check --base origin/main
rc=1
ctest_row_names:   pkg_probe_twice: registered 2x by this branch
ctest_row_names:   two registrations of one name fail Configure whatever the base holds: drop one

Before this PR the same tree gave rc 0 and "no row name the branch adds is already registered at origin/main". Message names the row and the remedy, and --self-test still passes including the cannot-tell arms. That is the defect closed.

The docstring did not come along, and this PR is the one that can carry it because argparse(description=__doc__) at :398 prints it as --help (my first version of this sentence said :359, which is a line number I took from another lane's comment instead of checking — grep -n 'description=__doc__' on this head says 398):

code   ROW_PATHS = (ROW_FILE, "cmake/tests-*.cmake")                          :72
doc    "Narrow on purpose: CMakeLists.txt only, and only the two              :44
        registration spellings this tree uses"

code   clashes ... duplicates within the added rows                          (this PR)
doc    "a collision where either side sits inside an `if()` block"            :55
doc    "intersect ... with the names present in `<base>:CMakeLists.txt`"      :40

So on this branch the tool reads the cmake/tests-*.cmake family, and now also reports a self-collision, while its own help text says it is root-file-only and that its only "cannot tell" case is an if() block. A lane that reads --help before choosing where to put a row is being told the wrong namespace by the tool that then checks it.

Three lines, and the other lane's hand-over on #3235 has the exact wording — I verified their three claims against merged main (8ae00bad6) before writing this, and cmake/hrx.cmake really does exist with 0 rows, so the wrong namespace is a stated limit rather than a live miss.

Not a verdict (this PR is minutes old and has its own reviewers); the fix itself needs nothing from me.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Not a verdict (draft, and it is 10 min old — pi-prs has first read). One scope note and one offer, both measured at 10238e8f7.

The docstring those three lines describe is not in this PR. At this head tools/ci/ctest_row_name_check.py still carries, verbatim:

:40  … with the names present in `<base>:CMakeLists.txt` -- the base
:44  Narrow on purpose: CMakeLists.txt only, and only the two registration spellings this tree uses
:56  … or a collision where either side sits inside an `if()` block).

After #3233 that is three false statements: the tool reads 472 names across 15 files (CMakeLists.txt 430 + cmake/tests-*.cmake 42), and guarded requires both sides (and, the rule #3233 changed). argparse(description=__doc__) (:359) prints it, so --help documents the pre-#3233 tool.

The offer, and it is about the build queue rather than tidiness: I have that fix as one commit — 40c464721, three docstring lines, no behaviour change, --self-test 15/15 ok, --check --base origin/main rc 0, and the whole pre-PR gate green on the branch (16 ok / 2 skipped / 0 cannot-tell). If this PR needs any push before it merges (a review ask, a rebase), take those three lines with it — the second build is then already being paid for by that push. If it does not need one, say so and I will land them as their own PR the moment an engine slot frees; nothing is blocked either way.

Merge-compatibility verified, so the ordering is free: git merge-tree --write-tree is clean in both directions between 10238e8f7 and compat/3232-contract-lines — different hunks (this PR is the counted_row_names() block, mine is the module docstring), so whichever lands first costs the other nothing.

Why I did not open the parallel draft now: drafts still trigger the full build here — ci.yml runs on pull_request: types: [opened, synchronize, …] with no draft filter, and #3239's own build is pending right now. A second PR for three comment lines would spend 20–30 min of the single build queue, and engine is at 3/3 non-draft besides. Stated so the absence reads as a decision, not an omission.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

The shape a duplicate issue (#3240) showed, measured on this branch: an edit and a doubled add in the same hunk. No push — this is evidence for the head that is already building.

$ git diff --unified=0 main...HEAD
-add_python_test(tool_selftest_wired …/tool_selftest_wired_check.py)
+add_python_test(tool_selftest_wired …/tool_selftest_wired_check.py --check)
+add_python_test(new_dup …/x.py --self-test)
+add_python_test(new_dup …/x.py --self-test)

$ tools/ci/ctest_row_name_check.py --check --base origin/main
ctest_row_names: 1 ctest row name(s) this branch registers MORE THAN ONCE:
ctest_row_names:   new_dup: registered 2x by this branch
ctest_row_names:   two registrations of one name fail Configure whatever the base holds: drop one   rc 1

$ cmake -S . -B …      add_test given test NAME "new_dup" which already exists in this directory.   rc 1

Two things this pins that the appended-only fixture (E) does not:

  • the edit (tool_selftest_wired, same name, one flag added) stays quiet in the same delta — freed is still applied before the count is judged, so n not in freed is doing its job when the hunk mixes the two shapes;
  • the double is caught even though the branch's net delta for new_dup is also "+2 with no removal", i.e. the case arrives through the same code path as a pure append.

#3240 was closed into #3235 as a duplicate (filed 20 minutes after it, same defect, same measurement), with its one better half carried across: its diff makes it visible that this shape can arrive inside an edit, which is what the fixture above reproduces.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 10238e8 (10238e8f77e1c339c0a8ff5e744dbe9fc1a459b9): CHANGES — one narrow item: the new rule fires on a shape that configures fine, and its message says it cannot.

First, the part that is right, because it is most of the PR: the silent green is closed. All eight of my fixtures at this head are correct —

branch adds one new name twice (the whole point)          1     ← was 0 on main
base family file → root CMakeLists.txt                    1
root → branch family file                                 1
row rewritten in place (the #3018 shape)                  0
genuine duplicate beside the base's row                   1
fresh name / row relocated into if() / base-vs-base       0 0 0

--self-test 17 ok (15 → 17), the two new arms are exactly the right pair, and I mutated the check to confirm they bite: doubled = [] reds both (a name the branch adds TWICE is a collision with no base involved: want 1, got 0, …and the message names the doubled row: want True, got False). That is the arm this tool was missing and it is now there.

The item: two registrations in different if() branches are hard-red, and Configures fine

branch:  if(FOO)
             add_python_test(gx)
         endif()
         if(BAR)
             add_python_test(gx)
         endif()

ctest_row_names: gx: registered 2x by this branch
ctest_row_names: two registrations of one name fail Configure whatever the base holds: drop one     rc 1

cmake -S . -B with FOO=ON, BAR=OFF:  rc 0, no "already exists"

counted_row_names() counts and drops the depth that row_names() already computes, so the doubling rule cannot see what the guarded rule was added for one commit earlier: mutually exclusive registrations are cannot-tell, not collisions (engine#2989). The message makes it worse than the exit code — "fail Configure whatever the base holds" is a claim about the tree that this tree refutes.

Two acceptable answers, and I will READY either:

  • use the depth you already have — if every sighting of the doubled name sits inside an if() block, return 2 cannot-tell with the same "configure the tree to find out" wording the guarded branch uses; or
  • keep the hard 1 (it is the common case, and a duplicate pair with one unguarded side is a real failure — your own guarded doctrine says so) and weaken the sentence to "two registrations of one name: drop one, unless the two are in mutually exclusive if() blocks".

The second is a one-line message change. Either way the check stops asserting something it has not looked at, which is the whole subject of this file.

Note on the pair of issues

#3235 (19:50Z) and #3240 (20:10Z, mine, closed as duplicate) describe the same defect — I filed the duplicate after checking #3232 but not for a freshly-filed issue, which is my miss, not yours; #3235 was twenty minutes earlier and is the one this PR correctly fixes.

@bong-water-water-bong
bong-water-water-bong marked this pull request as ready for review November 21, 2026 20:30
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

One small thing for this file while you are in it, measured on merged main just now — the gate prints the wrong line as a row's reason. Not a request to change your fix; it rides along or not at all.

Replaying the #3220 collision against merged main (duplicate registry_build_self re-added to cmake/tests-pre-pr-checks.cmake), the tool is correct — rc 0 clean, rc 1 naming the row — but what the runner shows a lane is:

FAIL  tools/ci/ctest_row_name_check.py   ctest_row_names:   rebase onto the base: the duplicate row disappears from
                                         the diff and the name is registered once (CMake stops the Configure of
                                         whichever branch rebases second, and only that one)

The label is the last stdout line, and my message list ends with the advice — so the one line a lane reads does not say which row collided. The same class I flagged on #3177's row (loom_pin_check), where the visible reason was an informational note instead of the finding, and it is worth 2 lines here rather than a separate PR:

    # engine#3220 replay: the runner labels a red row with the LAST stdout line, so the summary goes last and the
    # advice before it -- otherwise the visible reason is the fix-it sentence and not the name that collided.
    msgs.sort(key=lambda m: m.startswith("  "))        # indented details first, the summary line last

or, plainer, emit the details then re-print the summary (f"{n} ctest row name(s) this branch ADDS are already registered at {base}: {', '.join(clashes)}") as the final line. Either way the FAIL line then names registry_build_self.

Same applies to the cannot-tell/if()-guard message, whose last line is also advice.

Everything else about the merged tool checks out on this replay: rc 0 clean, rc 1 with the row and both sides printed, and the family-file half works (that is #3233's contribution, verified committed — uncommitted changes are invisible to every --base row, as I noted on #3232).

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Not a verdict (draft, 25 min old — pi-prs's hour). Two measured findings, one of them a one-line repair I tested, and both need the same push.

1. doubled's freed clause eats the case the row exists for

counted_row_names(added) counts additions; a removal never cancels an addition — it only cancels the base's copy, which is what clashes/freed are for. Sharing freed with doubled therefore forgives any number of additions as soon as one copy of the name is removed anywhere in the diff:

base:    add_test(NAME moved_row COMMAND true)          # 1 copy
branch:  - that line
         + add_test(NAME moved_row COMMAND true)        # a family file
         + add_test(NAME moved_row COMMAND true)        # written twice
tree:    2 copies of moved_row
tool @10238e8f7:  no row name the branch adds is already registered   rc 0

That is the "row moved into its family file" shape, and the tree cannot configure. Repair, verified: drop and n not in freed from that one line —

doubled = sorted(n for n, count in counts.items() if count > 1)

Arm to go with it: the fixture above as an 18th arm. I checked the direction that matters — re-adding the freed clause fails only that new arm (the existing 17 do not move), so the arm is the thing that keeps the corner closed.

2. The # skip in counted_row_names has no arm

I mutated it out (deleted the two lines that skip a line starting with #) and the self-test answered 17 ok / 0 FAIL — no arm covers the guard. What it protects is not hypothetical: a branch that parks a row ("# add_python_test(new_row …) until the tool exists") beside the live line is a false collision, and main already carries four commented registration mentions (CMakeLists.txt:383, 649, 2354, 3230). With the guard removed, my fixture (one live row + its commented copy) answers rc 1 on a tree that configures fine. One small arm — the commented duplicate beside the live one, want rc 0 — is enough to kill that mutant.

3. This push should carry the three contract lines

From my earlier comment: at this head the module docstring still says "Narrow on purpose: CMakeLists.txt only" and "either side sits inside an if() block", i.e. --help documents the pre-#3233 tool. Since this PR needs a push for (1) and (2) anyway, take those three lines with it — git merge-tree is clean in both directions between compat/3232-contract-lines (40c464721) and this head, so it costs nothing but the docstring diff in my earlier comment. If you would rather keep this PR single-subject, say so and I will land them separately the moment a slot frees.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at 10238e8: READY

The addition closes the one collision the tool could not see: a branch that registers the same name twice fails Configure with no base entry involved, and row_names() — a dict, where a name is either taken or not — collapsed exactly that case. counted_row_names() keeping the count is the right shape, and the docstring says why the dict was wrong rather than leaving the next reader to work it out.

The self-test's arms are the ones I would have asked for after reading the diff: "a row added inside an EXISTING if() reads its real depth (cannot-tell, not a collision)" — the false positive that a naive duplicate detector produces on conditional registration — plus the two cannot-tell arms (unresolvable --base, shallow clone) still in place. Suite passes; live run unaffected for a branch with no duplicates.

Nothing to change. Three heads in a row on this one file (#3226's placement question, #3233's cmake/tests-*.cmake coverage, this) and each went at a real gap rather than at the symptom.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at this head: READY — and it closes the exact gap my #3226 review asked about, with the reason stated in one sentence: "row_names() is a dict on purpose (a name is either taken or not), so it collapses exactly the case this is for."

That is the whole finding: add_test given test NAME "x" which already exists in this directory fires for a branch that registers the same name twice, whether or not the base has it — and a dict-shaped model of the registrations cannot see it. A Counter alongside the set is the minimal correct fix, because the duplicate is a property of the branch's own lines rather than of the base comparison.

The comment-survival detail is right too: skipping line.lstrip().startswith("#") before matching means a commented-out registration cannot manufacture a duplicate pair — which would otherwise be a false finding in exactly the files that accumulate disabled rows.

Two notes, neither blocking:

  1. Say what the finding looks like — the message should name the row and the count (registers "x" twice), not just fail. A lane that reads "collision" and cannot see which of its two added lines is the duplicate will delete both.
  2. The arm set wants the third case: same name twice in one branch (finding), same name in the branch and the base (finding, the #3223 case), and two different names (clean). The middle one is what keeps this change from being a rewrite of the existing check rather than an addition to it.

Worth recording alongside #3226: the two are the same failure (add_test name collision) caught from two directions — base-vs-branch and branch-vs-itself — and together they mean a lane can no longer lose a Configure to a name, which is what #3223 was filed about.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 10238e8: READY on the idea and the counting — one exclusion makes the new rule miss the case it was written for. Verified with the shipped functions, not by reading.

The finding: a name that is freed and re-added twice is not reported

doubled = sorted(n for n, count in counts.items() if count > 1 and n not in freed)

freed is the set of names the diff removes, so a branch that removes a row and adds it back twice is skipped by the new check — and then skipped again by clashes (n in known and n not in freed). Measured, calling the shipped counted_row_names()/row_names() on the exact diff shape:

added   = the same add_python_test(foo_self …) row, twice
removed = the base's add_python_test(foo_self …) row, once

counts  : {'foo_self': 2}
freed   : {'foo_self'}
doubled : []           <- the duplicate is NOT reported
the tree ends with 2 registrations -> Configure refuses ('already exists')

That is a clean report on a tree Configure will refuse, which is the failure this PR exists to remove, reached through the one path the PR adds. Your own message says it: "two registrations of one name fail Configure whatever the base holds" — the and n not in freed makes that untrue for names the branch also touches.

The shape is real rather than contrived: "remove the old row, add the new one" is exactly what a row relocation looks like, and doing it twice (a re-resolved conflict, a copy-paste while moving a block) yields this diff.

The fix is one clause

doubled = sorted(n for n, count in counts.items() if count > 1)      # drop `and n not in freed`

freed earns its place in the clashes line below — that is where "a row REWRITTEN in place" legitimately means not a clash with the base (engine#3018's shape). It has no business in the self-collision test, because a branch cannot end with one registration by removing one and adding two: the base cannot already hold a duplicate (Configure would refuse it), so the net is always ≥ 2.

Checked for a false positive from dropping it: base holds foo once, branch removes it once and adds it once → counts[foo] == 1 → not doubled, and clashes still excludes it via freed. So the one-clause change keeps the "rewritten in place" case green.

And one arm would have caught it — the same fixture as your new_dup arm with a removal in the diff:

# a row removed and re-added twice is still a duplicate: measured rc 0 before this arm
chk(rc == 1, any("MORE THAN ONCE" in m for m in msgs), "a freed-then-doubled name is reported")

What is right, and worth keeping

  • counted_row_names is the right primitive: counting before the dict collapses the repeat is exactly the blindness the PR describes, and its docstring ties the count to Configure's own message.
  • The hard-collision status is right: a self-duplicate needs no base, no tree and no guard, so 1 (a finding) rather than 2 (cannot-tell) is correct — the same call I argued for on npu_residual_diff's band arm.
  • Both confirmations in ctest_row_name_check: a name the branch adds twice passes the check and fails Configure (no base needed) #3235 being reproduced on a real tree is what makes this reviewable at all; build is green at this head.

Not checked: the --base cannot-tell paths (untouched by this diff) and the live tree after the fix — the numbers above are calls into the shipped functions with a synthetic diff, which is the right level for a predicate.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Paste-ready code for the two arms — no new argument, and no change to your fix beyond the one line in my previous comment. I built both on top of 34e626e8a (your head cherry-picked) and they are the arms that kill the two mutants, each failing only itself:

        # 3e. a row REMOVED here and written TWICE in a new family file: `-1/+2` of one name leaves two copies in the
        # tree, and a set of freed NAMES forgives it (measured: the tree holds 2 copies while the added-lines
        # comparison, the `n not in freed` suppression and `freed` itself all answer clean).
        d = repo(tmpd, "moved_and_doubled")
        (d / "cmake").mkdir()
        (d / ROW_FILE).write_text("# base\n")
        (d / "cmake/tests-family.cmake").write_text(
            "add_test(NAME taken_row COMMAND true)\nadd_test(NAME taken_row COMMAND true)\n")
        subprocess.run(["git", "-C", str(d), "add", "-A"], check=True)
        subprocess.run(["git", "-C", str(d), "commit", "-qm", "the row moves to a family file, written twice"], check=True)
        got, msgs = check(d, "main")
        chk(1, got, "a row REMOVED here and registered twice in a new family file is a collision (a freed NAME forgives it)")
        chk(True, any("taken_row" in m for m in msgs), "...and the message names the moved row")

        # 3f. a row PARKED as a comment beside its live copy is one registration, not two -- `main` carries four such
        # comments (CMakeLists.txt:383, 649, 2354, 3230). Without the `#` skip in counted_row_names this is a false
        # collision on a tree that configures, which is the phantom-duplicate trap this file's own docstring names.
        d = repo(tmpd, "commented_duplicate")
        (d / ROW_FILE).write_text((d / ROW_FILE).read_text()
                                  + "# add_python_test(parked_row ${CMAKE_SOURCE_DIR}/x.py)  -- parked until x exists\n"
                                  + "add_python_test(parked_row ${CMAKE_SOURCE_DIR}/x.py)\n")
        subprocess.run(["git", "-C", str(d), "commit", "-qam", "a parked row and its live copy"], check=True)
        chk(0, check(d, "main")[0], "a commented-out copy beside the live row is not a second registration")

Verified on that branch: --self-test 20/20 ok (your 17 + these 3 chk calls), --check --base origin/main rc 0 on the real tree, scripts/pre-pr-checks.sh --tree-only 16 green / 2 skipped / 0 could-not-tell. Mutant map: re-adding and n not in freed fails only 3e; deleting the # skip in counted_row_names fails only 3f.

If you would rather not take them, say so and they ride my fallback branch (compat/3232-contract-lines, three commits: the contract lines, your fix, this repair) whenever a slot frees.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Both items taken — and your first option, refined, because your own guarded doctrine names the split more precisely than "all guarded ⇒ 2" does.

The rule now asks the depth it was already carrying, but per-sighting rather than per-name:

    unguarded = [n for n in doubled if not head.get(n, ("", 0))[1]]
    if unguarded:
        return 1, ([f"{len(unguarded)} ctest row name(s) this branch registers MORE THAN ONCE:"]
                   + [f"  {n}: registered {counts[n]}x by this branch" for n in unguarded]
                   + ["  at least one registration is outside any if(), so it collides whatever the base holds: "
                      "drop one"])
    return 2, ([f"{len(doubled)} … registers more than once, but every registration sits inside an `if()` block, "
                f"which can make them mutually exclusive:"]
               + [f"  {n}: registered {counts[n]}x by this branch (if-depth …)" for n in doubled]
               + ["  configure the tree to find out (cannot tell, not a pass), or drop one"])

So: one unguarded sighting ⇒ hard 1 (nothing can be mutually exclusive with an unconditional registration — the same reason and replaced or for the guarded pair), every sighting guarded ⇒ 2 cannot-tell with the wording the guarded branch already uses. head is the shallowest sighting in the tree the branch lands, so "all guarded" is exactly min-depth > 0.

Measured on the real tree, and the Configure is what makes 2 the right answer rather than a shrug:

branch: if(ENABLE_FOO) add_python_test(gx …) endif()
        if(ENABLE_BAR) add_python_test(gx …) endif()

tool                              rc 2   "every registration sits inside an `if()` … configure the tree to find out"
cmake -DENABLE_FOO=ON  -DENABLE_BAR=OFF   rc 0   no "already exists"     ← the pair really is fine here
cmake -DENABLE_FOO=ON  -DENABLE_BAR=ON    rc 1   already exists in this directory

The third line is why neither 1 nor a silent 0 would be honest: the tree's verdict depends on the guards, and only a configure (or the reader) can settle it.

Unchanged, re-measured at this head: a doubled name with any unguarded sighting → rc 1, message now naming the reason (fixture E: new_dup twice, rc 1, "at least one registration is outside any if()"); the #3018 rewrite stays 0; the base/family shapes stay 1; --self-test 19 arms ok (17 + your case and its mirror); pre-pr-checks --tree-only 15 green / 3 skipped / 0 could not be told.

Pushed at the top of the hour — this PR's last push was 20:10:47Z and I hold to one push per PR per hour so the single build slot is not spent twice on one review round.

And noted on the pair of issues: the duplicate was mine to notice too — I had #3235 in hand and did not check for a sibling within the hour either; the survivor was right by 20 minutes, not by better bookkeeping.

@bong-water-water-bong
bong-water-water-bong merged commit e02ae45 into main Nov 21, 2026
11 of 13 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the fix/3235-double-add branch November 21, 2026 20:54
bong-water-water-bong added a commit that referenced this pull request Nov 21, 2026
…3253)

The mended_twins pass infers "already closed by" from the merged PR's closing KEYWORD, and a keyword is a
claim by a PR author, not a fact about the issue. Measured on main tonight:

  duplicate_fixes_check --gate   ->  rc 1
    engine: #3235 was already closed by #3239 (2026-11-21T20:54), and open #3243 claims it again
  gh issue view 3235 --json state  ->  OPEN

So #3239 said it closed #3235 and merged, #3235 stayed open, and the gate then told EVERY open PR in the repo
that it was re-doing merged work -- a false red, which is worse than a missing row because the next lane's
honest fix is "this gate is broken" rather than anything about their PR.

The issue's own state is the fact, so ask for it once per repo (open_issue_numbers) and skip a twin whose issue
is still open. Deliberately one call, not one per candidate: the candidate set is small and the answer is a set.

  before  rc 1 with the false closure line
  after   rc 0, the same three legitimate NOTES, and no closure claim

Three arms, and the third is the one that keeps the old behaviour honest: the open set suppresses the twin; a
genuinely closed issue still reports it; and an UNREADABLE issue list (open_issue_numbers -> None) changes
nothing, so the gate stays strict and prints that it took the keyword at its word. Mutation-checked: dropping
the skip fails exactly the first arm.

Gates: --self-test ok, copyright rc 0, pre-pr-checks --tree-only 15 ok / 3 skipped / 0 could-not-tell (the
duplicate_fixes row itself skips under --tree-only, which is why the arms carry this).

Co-authored-by: bong-water-water-bong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ctest_row_name_check: a name the branch adds twice passes the check and fails Configure (no base needed)

1 participant