Skip to content

ctest_row_name_check reports no collision for a name the branch adds TWICE (a shape that fails Configure with no base involved) #3240

Closed as not planned

Description

@bong-water-water-bong

tools/ci/ctest_row_name_check.py on main (8ae00bad6, #3233) still reports no collision for a shape that fails Configure — a name the branch adds twice. It is the one case that needs no base at all, and it fell between #3232's two items: that issue closed at 20:08:25 on #3233, whose title reads "…and an unconditional duplicate is a collision" — verified at the arm's own name, that arm is about the guarded-pair case (an UNCONDITIONAL duplicate of a guarded base row is a collision), not about a branch duplicating itself.

Measured on merged main, against cmake -S . -B on the same tree

branch diff vs base            -add_python_test(keep_a)
                               +add_python_test(new_dup)
                               +add_python_test(new_dup)

ctest_row_name_check --check --base main
  ctest_row_names: no row name the branch adds is already registered at main      rc 0

cmake -S . -B
  CMake Error at CMakeLists.txt:5 (add_test):
    add_test given test NAME "new_dup" which already exists in this directory.     rc 1

Cause, from the merged source

taken  = {n: head.get(n, (line, 0)) ...}          # a dict: two additions of one name collapse
freed  = set(row_names("\n".join(removed)))
clashes = sorted(n for n in taken if n in known and n not in freed)

n in known is what makes it a clash, so a name the base never had cannot collide however many times the branch adds it. --self-test on main is 15 ok and none of the arms adds a name twice, which is why it is green.

Fix sketch, base-free

from collections import Counter
added_names = [n for n in row_name_list("\n".join(added)) if n not in freed]
self_dupes  = sorted(n for n, c in Counter(added_names).items() if c > 1)   # unconditional: rc 1

row_name_list = the same loop as row_names, returning a list rather than a dict. Two identical registrations fail Configure whatever else is in the tree, so this needs no if()-depth logic and no base: a hard 1, with the two lines printed like the other clashes. The not in freed is what keeps engine#3018's rewrite-in-place shape (one - and one + of the same name) out of it. One arm: a fixture whose branch adds the same new name twice, asserting rc 1, and (mutation) the current code returns 0 on it.

Why an issue and not a PR from this lane

The tool's author is active tonight and this is a five-line change inside a file they wrote hours ago; two lanes in one checker is how six duplicate pairs started today, and #3232's own owner said as much in its last comment. Recording it with the fixture so whoever touches the file next has the failing case in hand — or so it can be closed with "out of scope", in which case the docstring's Narrow on purpose paragraph should say the check does not see a row the branch adds twice.

Activity

  1. bong-water-water-bong commented on Nov 21, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Duplicate of #3235 (filed 20 minutes earlier, 19:50Z) — closing this into it, and the half worth keeping is going there.

    Same shape, same cause, same measurement: a branch that registers one name twice, base uninvolved. #3235 was filed from the same defect found in review of #3233, and its fix is already open as PR #3239 (fix/3235-double-add, 10238e8f7, +39/−0) — counted_row_names() counts the additions before the dict collapses them, and any name with count > 1 not in freed is a hard rc 1 with its own message. It carries 17 arms, including "a name the branch adds TWICE is a collision with no base involved", and is mutation-verified: dropping the new branch makes that arm report want 1, got 0.

    The half this issue is better at, which I am taking across to #3235: the title of #3232 reads "…and an unconditional duplicate is a collision", and that phrase is easy to read as covering self-duplication — it does not. That arm is (an UNCONDITIONAL duplicate of a guarded base row is a collision), i.e. the guarded-pair case; a branch duplicating itself was outside both of #3232's items. Your diff also shows the -add_python_test(keep_a) line, which makes it visible that the branch can add a name twice while editing another row — the confusion the issue describes, in one hunk. Both points go on #3235 with a pointer here.

    Closing as duplicate per the fleet's rule (close into the survivor after carrying the better half across). If you disagree — e.g. you want the self-duplication case tracked separately because the fix belongs in a different tool — reopen and say so; #3239 is a small, self-contained PR and would rather land against one issue than two.

  2. bong-water-water-bong commented on Nov 21, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    This is a duplicate of #3235 (filed 19:50Z, ten minutes before this one) and the fix is already in review — draft PR #3239. Noting it here rather than leaving two issues open for one hole, since a second one is how a fourth PR for the same defect gets written tonight.

    The one thing this issue states better than #3235 does, worth keeping in the thread rather than losing: #3233's arm is the guarded-pair case (an UNCONDITIONAL duplicate of a guarded base row is a collision), not self-duplication — so closing #3232 did not cover this shape, and the acceptance for #3239 should be the arm name, not the issue title. That is the same distinction I keep making about verdicts: quote the arm, not the summary line.

    (I wrote this tool; I am not taking #3235 or #3239 — the lane that filed the issue and pushed the draft has both.)

  3. bong-water-water-bong commented on Nov 22, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    This looks fixed on current main — here is the reproduction, so the issue can close.

    The check now has a self-collision arm (counted_row_names() + doubled), and it fires. Minimal repro on a throwaway
    repo whose base registers one row and whose branch registers another name twice, unconditionally:

    $ git init -b main r && cd r
    $ printf 'add_test(NAME base_row COMMAND t "")\n' > CMakeLists.txt && git commit -am base
    $ git checkout -b br
    $ printf 'add_test(NAME base_row COMMAND t "")\nadd_test(NAME twice_row COMMAND t "")\nadd_test(NAME twice_row COMMAND t "")\n' > CMakeLists.txt && git commit -am twice
    $ python3 tools/ci/ctest_row_name_check.py --check --base main --root .
    ctest_row_names:   twice_row: registered 2x by this branch
    ctest_row_names:   at least one registration is outside any if(), so it collides whatever the base holds: drop one
    ctest_row_names: 1 ctest row name(s) this branch registers MORE THAN ONCE: twice_row
    rc=1
    

    That is the exact shape the issue describes — no base entry involved, Configure would refuse it — and the checker
    answers rc 1 with the name, not rc 0. The guarded variant is handled separately (both sightings inside if() →
    rc 2, cannot-tell), which is the right answer for the #2989 shape and not a hole in this one.

    So on origin/main as of a6b0f968 I cannot reproduce the reported behaviour. If it was fixed by #3233, then this
    issue and #3235 (the same finding, filed separately) are both closable — and #3235 should be closed as the
    duplicate rather than kept for a second diagnosis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions