Skip to content

fix(repo): reject Git identities that can never be attributed - #12244

Merged
Git-on-my-level merged 2 commits into
mainfrom
fix/attributable-git-identity
Aug 26, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
fix/attributable-git-identity

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Aug 26, 2026 •

Copy link
Copy Markdown
Member

What broke

PR #12239 was authored entirely by r <r@r> — a stale clone-local user.email shadowing the global identity. GitHub attributes commits by author email, so every commit landed with a generic avatar, unlinked to any account. 66 commits over five days carried it.

check_git_author_identity.py ran on all of them and printed OK: Git author identity is not a test fixture every time.

Why the guard missed it

The guard exists because of this exact failure. After #11525 minted Ratchet Test <[email protected]> from a clone-local override, it learned that display name, that local-part, and three reserved TLDs.

r@r is none of those. email_tld("r@r") returns "r" — the domain has no dot to split on, so there is no TLD to match.

The guard encoded the previous incident rather than the invariant. That is its own failure class, added here as FC-guard-encodes-incident-literals: a check built from an incident's literal values passes the next instance of the same class while reporting success, which is worse than no check — the incident recurs behind a green tick nobody re-examines.

The fix

One predicate, stated as a property rather than a list: an address whose domain cannot resolve can never be delivered or attributed to anyone, whatever it is named.

r@r                          -> domain 'r' has no dot, so it can never resolve   (NEW)
[email protected] -> reserved test TLD .invalid                       (existing)
[email protected]      -> ok
[email protected] -> ok

Deliberately weaker than "is this a real mailbox", which is not decidable here. It rejects only what is impossible under any DNS, so it needs no allowlist to maintain.

failures_for already applied its predicate to clone-local config as well as to the commit range, so this one change covers every lane:

  • pre-commit (--pending) rejects the override before a commit is minted
  • local lane of git-author-identity rejects it again before push
  • CI lane never sees a developer's .git/config — the commit range is the only unbypassable place this can be caught, and it now is

I also fixed the report wording. OK: ... is not a test fixture is precisely what let a non-fixture bad identity read as a pass; it now says attributable.

What I considered and rejected

The module docstring already states a stronger rule — "Never write user.name / user.email into this clone's local config" — which is stated but not enforced. Enforcing presence-as-failure would also have caught this, a day earlier.

I did not do it. It would break contributors who legitimately set a per-repo users.noreply.github.com address for privacy, and that is a policy call, not a bug fix. The predicate above closes the actual gap without imposing it. Easy to add later if the team wants it.

Verification

  • 9 tests pass (5 new). test_rejects_an_address_whose_domain_cannot_resolve asserts both halves: fixture_reason("r","r@r") is still None — documenting exactly why the old guard passed — while rejection_reason rejects it.
  • Both lanes covered by tests: clone-local override, and an r@r-authored commit range.
  • Real addresses, including users.noreply.github.com and github-actions[bot], are asserted unaffected. A name-only identity carries an empty email and is not judged on it.
  • Verified end-to-end through the real CLI: a simulated r@r override now fails --pending with all three identities named and the unset command as the remedy.

Failure-Class: new

Review in cubic

Git-on-my-level and others added 2 commits August 26, 2026 00:42
PR #12239 was authored entirely by `r <r@r>` from a stale clone-local
`user.email`. This guard ran on every one of those commits — 66 over five days —
and printed "OK: Git author identity is not a test fixture" each time.

It was enumerating the previous incident rather than the invariant. After
#11525 minted `Ratchet Test <[email protected]>`, the check learned
that exact display name, that exact local-part, and three reserved TLDs. `r@r`
is none of those, so it passed: `email_tld("r@r")` returns `"r"`, because the
domain has no dot to split on.

The rule is now the property that makes an identity wrong. An address whose
domain cannot resolve can never be delivered or attributed to anyone, whatever
it is called. That single predicate covers both incidents and the family they
belong to, and it needs no allowlist to maintain.

`failures_for` already applied its predicate to clone-local config as well as to
the commit range, so one change covers every lane at once:

- pre-commit (`--pending`) rejects the override before a commit is minted
- the local lane of `git-author-identity` rejects it again before push
- the CI lane never sees a developer's `.git/config`, so the commit range is the
  only unbypassable place this can be caught — and it now is

Real addresses, including `users.noreply.github.com`, are untouched; a
name-only identity carries an empty email and is not judged on it.

The report wording said "test fixture", which is exactly what let a non-fixture
bad identity read as a pass. It now says unattributable.

Co-Authored-By: Claude Opus 5 <[email protected]>
The class this PR's fix belongs to, and the reason it took a second incident to
notice: a guard written after an incident encoded that incident's literal values
instead of the property that made it wrong, so the next instance passed while
the check reported success.

evidence_prs is empty because this PR is the first instance; the adding commit
is the evidence.

Co-Authored-By: Claude Opus 5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit da93cea into main Aug 26, 2026
31 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/attributable-git-identity branch August 26, 2026 04:56
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.

1 participant