Repository navigation
fix(repo): reject Git identities that can never be attributed - #12244
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What broke
PR #12239 was authored entirely by
r <r@r>— a stale clone-localuser.emailshadowing 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.pyran on all of them and printedOK: Git author identity is not a test fixtureevery 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@ris 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.
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_foralready applied its predicate to clone-local config as well as to the commit range, so this one change covers every lane:--pending) rejects the override before a commit is mintedgit-author-identityrejects it again before push.git/config— the commit range is the only unbypassable place this can be caught, and it now isI also fixed the report wording.
OK: ... is not a test fixtureis 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.emailinto 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.comaddress 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
test_rejects_an_address_whose_domain_cannot_resolveasserts both halves:fixture_reason("r","r@r")is stillNone— documenting exactly why the old guard passed — whilerejection_reasonrejects it.r@r-authored commit range.users.noreply.github.comandgithub-actions[bot], are asserted unaffected. A name-only identity carries an empty email and is not judged on it.r@roverride now fails--pendingwith all three identities named and the unset command as the remedy.Failure-Class: new