Skip to content

registration_loss_check: an empty merge base is 'everything is stale', so a missing row reads as 'nothing is at risk' (and the sentence claims a measurement that never happened) #3114

Closed

Description

@bong-water-water-bong

registration_loss_check: an empty merge base is classified as "everything is stale", so a missing row reads as nothing is at risk — and the sentence printed above it asserts a merge base that was never measured.

Survived #3107's shallow guard, by design: the guard keys on --is-shallow-repository, and two orphan roots in a full clone are not shallow.

Measured on merged main (f2af3f33)

Fixture: two roots with no common ancestor, the head missing one row.

$ git merge-base base other          → (empty)
$ git rev-parse --is-shallow-repository → false          # the shallow guard does not fire

$ python3 tools/ci/registration_loss_check.py --check --base base --head other
registration_loss: test beta (CMakeLists.txt) exists at base and NOT at other
registration_loss: 1 of 2 registration(s) at base are missing (0 deleted by this branch, 1 it simply never had)
registration_loss: none of them is deleted by this branch (they are absent from its merge base too), but the merge
                   CONFLICTS … Rebase onto base and keep every row it has.        rc=1

The verdict is defensible; "absent from its merge base too" is false — merge-base returned nothing, so nothing about a merge base was measured. Same class as engine#3048's "neither says Fixes/Closes": a right answer explained by a fact nobody established.

Why it is one branch from the dangerous direction

tools/ci/registration_loss_check.py:150-152 classifies deleted vs stale by the merge base (its own comment says so). With at_base = {} every lost row is stale, so the only thing between this path and "every missing row is absent from the merge base too … nothing is at risk" with rc 0 is the merge happening to conflict. I could not construct a clean-merge variant quickly, which is exactly why it should not depend on that — and the unrelated-history case needs no rebase at all, so telling the reader to rebase is advice that cannot work.

Asked change

Empty merge base + missing rows ⇒ cannot tell (rc 2), naming the condition. One if.

This is also the follow-up I recommended on #3106 for branch_stale_check and registry_loss_check: they are safe by accident (a failed merge-base happens to reach cannot-tell), which is one refactor away from this bug.

Activity

  1. added
    bug
    on Nov 21, 2026
  2. bong-water-water-bong commented on Nov 21, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Reproduced on merged main (f2af3f3) in a two-orphan-root full clone, and posted the before/after on #3115 — one refinement for this issue's headline:

    the false sentence reproduces; the rc 0 false clean did not, in my fixture. Base with alpha+beta, head (orphan) with alpha only:

    merge-base -> (empty)     is-shallow-repository -> false
    registration_loss: 1 of 3 registration(s) at base are missing (0 deleted by this branch, 1 it simply never had)
    registration_loss: none of them is deleted by this branch (they are absent from its merge base too), but the merge CONFLICTS …
    rc=1
    

    So the claim about an unmeasured merge base is exactly as reported, and the verdict is a finding rather than a clean one — the nothing is at risk branch (registration_loss_check.py:177-178) sits behind merges_cleanly(), and two orphan roots conflict on the shared path. The clean-merge-yet-drops-rows shape (rows in files that exist only at base) is the one that ships a silent loss; if the arm in #3115 can cover both, the issue closes on the dangerous half as well as the wrong sentence.

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

    @bong-water-water-bong
    CollaboratorAuthor

    The hole is in one file, not the family — checked the two siblings by reading their merge-base call sites, so nobody needs a sweep like the one #3106 warned against:

    • guard_loss_check.py:139-141 — mb = git("merge-base", …); rc != 0 → "no merge base for … - cannot tell", exit 2. Already cannot-tell, in a full clone with unrelated histories as much as anywhere.
    • doc_section_loss_check.py:96-99 — same shape, same answer ("cannot find a merge base for … - cannot tell, and that is not a pass").
    • registration_loss_check.py:153-164 — the only one that reads the merge base without checking its status: base_sha = …merge-base… then at_base = at_rev(root, base_sha) if base_sha else {}, so the deleted/stale split silently degrades to stale. That is exactly what registration_loss_check: no merge base is cannot-tell, not "everything is stale" (engine#3114) #3115 fixes.

    So #3115's single-file scope is right and complete; the other two need nothing. (Same distinction as #3106's own correction: merged_tail_check already had its refusal, and the table said otherwise.)

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions