test: give t/ its own git identity and run the whole tree in CI - #206
Merged
Merged
Conversation
Two coupled gaps in the t/ harness. The suite supplied no git identity of its own. t/test-lib.sh left it to whoever ran the tests, and several tests commit without configuring one per repository, so on a machine with no global identity — a fresh runner, a container — they died with "unable to auto-detect email address". .github/workflows/t9-suite.yml papered over that with a `git config --global` step, which meant the suite could not be run anywhere else without the same manual setup. t/test-lib.sh now points HOME at its own trash directory and writes a .gitconfig there. A global config file rather than GIT_AUTHOR_* / GIT_COMMITTER_*: those env vars outrank repository config and would silently override the many tests that set `git config user.email` in their own repositories, whereas a global file keeps the normal precedence. Redirecting HOME also stops a developer's real ~/.gitconfig from leaking into a run. t/test-lib-e2e.sh already did the equivalent. That unblocks the second gap: the only task touching t/ filtered on `t9`, so the 30 t0xxx files had no CI job at all — the same structural blind spot that let t9014, t90010 and a t9007 assertion sit broken for months. The task now runs the tree unfiltered and is renamed test-t, with the workflow renamed to match and its identity step dropped as redundant. All 63 files (t0 30, t1 1, t3 10, t7 1, t9 21) pass under `env -i` with an empty HOME and no git identity configured anywhere, in 54s against a prebuilt binary — the job's ~14 minutes is the release build, which is paid once either way. The t0011/t0012/t0013/t0015 "random" tests drive a seeded LCG from fixed seeds, so they are deterministic and carry no flake risk. Fixes #202 Fixes #204 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VDVUJHu38YtVAr6sKZtRDB
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.
Fixes #202
Fixes #204
These two are coupled — #202 is what made the workflow need a manual setup step, and dropping that step is part of #204's cleanup — so they land together.
#202: the harness supplies no git identity
t/test-lib.shleft the identity to whoever ran the tests. Several tests commit without configuring one per repository, so on a machine with no global identity — a fresh runner, a container — they died withunable to auto-detect email address..github/workflows/t9-suite.ymlworked around it with agit config --globalstep, which meant the suite could not be run anywhere else without the same manual setup.t/test-lib.shnow pointsHOMEat its own trash directory and writes a.gitconfigthere.Why a global config file rather than
GIT_AUTHOR_*/GIT_COMMITTER_*:git config user.emailin their own repositories. A global file keeps the normal precedence — a per-repository setting still wins.HOMEalso stops a developer's real~/.gitconfigfrom leaking into a run, which is its own source of "passes here, fails there".GIT_CONFIG_GLOBALwould work too, but is a newer git feature; a plainHOMEredirect has no version floor.t/test-lib-e2e.sh(used by 28 of the 30 t0xxx files) already did the equivalent, so this brings the two libs in line.#204: t0xxx has no CI job
#201 gave
t9a job; the only task touchingt/filtered ont9, so the 30t0xxxfiles still had no CI job at all — the same structural blind spot that let t9014 and t90010 stay red for months (#191) and a t9007 assertion never pass since #139 (#196).Taskfile.pkl:test-subdir→test-t, runningbash t/run-tests.shunfiltered. A filter is precisely how this went wrong twice; there is no longer one to get stale..github/workflows/t9-suite.yml→t-suite.yml, jobt9-suite→t-suite, since it is no longer t9-specific.Configure git identitystep is removed — redundant after the t/test-lib.sh sets no git identity, so the suite depends on the developer's global config #202 fix, and its absence is what proves the fix.docs/git-compatibility.mdandt/README.mdupdated.Scope note
#204 describes the range as t0 + t9. The tree actually holds five ranges: t0 (30), t1 (1), t3 (10), t7 (1), t9 (21) = 63 files. t1/t3/t7 were equally uncovered and all pass, so running unfiltered picks them up rather than leaving three more ranges to be noticed later.
The two concerns #204 raised
Job duration. All 63 files run in 54s locally against a prebuilt binary. The
t9job's ~14 minutes is almost entirely the release build thatdeps { build }triggers, and that is paid once either way — the extra 42 files add well under a minute.timeout-minutes: 90is left as is.Flakiness of the randomized tests.
t0011/t0012/t0013/t0015are not actually random: each drives a seeded LCG (LCG_STATE="$seed") from fixed seeds —seed=1,2,3for t0011,seed=101…for t0012. The op sequences are reproducible run to run, so there is no timing-dependent flake to separate out and no reason to split the job.Verification
Run under
env -iwith a fresh emptyHOMEand no git identity configured anywhere — nogit config --global, unlike the run in #204 which still set the two lines the old workflow did. This is the stricter check: it exercises the #202 fix and the #204 widening at once.pkl/pkfare not installed in this environment, soTaskfile.pklcould not be evaluated locally; the change is a rename of a local binding plus two string values, and CI will evaluate it.🤖 Generated with Claude Code
https://claude.ai/code/session_01VDVUJHu38YtVAr6sKZtRDB
Generated by Claude Code