Repository navigation
tests/conftest.py: the git() helper gives git no identity, so seven tests that commit through it (stage_unmerged's commit-tree, used by three tests in test_shape_doctor.py; commit in three tests of test_pin_validator.py and one of test_scaffold_e2e.py) fail with Author identity unknown wherever git cannot work one out, while 45 other calls in 18 files pass -c user.name=t -c user.email=t@t #279
Description
Lane: openreposhape-4 (openRepoShape-4)
Seen by three of this lane's agents today (writers and reviewers running tests/test_shape_doctor.py in a container whose git cannot work out an identity; each worked around it by exporting GIT_AUTHOR_* and GIT_COMMITTER_*). Re-verified on main eb6df75 (d89fffa plus #220, which added tests to tests/test_shape_doctor.py; every line cited was read on eb6df75). The three tests this lane first noticed are the commit-tree ones; reading the helper they go through found four more. Not claimed: why CI's three OSes do not hit it (a runner whose hostname resolves, or a global identity; not checked), and the rest of the suite was not run identity-less (see decision 3).
What is wrong. tests/conftest.py:83-89 git() runs subprocess.run(["git", *args], ...) with no env and no -c. A test that makes a commit through it, without supplying an identity itself, depends on git guessing one from the passwd entry and a hostname with a domain. Where git cannot, the commit fails:
# $U: a clean checkout at eb6df75. $EMPTY: an empty file. The four identity variables and EMAIL are unset; a container hostname with no domain.
GIT_CONFIG_GLOBAL=$EMPTY GIT_CONFIG_NOSYSTEM=1 python3 -m pytest tests/test_shape_doctor.py -q -k unmerged_path
# FFF 3 failed, 188 deselected in 12.50s
# E AssertionError: git commit-tree <sha>^{tree} -p <sha> -m the other side in $T/.../Atlas/code failed:
# E Author identity unknown ... fatal: unable to auto-detect email address (got '<user>@<host>.(none)')
# tests/test_shape_doctor.py:3642 in stage_unmerged -> tests/conftest.py:87 in git
GIT_CONFIG_GLOBAL=$EMPTY GIT_CONFIG_NOSYSTEM=1 python3 -m pytest tests/test_pin_validator.py \
tests/test_scaffold_e2e.py::test_bootstrap_reports_a_pin_that_disagrees_with_a_branch_tip -q
# 4 failed, 16 passed in 7.06s
# E AssertionError: git commit -q --allow-empty -m advance the spec leg in $T/.../Atlas/spec failed: Author identity unknown
# the same two runs with GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL exported:
# 3 passed, 188 deselected in 13.09s 20 passed in 7.69sThe seven: test_an_unmerged_path_with_a_file_stage_is_still_judged_as_a_file[file-then-gitlink], [gitlink-then-file] and test_an_unmerged_path_whose_every_stage_is_a_gitlink_is_one_submodule (tests/test_shape_doctor.py:3663 and :3706, both through stage_unmerged, :3620-3660, whose commit-tree is at :3642); test_gitlink_ahead_of_the_pin_is_a_finding, test_a_staged_bump_with_the_pin_moved_to_match_passes and test_a_staged_bump_the_pin_did_not_follow_is_still_a_finding (tests/test_pin_validator.py:42, :45, :68, :86); test_bootstrap_reports_a_pin_that_disagrees_with_a_branch_tip (tests/test_scaffold_e2e.py:332).
Which identity variables they lack: all four. They pass no GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_COMMITTER_NAME or GIT_COMMITTER_EMAIL, and no -c user.name or -c user.email. Probed with a bare git commit-tree in a scratch repository: none set is Author identity unknown; the author pair alone is Committer identity unknown; the committer pair alone is Author identity unknown; all four succeed. (Whatever run_script sets does not help: tests/conftest.py:214-217 does env.setdefault of all four, but only into the environment of the SCRIPT it starts, never of git().)
Why. The suite already has two ways to supply an identity, and these seven use neither:
-c user.name=t -c user.email=t@tahead of the verb, through this same helper: 45 calls in 18 files (git("-c", "user.name=t", "-c", "user.email=t@t", "commit", ...), for exampletests/test_family.py:88,tests/test_update_shape.py:137,tests/test_bump_leg.py:86). Those two settings supply the author and the committer both, so they work forcommit-treetoo (checked).- The environment:
GIT_IDENTITYintests/test_shape_doctor.py:75-78(all four variables), which that file'scommit_all(:80-88) and six more sites use (:325,:1064,:1260,:1266,:2788,:4590); andconftest.py:325-328,make_source_repo's own four.stage_unmergedsits in the file that definesGIT_IDENTITYand does not use it.
What it should do. No test makes a commit that needs an identity it did not give, so the suite passes on a machine git cannot guess one on. The decisions are the author's:
- Where the identity comes from. Either
git()supplies it (env={**os.environ, **IDENTITY}, with oneIDENTITYdict that replaces the three spellings of the four variables atconftest.py:214-217,:325-328andtest_shape_doctor.py:75-78; an explicitenvor-cat a call site must still win, becausemake_source_repo's tests commit asSource Humanon purpose), which fixes the seven and the next one with one change; or the seven call sites take the 45-call convention (-c user.name=t -c user.email=t@t), a smaller change that leaves the helper as the next test's trap. - A guard so it stays fixed: an autouse session fixture (or code at
conftest.pyimport) that setsGIT_CONFIG_GLOBALto an empty file,GIT_CONFIG_NOSYSTEM=1, and unsets the four variables andEMAIL, so every developer's machine runs as this container does and an identity-less commit fails in the author's own run. Optional; it would also surface any call the survey below missed. - Whether to run the whole suite once with no identity (a full run takes 12-48 minutes on a loaded workstation; not done here). The survey behind "seven" is: every
git(call oncommit,commit-tree,tag,merge,cherry-pick,rebaseandstashintests/(the onegit("tag", "main", ...)is lightweight and needs no identity), and the three files run above.
How to test. After the change, the two runs above (the four variables unset, an empty GIT_CONFIG_GLOBAL, GIT_CONFIG_NOSYSTEM=1) pass all seven tests; today they fail 3 and 4. With decision 2 the whole suite runs under the guard, so a future test that commits through the helper with no identity fails in every developer's own run and not only on a machine git cannot guess for; that is the regression test for the helper.
Related: #126 (closed: the same file's environment hygiene, run_script blanking inherited SHAPE_PIN_SOURCE_*), tests/test_shape_doctor.py's GIT_IDENTITY and commit_all (the precedent in the file).
Activity
brettheap commentedon Oct 12, 2026
CLAIMED — lane openRepoShape-4, session 3431c370-df80-4c11-a041-41bce42d8b38@Eagle, 2026-10-12T00:41:29Z, for #279
Logged in
lanes/log/openRepoShape-4.mdat44166c853cb387045571bab1d914d348523fb4b6.The three reads (lane-collision-protocol Rule 1):
tests/test_git_helper_identity.py: a test holds `git()`'s default ide…
tests/test_git_helper_identity.py: a tenth test holds the default thr…
conftest.py: re-wrap the tail of the `IDENTITY_CONFIG` comment to 79 …
Merge origin/main (a1b3a4b) into fix/adopt-plan-quote-yaml-keywords
Merge origin/main (a1b3a4b: #299 via #315, #216 via #228, #260 via #316…
Merge origin/main 8cdca5e into fix/adopt-root-kept-symlinks: thirteen…