Repository navigation
tests/conftest.py: git() runs git under a default identity given as -c config, never as environment, so the seven tests that commit through it with none of their own no longer die with Author identity unknown where git cannot work one out, and no call site's own -c user.name or exported identity is overridden (#279) - #310
Merged
Merged
Conversation
… `-c` config, never as environment, so the seven tests that commit through it with none of their own no longer die with `Author identity unknown` where git cannot work one out, and no call site's own `-c user.name` or exported identity is overridden (#279) `git()` ran git with no identity, so a test that committed through it and gave none of its own depended on git guessing one from the passwd entry and a hostname with a domain. Where git cannot (a container whose hostname has no domain), seven tests died with `Author identity unknown`: `stage_unmerged`'s `commit-tree` in three tests of tests/test_shape_doctor.py, `commit` in three tests of tests/test_pin_validator.py and one of tests/test_scaffold_e2e.py. CI never met it because each of its three jobs exports the four `GIT_AUTHOR_*` and `GIT_COMMITTER_*` variables, so git never has to guess. `git()` now runs `git -c user.name=<default> -c user.email=<default> <args>`. The default is `IDENTITY_NAME` and `IDENTITY_EMAIL` (`openRepoShape tests`, `[email protected]`, the spelling the suite already used), defined once in tests/conftest.py and reused by `run_script`'s four `setdefault`s, which keep the same values. The default is CONFIG and not environment because git ranks an exported `GIT_AUTHOR_NAME` or `GIT_COMMITTER_NAME` above `user.name`. A default put in an `env` would replace the identity of every call site that gives its own `-c user.name=...` (the commonest spelling in the suite, `-c user.name=t -c user.email=t@t`) and of `as_human`'s and `make_source_repo`'s `Source Human`, which commit as that on purpose. As `-c` ahead of the verb it is the weakest identity there is: a later `-c` on the command line wins over it, and an identity the operator or CI exports wins over both. Every call keeps exactly the identity it had; only a call that had none gains one. Proved identity-less (the four variables and `EMAIL` unset, an empty `GIT_CONFIG_GLOBAL`, `GIT_CONFIG_NOSYSTEM=1`, git 2.43.0): - A bare `git commit` fails with `Author identity unknown`; with the default as `-c` it records `openRepoShape tests`; with the call's own later `-c user.name=t` it records `t`; with an exported identity it records that one; and the rejected design, the default in the environment, records the default where the call asked for `t`. - Through the helper: `make_source_repo`'s three commits are authored by `Source Human`, a `git("-c", "user.name=t", ..., "commit")` by `t`, `as_human` by `Source Human`, a call with no identity by `openRepoShape tests`, and a bare `commit-tree` succeeds. - The seven tests: 7 failed on main's bytes (ede15ce), 7 passed on these. - tests/test_shape_doctor.py tests/test_pin_validator.py tests/test_scaffold_e2e.py tests/test_family.py tests/test_update_shape.py identity-less: 481 passed, 3 skipped (the Windows-only PowerShell test); nothing else in them needed an identity. - The normal run, identity exported, over tests/test_shape_doctor.py tests/test_pin_validator.py tests/test_scaffold_e2e.py tests/test_repo_hygiene.py: 355 passed, 3 skipped (the same three). Not here, and left to follow-ups: an autouse guard that isolates git's config for the whole suite (it overlaps the `gh` guard of #296), and one identity-less run of the whole suite. Lane: openreposhape-4 (openRepoShape-4) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 14 hours and 31 minutes by commenting |
Reviewer's GuideThe test Git helper now supplies a shared default identity via command-line configuration, allowing identity-less commits to work on systems where Git cannot infer an identity while preserving call-site and environment overrides; script-launch identity defaults are refactored to use the same constants. File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
…ntity and its precedence on a runner that exports an identity too, and the comment on the default now says where it ranks, above a config file's `user.name` and below a later `-c` and an exported identity (#279) The review of 5e182dc found two things wrong with it. Nothing guarded the helper's default or its precedence. CI exports all four `GIT_AUTHOR_*` and `GIT_COMMITTER_*` variables in each of its three jobs, and an exported identity outranks both the default and a call site's own `-c`, so on CI the default is invisible: a helper that lost it stays green there, and one that put it in the environment, or after a call site's own `-c`, stays green everywhere. Identity-less, the seven tests catch the first two of those mutants and not the last two, and no other test reads an author through the helper. tests/test_git_helper_identity.py removes the four variables, `EMAIL` and the config injectors itself and isolates git's config (an empty `GIT_CONFIG_GLOBAL`, `GIT_CONFIG_NOSYSTEM=1`), so it is identity-less on every runner. It checks that a call with no identity records the default; that a call's own `-c user.name=t -c user.email=t@t` and `as_human`'s `Source Human` beat it; that an exported identity beats both; and that `commit-tree`, an annotated tag, a merge, a cherry-pick and a rebase pick it up, the last two as the committer of a commit whose author they keep. It touches the helper alone: no autouse guard, no other test isolated. Verified against four mutants of `git()`, each in a scratch copy, under an exported identity and under none. Dropping the pairs, and omitting the email pair, fail the no-identity test and the five verb tests; moving the default into `env`, and placing it after a call site's own leading `-c`, fail the `-c user.name=t` test, the `as_human` test, the cherry-pick test and the rebase test. The control passes all nine. The comment on the default said it was "the weakest identity there is" and that every call keeps the identity it had. That was wrong against a config FILE: a `-c` on the command line outranks a global, system or repository-local `user.name`, so a commit through `git()` that gives no identity now records `openRepoShape tests` where it used to record the developer. It ranks below an exported identity and below a later `-c`, above any config file. That is harmless here, because no test reads such an author and nothing writes `user.name` into a repository's config, and the comment now says it, and says that a test needing its own identity passes it as `-c` or exports it. The same comment named `make_source_repo` as a case the environment design would have broken; its `commit()` runs git itself with its own environment and never goes through `git()`, so the contested call sites are `as_human` and the `-c user.name=` spellings, and the comment says those. And "the suite names its default once" said too much: this file names it once, for `git()` and `run_script`, and nine other test files still spell the pair. Lane: openreposhape-4 (openRepoShape-4) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ough a call that carries an unrelated `-c`, and the ranking comment names the four `GIT_*` variables that outrank the default, an exported `EMAIL` not being one of them (#279) The re-check of a2d6dc1 left three nits. A mutant of `git()` survived all nine tests: the default skipped whenever the call already carries any other `-c`, on the guess that the call gave its own identity. No call site is affected today, since no identity-needing call with no identity of its own carries a `-c`, so it was a gap in the test and not a live bug. `test_an_unrelated_dash_c_leaves_the_default_in_place` closes it: a `git("-c", "core.protectNTFS=false", "commit", ...)` that gives no identity records the default. The mutant fails exactly that test and the control passes all ten, both under an exported identity and under none; the four mutants of the last round fail as before, the two that drop a pair now also failing the new test. The ranking comment on `IDENTITY_CONFIG` said an identity "EXPORTED in the environment" is strongest. That holds for the four `GIT_AUTHOR_NAME`, `GIT_AUTHOR_EMAIL`, `GIT_COMMITTER_NAME` and `GIT_COMMITTER_EMAIL`, each for its own role, and not for `EMAIL`: git reads it only where no `user.email` is set, so `[email protected] git -c user.name=DEF -c [email protected] commit` records `DEF <[email protected]>`, and the same call with no default records `[email protected]`. The comment, the `git()` docstring, the test file's header and the exported-identity test's docstring now say which variables outrank the default and that `EMAIL` does not. The `idless` fixture's docstring said `HOME` is moved because git falls back to `~/.gitconfig` where `GIT_CONFIG_GLOBAL` is "unset on some builds". The fixture sets it itself; the reason is that git older than 2.32 ignores `GIT_CONFIG_GLOBAL`. It says that. tests/test_git_helper_identity.py: 10 passed identity-less and 10 passed with an identity exported. tests/conftest.py changes in comments and one docstring only. Lane: openreposhape-4 (openRepoShape-4) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…columns, which b15d167 left 80 and 112 wide, with no word changes (#279) b15d167 re-filled the last paragraph of the comment on `IDENTITY_CONFIG` and left two of its lines past the 79-column wrap the rest of the comment keeps: one 80 columns wide, one 112. The tail is re-wrapped to 79 or fewer. Every word is unchanged and in the same order; `git diff b15d167 -w --word-diff=porcelain` shows only the line breaks moving, and the word streams of the whole file, comment markers removed, are identical before and after (3366 words). Every other line is as it was, including the two long lines main already had (`def git(...)` and the `org: str = ...` signature). tests/test_git_helper_identity.py, identity-less: 10 passed. Lane: openreposhape-4 (openRepoShape-4) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
This was referenced Oct 12, 2026
brettheap
added a commit
that referenced
this pull request
Oct 12, 2026
…, #253 via #264, #302 via #318, #288 via #309, #279 via #310, #306 via #311, #334 via #336, #239 via #269, #243 via #268, #321 via #335) into fix/adopt-record-submodule-placement Brings in the twelve commits from c7c02fa to a1b3a4b on top of 71b58a1, merged by sha. No rebase. Among the files this branch changes: 346079d (#216) and e43fa95 (#243) change adopt-project.py; 34ecbc2 (#260) changes scripts/shape_materialize.py; 87373a6 (#306) changes shape-doctor.py and tests/test_shape_doctor.py; 7491530 (#288) changes AGENTS.md and tests/test_repo_hygiene.py. Two conflicts, each resolved keeping both sides: - adopt-project.py, the module docstring's `execute` paragraph. #243 ends "the root's only submodules are the two leg mounts, each at the commit pushed to its leg."; this branch follows "two leg mounts." with "The split's `project.yaml` records the leg each source submodule kept in a leg was answered into, under `submodules:`, for `shape-doctor.py` to check it against." The merge has #243's sentence, then this branch's, re-wrapped to the paragraph's width. The module docstring is not in `--help` (docs/cli.md holds neither sentence). - tests/test_repo_hygiene.py, `test_agents_md_is_short_enough_to_be_read`. Each side moved the AGENTS.md cap from 464 and wrote a paragraph saying why: #288 to 477, for thirteen lines, and this branch to 472, for eight. AGENTS.md itself merged cleanly and holds both: 485 lines, main's 477 plus this branch's +9 -1. The merge keeps #288's paragraph word for word, then this branch's, renumbered "2026-10-12: 477 -> 485" because it now follows #288's, and asserts `<= 485`. `git merge-tree --write-tree` of the two parents gives the same tree in every file but these two. Checked: - adopt-project.py: `_commit_the_split` was changed by both sides, in hunks that do not touch. #243 clones the assembly with `--template=`; this branch builds `append` with the `submodules:` record. The merged function holds both, and each side's text is unchanged. Every other definition one side changed is that side's text. - shape-doctor.py: #306 changes `validator_row` and `run_validator`. This branch's placement functions, F1's `gitmodules_the_record_answers` among them, are this branch's text. - No top-level name is bound twice in adopt-project.py, scaffold-project.py, scripts/repo_shape.py, scripts/shape_materialize.py, shape-doctor.py, validate-manifest.py, update-shape.py, scripts/family.py or scripts/bump-leg.py. Each merged module's names are the base's plus what either side added. - AGENTS.md is main's plus exactly this branch's changed lines. - The branch's diff against main is #189 alone: 12 files, +1694 -157. That is +1670 at 27d039b, plus F1's fix and test (+23), plus the one line the docstring re-wrap adds. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap
added a commit
that referenced
this pull request
Oct 12, 2026
… of main's commits merge with no conflict, among them #243's template-less clone of the assembly and #216's literal `git grep` in adopt-project.py, and #260's one-pass `render` in shape_materialize.py origin/main moved 71b58a1 -> 8cdca5e. It was merged by sha, as the coordinator asked for e43fa95 or later: - c7c02fa (#299 via #315), scripts/family.py; - 346079d (#216 via #228), adopt-project.py: `plan`'s follow-up `git grep`; - 34ecbc2 (#260 via #316), scripts/shape_materialize.py: `render` substitutes in one pass; - 86da808 (#253 via #264), scripts/bump-leg.py; - 6f4ce47 (#302 via #318), scripts/family.py; - 7491530 (#288 via #309), AGENTS.md, README, docs and scaffold-project.py's --help; - 7591455 (#279 via #310), tests/conftest.py: `git()` takes its default identity as `-c` config; - 87373a6 (#306 via #311), shape-doctor.py; - 8a14ac9 (#334 via #336), tests/test_update_shape_landing.py; - c1b6732 (#239 via #269), update-shape.py; - e43fa95 (#243 via #268), adopt-project.py: the assembly root is cloned with `--template=`, and the verification refuses a mount whose gitlink is not the commit pushed to its leg (`adopt-mount-commit`); - a1b3a4b (#321 via #335), tests/test_git_output_decoding.py; - 8cdca5e (#295 via #312), the template's scripts/validate-pins.py. `git merge-tree` and this merge give the same tree, 07e6b49. adopt-project.py, scripts/shape_materialize.py and tests/test_adopt_ignored_shape_files.py auto-merge. In the last of these main's 346079d and this branch's 86a5e30 change different cases. Checked on the merged tree: - AST (fin183g/names.py, base 71b58a1): no top-level name is bound twice in adopt-project.py, scaffold-project.py, scripts/repo_shape.py or scripts/shape_materialize.py, and none is loaded but bound nowhere. Main changed the signature of no function this branch calls. - Every sentence 86a5e30 changed is still there: in `_through`, in `_link_parts`, in `_verify`'s `_resolve` (which e43fa95's `adopt-mount-commit` leaves as it was), and in the three test files. - `_commit_the_split` now clones the assembly with `--template=`. The next commit, F3, reads what that clone holds in its own `.git`, which is why F3 comes after this merge. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.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.



Lane: openreposhape-4 (openRepoShape-4)
Claim: #279 (comment)
What
tests/conftest.py'sgit()now runsgit -c "user.name=openRepoShape tests" -c [email protected] <args>. The two values areIDENTITY_NAMEandIDENTITY_EMAIL, defined once next toFILE_PROTOCOL;run_script's foursetdefaults reuse them (same values, so a pure refactor), so conftest names the default once, forgit()andrun_script. Nine other test files still spell the same pair for their own commits, andGIT_IDENTITYintests/test_shape_doctor.pyis among them; none is touched.A second file,
tests/test_git_helper_identity.py(10 tests, added after review), holds the default and its precedence on a runner that exports an identity as well as one that does not.The branch carries four commits: the helper change, then the review's fix round (the test file, and the ranking comment corrected), then a second fix round (a tenth test, the four variables named in the ranking), then a re-wrap of one comment paragraph to 79 columns with no word changes. The squash takes the final subject.
Why
git()gave git no identity, so a test that commits through it with none of its own depends on git guessing one from the passwd entry and a hostname with a domain. Where git cannot, seven tests die withAuthor identity unknown:stage_unmerged'scommit-treein three tests oftests/test_shape_doctor.py,commitin three oftests/test_pin_validator.pyand one oftests/test_scaffold_e2e.py. CI does not hit it because each of its three jobs exportsGIT_AUTHOR_*andGIT_COMMITTER_*(.github/workflows/tests.yml, the "git identity for the scaffolded commits" step of thetests,tests-windowsandtests-macosjobs), so git never has to guess.Why config and not environment.
GIT_AUTHOR_NAMEandGIT_COMMITTER_NAMEoutrankuser.name, so a default inenvwould silently replace the identity of every call site that gives its own-c user.name=...:as_human'sSource Human, and-c user.name=t -c user.email=t@t, the commonest spelling in the suite. (make_source_repo'scommit()runs git itself with its own environment and never goes throughgit(), so it is not one of them.)Where the default ranks, strongest first: the four
GIT_AUTHOR_NAME,GIT_AUTHOR_EMAIL,GIT_COMMITTER_NAMEandGIT_COMMITTER_EMAILwhere exported in the environment, each for its own role; a later-con the same command line, which is how a call site's own-c user.name=...beats it; the default; then every identity read from a config file, global, system or repository-local. An exportedEMAILis not in the top group: git reads it only where nouser.emailis set, so the default's address hides it ([email protected] git -c user.name=DEF -c [email protected] commitrecordsDEF <[email protected]>). So the default fills a gap and overrides no call site and none of the four variables, but it does outrank a developer's own~/.gitconfigidentity: a commit throughgit()that gives no identity now recordsopenRepoShape testswhere it used to record the developer. That is harmless here: no test reads such an author, and nothing in the suite writesuser.nameinto a repository's config. A test that needs its own identity to take effect throughgit()passes it as-c, or exports the four variables. Probed in a scratch repository (git 2.43.0, emptyGIT_CONFIG_GLOBAL,GIT_CONFIG_NOSYSTEM=1, the four variables andEMAILunset):git commitAuthor identity unknown-conlyopenRepoShape tests-c user.name=t -c user.email=t@ttGIT_AUTHOR_*/GIT_COMMITTER_*EMAILonlyEMAILranks below it)env, the call's own-c user.name=topenRepoShape tests(the call asked fort)Tests
The seven are the regression tests for "a default exists", and they catch it only on a machine git cannot guess an identity on. CI exports an identity, which outranks the default and any call's own
-c, so on CI the default is invisible: nothing else in the suite saw the precedence, and a helper that put the default in the environment, or after a call's own-c, passed every existing test.tests/test_git_helper_identity.pycloses that. Each test removes the four identity variables,EMAILand the config injectors and isolates git's config, so it is identity-less on every runner. It checks that a call with no identity records the default; that a leading-cthat gives no identity (core.protectNTFS=false) leaves the default in place; thatgit("-c", "user.name=t", ...)andas_humanbeat it; that an exported identity beats both; and thatcommit-tree, an annotated tag, a merge, a cherry-pick and a rebase pick it up. It touches the helper alone: no autouse guard, no other test isolated.Five mutants of
git(), each run in a scratch copy under an exported identity (openRepoShape CI) and under none, with the same result both ways:-ctest, and thecommit-tree, tag, merge, cherry-pick and rebase tests (7 failed)env-c user.name=ttest, theas_humantest, the cherry-pick and rebase tests (4 failed)-c-c-ctest alone (1 failed); it survived the first nine testsThe control (the head) passes all ten, and the exported-identity test passes under every mutant, as it must.
Runs,
ghshim first on PATH (it logs and exits 97),git-filter-repo2.47.0,--basetempunder scratch:tests/test_git_helper_identity.py -q, identity-less: 10 passed; the same with an identity exported: 10 passed.a2d6dc1:tests/test_git_helper_identity.py tests/test_shape_doctor.py tests/test_pin_validator.py tests/test_scaffold_e2e.py tests/test_repo_hygiene.py -q, identity exported as usual: 364 passed, 3 skipped (the 3 are the Windows-only PowerShell test). The head adds one test and changes comments and one docstring intests/conftest.py; the four other files were not run again.5e182dc.tests/test_shape_doctor.py tests/test_pin_validator.py tests/test_scaffold_e2e.py tests/test_family.py tests/test_update_shape.py, identity-less, on5e182dc: 481 passed, 3 skipped.git("-c", "user.name=t", "-c", "user.email=t@t", "commit", ...)recordst,as_humanrecordsSource Human, a call with no identity recordsopenRepoShape tests, and a baregit("commit-tree", ...)succeeds.--helptext changed, sodocs/cli.mdis unchanged. macOS and Windows have not run the latest head yet. Nothing in it is platform-specific: the two-cpairs go through a list-formsubprocess.run, with no shell and no stdin, and the new tests use plain file names.Landing notes
mainb421e6b (git merge-tree --write-tree).gh(407 calls togh --versionandgh auth status, andgh api userbesides with a login) through the doctor'smachinerow and the installed command's machine block, so a suite whose conftest says "NO NETWORK AND NO GITHUB" reaches the host on a logged-in machine, and the oneghstub the doctor tests have is called by that row without the test seeing it #296'sghguard), and one identity-less run of the whole suite (the runs above are the files named, not the suite).Closes #279
🤖 Generated with Claude Code