oficina / equipo Public

hosted slice 2: checkrun's test gate runs make without make's env

TestChecksRunBaseChecksSHAOnlyOnBasePass pins the uncertified
candidate's output to "Uncertified candidate gate diagnostic:\nhi". Its
fake gate ran make ci with the test's environment, so under make test
the inherited MAKELEVEL made the inner make print "Entering directory"
lines and the test failed (passes alone; reproduced with MAKELEVEL=1).
The real gate runs make in a namespace with its own environment; the
fake now drops MAKELEVEL, MAKEFLAGS and MFLAGS the same way. Mutation:
renaming the diagnostic prefix in run.go still fails the test; restored.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 4835002d2633cc6fe2431b48eb5dfc1b5eafbc9b parent 76f572a
1 file changed, +8 −0
  • internal/runner/checkrun/run_test.go +8 −0
diff --git a/internal/runner/checkrun/run_test.go b/internal/runner/checkrun/run_test.go
index 63bf64a3..d3c05716 100644
--- a/internal/runner/checkrun/run_test.go
+++ b/internal/runner/checkrun/run_test.go
@@ -51,6 +51,14 @@ func (g *execGate) Run(ctx context.Context, attempt, dir string, argv []string,
}
cmd := exec.CommandContext(ctx, argv[0], argv[1:]...)
cmd.Dir = dir
+ // The real gate starts make in a namespace with its own environment.
+ // Under make test, MAKELEVEL and MAKEFLAGS leak in and the gate's make
+ // prints "Entering directory" lines into the output this test pins.
+ for _, kv := range os.Environ() {
+ if name, _, _ := strings.Cut(kv, "="); name != "MAKELEVEL" && name != "MAKEFLAGS" && name != "MFLAGS" {
+ cmd.Env = append(cmd.Env, kv)
+ }
+ }
out, err := cmd.CombinedOutput()
code := 0
if x, ok := err.(*exec.ExitError); ok {