From bbf09935f1e6da682ba6553e03a8b94823df88b9 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 27 Jul 2026 03:55:17 +0000 Subject: [PATCH] fix: give the test suite its own git identity for CI runners The session tests seed throwaway repos with git commit, which fails on machines with no git identity configured (GitHub runners, fresh installs): the repo then has no commits, worktree creation has nothing to branch from, and 13 session assertions fail. The suite now exports GIT_AUTHOR/COMMITTER identity itself instead of depending on ambient config. Also tightens two assertions that false-passed on the runner by matching leftover index rows ("active"/"merged" anywhere in the file); they now match the specific branch row. Reproduced the CI failure locally with GIT_CONFIG_GLOBAL=/dev/null and verified 123/123 both with and without ambient git config. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01Nx3U4ZrUAmCpsCeSxvzRWX --- tests/run.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/run.sh b/tests/run.sh index f3c6d15..31446a4 100644 --- a/tests/run.sh +++ b/tests/run.sh @@ -27,6 +27,12 @@ ERRORS=() # ─── Temp environment ──────────────────────────────────────────────────────── +# The session tests create commits in throwaway repos. CI runners and fresh +# machines have no git identity configured, so the suite provides its own +# instead of depending on ambient config. +export GIT_AUTHOR_NAME="claude-team-tests" GIT_AUTHOR_EMAIL="tests@claude-team.invalid" +export GIT_COMMITTER_NAME="claude-team-tests" GIT_COMMITTER_EMAIL="tests@claude-team.invalid" + TEST_HOME=$(mktemp -d) CLAUDE_MD="$TEST_HOME/.claude/CLAUDE.md" mkdir -p "$TEST_HOME/.claude" @@ -390,7 +396,7 @@ if git -C "$SESSION_WT" status --porcelain 2>/dev/null | grep -q '.claude-sessio else ok "session marker is git-ignored in the worktree" fi -assert_file_has "session start writes active status" "$SESSION_INDEX" "active" +assert_file_has "session start writes active status" "$SESSION_INDEX" "feat/session-test.*active" # session start blocked if branch already active out=$(cd "$SESSION_REPO" && CLAUDE_TEAM_PROFILES="$PROFILES_DIR" HOME="$TEST_HOME" "$CLI" session start feat/session-test 2>&1) @@ -406,7 +412,7 @@ assert_contains "session list shows active branch" "feat/session-test" "$out" # session done marks merged in INDEX.md and removes worktree (cd "$SESSION_WT" && CLAUDE_TEAM_PROFILES="$PROFILES_DIR" HOME="$TEST_HOME" "$CLI" session "done" >/dev/null 2>&1) -assert_file_has "session done marks merged in index" "$SESSION_INDEX" "merged" +assert_file_has "session done marks merged in index" "$SESSION_INDEX" "feat/session-test.*merged" if [[ ! -d "$SESSION_WT" ]]; then ok "session done removes worktree directory"; else fail "session done removes worktree directory"; fi # session start with --plan writes plan slug