Skip to content

fix(ci): configure a git identity so the suite passes on a bare runner - #13

Open
ccevans wants to merge 2 commits into
mainfrom
fix/ci-git-identity
Open

ccevans wants to merge 2 commits into
mainfrom
fix/ci-git-identity

Conversation

@ccevans

@ccevans ccevans commented Aug 17, 2026

Copy link
Copy Markdown
Owner

What this does

Makes CI green again. main has been failing since a3fe211 (runs #50 and #51), on all three matrix legs.

The failure is not in the product code — all 1208 tests pass locally, lint is clean, and npm ci resolves fine. It is three assertions in test/lib/project.test.js that require createProject's initial git commit to succeed:

  • returns the facts a caller needs instead of printing them (L66)
  • makes the initial commit (L84)
  • reports the commit outcome as fields rather than as output (L158)

git commit needs an identity. A GitHub runner has no global git config, and the GIT_AUTHOR_*/GIT_COMMITTER_* vars the test sets in beforeEach never reach the child process — a Jest ESM test module mutates a copy of process.env, which the file's own comment above L150 already documents. On a developer machine git falls back to the global config and the commit lands, so the suite passes everywhere except a bare runner.

This adds a Configure git identity step to the workflow before Test.

Verification

Reproduced and confirmed by neutralising the global git config:

environment result
GIT_CONFIG_GLOBAL=/dev/null (what CI has today) 3 failed, 10 passed
with a global identity (this change) 13 passed

Same three tests, same line numbers as the CI annotations.

Note on the alternative

The narrower fix is to have lib/project.js pass an explicit env to execSync, but that would paper over a real behaviour: on a machine with no identity, bobby new genuinely cannot commit, and the code already reports that correctly via committed: false / commitError. The tests are asserting the happy path, so the environment is what should supply the identity.

Checklist

  • npm test passes
  • npm run lint passes (0 errors, 37 pre-existing warnings)
  • CHANGELOG.md not updated — happy to add a Fixed entry under [Unreleased] if you want build-infra changes logged there.

CI has been red on main since a3fe211. Three createProject tests in test/lib/project.test.js assert the initial commit lands, and a GitHub runner has no global git identity. The GIT_AUTHOR_*/GIT_COMMITTER_* vars the tests set never reach the git child process, because a Jest ESM test module mutates a copy of process.env (noted in the file's own comment at line ~150). Locally the commit falls back to the developer's global config, so the suite passes everywhere except CI. Configuring an identity in the workflow fixes it: 3 failed / 10 passed becomes 13 passed.
This case runs ~5.05s against Jest's 5000ms default on every Node version tested (measured on both 18 and 22 locally), so it sits right on the line and which CI leg fails is effectively a coin flip. Node 18 lost it on PR #13. The assertion is instant; the time goes on the HTTP round trip and server teardown. An explicit 20s budget makes the outcome deterministic rather than marginal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant