Files
boshu2__agentops/cli/internal/eval/eval_testmain_test.go
Bo f091314f49 fix: harden GC factory recovery; kill the core.bare test git-env leak at the test layer (#923)
Follow-ups on the bead-native Gas City factory (#917) plus the durable
fix for the recurring core.bare corruption class
(age-cmdao-core-bare-pollution-ek8v, recurred 2026-07-18).

## GC factory hardening (7 commits)
- crash-replayable bead transitions; program/refinery recovery
reconciliation
- ordered rejection recovery; rescope fenced on source closure
- guarded direct rescope dispatch and successor reduction
- ship the managed Gas City template

## core.bare / git-env test isolation
- New `cli/internal/testsupport.ScrubGitDiscoveryEnv()` called from
`TestMain` in all 11 packages whose tests shell out to git (cmd/ao,
adapters/gate, archcheck, canon, doctor, eval, gates, goals, paths,
quality, vibecheck). Mechanism reproduced: hook-injected `GIT_DIR` at a
linked worktree gitdir redirects fixture `git init` into the SHARED
.git/config (`core.bare=true`). Complements #922 (per-helper scrubs +
hygiene gate) with package-wide process-level scrubbing.
- Unit tests pin the scrub behavior and the var list; convention
documented in both go.md standards (codex twin regenerated).
- Verified under a hostile hook-shaped env against a decoy repo: suites
green, decoy and real repo untouched.

## Merge reconciliation
- Adopted main's hermetic `aoBinary` (build-from-source flag matrix;
supersedes the equivalent fix made independently here).
- Repaired the auto-merge-corrupted
`skills-codex/.agentops-manifest.json` by reset + `regen-all.sh` (check
passes clean).

Full `go test ./...`: 49 packages ok, rc=0.
2026-07-18 18:43:28 -04:00

21 lines
672 B
Go

package eval
import (
"os"
"testing"
"github.com/boshu2/agentops/cli/internal/testsupport"
)
// TestMain scrubs git's hook-injected repository-discovery env
// (GIT_DIR, GIT_WORK_TREE, ...) before any test in this package runs.
// Tests here shell out to git (directly or through production code); with
// those vars leaked in — e.g. when the suite is launched from a git-hook
// context — every fixture git operation is redirected to the REAL repo,
// which is how core.bare=true corrupted the shared .git/config
// (age-cmdao-core-bare-pollution-ek8v, recurred 2026-07-18).
func TestMain(m *testing.M) {
testsupport.ScrubGitDiscoveryEnv()
os.Exit(m.Run())
}