Skip to content

test: isolate throwaway test repositories from global git config #17304

Description

@kyle-sexton

Problem

Test suites that create throwaway git repositories inherit the user's global git config, including commit signing. On a WSL host, signing through the Windows agent times out when several of these suites run in parallel, and the tests fail for a reason unrelated to the code under test.

Sessions work around it by setting GIT_CONFIG_GLOBAL=/dev/null and GIT_CONFIG_NOSYSTEM=1 before running such a suite. Every session has to know to do that.

Fix

Have each helper that creates a throwaway repository set both variables for the git commands it runs, so a test repository never reads the user's or the system's git config. Find the helpers by searching the test suites for git init and git -C inside temporary directories.

Done when

  • Every test helper that creates a throwaway repository isolates it from global and system git config.
  • The affected suites pass in parallel on a host whose global config signs commits, with no variables set by the caller.

🤖 Generated with Claude Code

Activity

  1. github-actions commented on Nov 19, 2026

    @github-actions
    Contributor

    The triage sweep dispatched intake triage for this issue (dispatch 2; 2 runs that reach intake, or 6 dispatches, hand it to a maintainer).

  2. github-actions commented on Nov 19, 2026

    @github-actions
    Contributor

    Size: Medium
    Complexity: Low
    Uncertainty: Known
    Flags: none
    Blocked by: none
    Blast radius: test helpers across several plugin test suites that create throwaway git repositories; run by developers and CI.
    Reversible: yes; revert the helper edits.
    Open questions: none
    Understood: test helpers that create temporary git repositories should set GIT_CONFIG_GLOBAL=/dev/null and GIT_CONFIG_NOSYSTEM=1 so global signing config doesn't make parallel suites time out. The approach is clear. The second done-when item (a run on a host that signs commits) can't be checked in an unattended run. I found no open issue or merged pull request that duplicates this.

    Automated triage. A maintainer reviews it.

  3. melodic-automation-lanes commented on Nov 19, 2026

    @melodic-automation-lanes
    Contributor

    Not admitted to the issue lane yet: no trusted-human acceptance criteria: a listed human must put the confirmed - [ ] criteria in the body or post them as their own comment, or, on an issue a listed human filed, intake's newest refinement comment must hold them unedited; intake's refinement of this body is due and may supply them.

  4. melodic-automation-lanes commented on Nov 19, 2026

    @melodic-automation-lanes
    Contributor

    Refinement. A read-only run explored this repository, searched its issues and pull requests, and read the allowed docs to draft what follows. On an issue a listed human filed, it counts as the issue's spec once posted, while unedited; it is still model text, so check it.

    Intended outcome: Test helpers that create throwaway git repositories export GIT_CONFIG_GLOBAL=/dev/null and GIT_CONFIG_NOSYSTEM=1, most likely once in scripts/test-git-helpers.sh plus the suites that do not source it.

    Related work

    Open questions

    1. Which helpers are in scope? A search finds git init in about 1000 files: *.test.sh and *.test.mjs suites, Python tests, and eval scaffold.sh fixtures. Only some source the shared helper.
      RECOMMENDED: Cover scripts/test-git-helpers.sh, every test suite that creates a throwaway repository, and shared fixture builders such as scripts/lib/fixture-tree.sh. Leave eval scaffold.sh files out. Basis: scripts/test-git-helpers.sh:1
    2. Should the isolation live in one place, as an export next to the existing unset line in scripts/test-git-helpers.sh, with suites made to source it? Or should each helper set the variables on its own git calls?
      RECOMMENDED: Export both variables once at source time in scripts/test-git-helpers.sh. Then make suites that run raw git (.mjs, .py, and .sh suites that do not source it) source it or set the variables themselves. Basis: scripts/test-git-helpers.sh:34
    3. Some suites already isolate with their own scratch config file instead of /dev/null. Should they be left as they are?
      RECOMMENDED: Yes. Leave suites that already set both variables or point GIT_CONFIG_GLOBAL at a scratch file, and only add the variables where nothing sets them. Basis: .claude/hooks/cloud-bootstrap-author.test.sh:64
    4. The second done-when item needs a host whose global config signs commits, which an unattended run cannot check. What checkable criterion replaces it?
      RECOMMENDED: Replace it with a check: under a HOME whose .gitconfig sets commit.gpgsign=true and gpg.program to a failing command, with no variables set by the caller, each affected suite passes. Alternatively add a guard script, like scripts/check-fixture-git-isolation.sh, that fails when a suite creating a repository sets neither variable. Basis: scripts/check-fixture-git-isolation.sh

    Sources read

    • scripts/test-git-helpers.sh:34: unsets GIT_DIR, GIT_CONFIG and other ambient git variables at source time but does not set GIT_CONFIG_GLOBAL or GIT_CONFIG_NOSYSTEM
    • scripts/test-git-helpers.sh:52: git_test_config passes -c commit.gpgsign=false, so only calls routed through it avoid signing
    • scripts/test-git-helpers.sh:92: git_init_test_repo sets local config on the fixture but leaves global and system config readable
    • context.json: no candidate duplicates this issue or already did the work

    To answer, post a comment that starts with this line:

    **Decision recorded.** <answer>
    

    Automated refinement by the lanes App. Answer with a comment whose first line is **Decision recorded.**.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Work status

    needs-owner-decision

    Priority

    medium

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions