mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 19:56:53 +00:00
The README generator read its author URL out of the ## Credits sections it
writes itself. .mailmap now folds every address a person commits under into
their @infinito.nexus one, whose local part names their social profile, and
that profile becomes the single point of truth for an author.
utils/meta/identity.py parses .mailmap rather than shelling out to
git check-mailmap, which refuses the worktree the test container mounts.
Cross-checked against git over all 14 identities in the history: no
disagreement.
A new env handler carries the committing identity into the container, which
mounts the checkout but not the contributor's git configuration. Without it
both new tests would skip exactly where they are meant to fire:
* tests/integration/meta/test_commit_identity.py fails when the configured
address does not fold, and prints the .mailmap line to add.
* tests/external/repository/test_author_profile.py probes that profile
live, behind a canary so an unreachable instance is not reported as a
missing profile.
Both look at the current address only. Probing every declared author would be
red for people who have not created a profile yet, and a suite that is red for
someone else's omission stops being read.
Marko Pjevac is declared as a role author but has no address here, so his
Credits line stays unlinked.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
51 lines
1.9 KiB
Python
51 lines
1.9 KiB
Python
"""The identity this checkout commits under resolves to an Infinito.Nexus one.
|
|
|
|
A contributor may commit under any address, but ``.mailmap`` has to fold it
|
|
into their ``@infinito.nexus`` one, because that address is what names their
|
|
public profile and the profile is where an author's details live.
|
|
|
|
Only the address configured here is checked. A historic address nobody commits
|
|
under any more is not this contributor's problem to fix, and failing on it
|
|
would make the suite red for everyone.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import unittest
|
|
|
|
from utils.meta.identity import DOMAIN, MAILMAP, canonical, committing_as, profile_url
|
|
|
|
|
|
class TestCommitIdentity(unittest.TestCase):
|
|
def setUp(self) -> None:
|
|
self.name, self.email = committing_as()
|
|
if not self.email:
|
|
raise unittest.SkipTest("git config user.email is unset here")
|
|
|
|
def test_the_configured_address_maps_to_an_infinito_nexus_one(self) -> None:
|
|
name, email = canonical(self.name, self.email)
|
|
|
|
self.assertTrue(
|
|
email.endswith(f"@{DOMAIN}"),
|
|
f"commits from this checkout carry {self.email!r}, which {MAILMAP} "
|
|
f"does not fold into an @{DOMAIN} address. Add a line to {MAILMAP}:\n\n"
|
|
f" {name} <yourname@{DOMAIN}> <{self.email}>\n\n"
|
|
f"That address names your profile at "
|
|
f"{profile_url(f'yourname@{DOMAIN}')}, which is where your author "
|
|
f"details are read from.",
|
|
)
|
|
|
|
def test_the_mapped_address_names_a_profile(self) -> None:
|
|
_name, email = canonical(self.name, self.email)
|
|
if not email.endswith(f"@{DOMAIN}"):
|
|
raise unittest.SkipTest("address is not mapped yet")
|
|
|
|
self.assertTrue(
|
|
profile_url(email),
|
|
f"{email!r} yields no profile slug; the local part must not be empty",
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|