oficina / equipo Public

CI: start test children outside the repo root so cached passes hold

Reruns of ci-speed still ran directlive, equipotest, release and
tryequipo. The runner moves the worktree root's mtime at the start of
every job, and go test records the directory a child starts in, so a
child started in the root made those keys change each job. The child
builds and testci.RepoFiles now start elsewhere; a local check that
touches the root afterwards replays all four from the cache. Cache-miss
lines are printed once per package.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev d747ee8373a8a052e829780fa637fd73404e1ce2 parent 48d3f68
8 files changed, +30 −15
  • CI-PROGRESS.md +7 −0
  • internal/directlive/driver_fixture_test.go +5 −4
  • internal/equipotest/upgrade_test.go +3 −2
  • internal/release/toolproxy_build_test.go +3 −2
  • internal/testci/testci.go +3 −2
  • internal/tryequipo/tty_chain_test.go +4 −3
  • scripts/__pycache__/ci-test.cpython-313.pyc binary
  • scripts/ci-test.py +5 −2

CI passed — run details

diff --git a/CI-PROGRESS.md b/CI-PROGRESS.md
index 6922abd2..4357ae53 100644
--- a/CI-PROGRESS.md
+++ b/CI-PROGRESS.md
@@ -39,6 +39,13 @@ runner path as calm as it can be.
its parallel mechanism is a step's `@N` shards, so the lanes are the
seven shards of `30-test@7`, each with its own log and verdict, and
`make test-lane LANE=x` runs one locally.
+- **Cache keys stay stable across jobs.** The amadan runner moves the
+ worktree root's modification time at the start of every job, and go
+ test records the directory a child process starts in, so any test that
+ started a child in the root missed the cache every time (directlive,
+ equipotest, release, tryequipo). Those children now start in the test's
+ own package directory, and each lane prints a `cache miss:` line per
+ package that ran, so a new miss is visible in the log.
- **Timing budgets report on shared runners.** Time budgets fail the
step only where `EQUIPO_CI_DEDICATED=1` is in the runner's environment
(for a dedicated x86 box later; amadan passes the runner's own
diff --git a/internal/directlive/driver_fixture_test.go b/internal/directlive/driver_fixture_test.go
index 63eb3e6b..e96ce22c 100644
--- a/internal/directlive/driver_fixture_test.go
+++ b/internal/directlive/driver_fixture_test.go
@@ -30,7 +30,7 @@ func fakeDriverBuild(t *testing.T, badCoordinator bool) string {
}
f := &fakeDriverBuilds[index]
// Both builds are made from this tree by a child go command.
- testci.GoPackages(t, "../..", nil, "", "./cmd/equipo-tool-proxy", "./internal/directlive")
+ testci.GoPackages(t, "", nil, "", "../../cmd/equipo-tool-proxy", ".")
testci.Tools(t, "bwrap", "python3", "git")
f.Do(func() { f.root, f.err = buildFakeDriver(badCoordinator) })
if f.err != nil {
@@ -100,11 +100,12 @@ func buildFakeDriver(badCoordinator bool) (root string, err error) {
return root, err
}
for _, args := range [][]string{
- {"build", "-overlay", overlay, "-trimpath", "-buildvcs=false", "-o", filepath.Join(root, "equipo-tool-proxy"), "./cmd/equipo-tool-proxy"},
- {"test", "-c", "-overlay", overlay, "-o", filepath.Join(root, "worker"), "./internal/directlive"},
+ {"build", "-overlay", overlay, "-trimpath", "-buildvcs=false", "-o", filepath.Join(root, "equipo-tool-proxy"), filepath.Join(repo, "cmd/equipo-tool-proxy")},
+ {"test", "-c", "-overlay", overlay, "-o", filepath.Join(root, "worker"), "."},
} {
+ // From this directory, not the root: go test records a child's
+ // working directory, and the root's mtime moves on every CI job.
cmd := exec.Command("go", args...)
- cmd.Dir = repo
if out, err := cmd.CombinedOutput(); err != nil {
return root, fmt.Errorf("build fake driver: %w: %s", err, out)
}
diff --git a/internal/equipotest/upgrade_test.go b/internal/equipotest/upgrade_test.go
index e6f95525..45c64e1a 100644
--- a/internal/equipotest/upgrade_test.go
+++ b/internal/equipotest/upgrade_test.go
@@ -30,8 +30,9 @@ func TestRastrilloUpgradeContract(t *testing.T) {
t.Error("module Go floor must be 1.26.0")
}
bin := filepath.Join(t.TempDir(), "equipo")
- cmd := exec.Command("go", "build", "-o", bin, "./cmd/equipo")
- cmd.Dir = "../.."
+ // From this directory, not the root: go test records a child's
+ // working directory, and the root's mtime moves on every CI job.
+ cmd := exec.Command("go", "build", "-o", bin, "../../cmd/equipo")
cmd.Env = append(os.Environ(), "CGO_ENABLED=0")
testci.GoCommand(t, cmd)
if out, err := cmd.CombinedOutput(); err != nil {
diff --git a/internal/release/toolproxy_build_test.go b/internal/release/toolproxy_build_test.go
index 5cf9e468..6723e2c2 100644
--- a/internal/release/toolproxy_build_test.go
+++ b/internal/release/toolproxy_build_test.go
@@ -21,8 +21,9 @@ func TestToolProxyIsTheCertifiedBuild(t *testing.T) {
t.Skip("builds the tool proxy")
}
out := filepath.Join(t.TempDir(), "equipo-tool-proxy")
- cmd := exec.Command("go", "build", "-trimpath", "-buildvcs=false", "-ldflags", "-s -w", "-o", out, "./cmd/equipo-tool-proxy")
- cmd.Dir = "../.."
+ cmd := exec.Command("go", "build", "-trimpath", "-buildvcs=false", "-ldflags", "-s -w", "-o", out, "../../cmd/equipo-tool-proxy")
+ // Not from the root: go test records a child's working directory, and
+ // the root's mtime moves on every CI job, which defeats the cache.
cmd.Env = append(os.Environ(), "CGO_ENABLED=0", "GOOS=linux", "GOARCH=amd64")
testci.GoCommand(t, cmd)
if b, err := cmd.CombinedOutput(); err != nil {
diff --git a/internal/testci/testci.go b/internal/testci/testci.go
index 8d649218..568a785a 100644
--- a/internal/testci/testci.go
+++ b/internal/testci/testci.go
@@ -179,8 +179,9 @@ func RepoFiles(t testing.TB) {
if err != nil {
t.Fatalf("testci: %v", err)
}
- ls := exec.Command("git", "ls-files", "-z", "--cached", "--others", "--exclude-standard")
- ls.Dir = root
+ // git -C, not a working directory: go test records the directory a
+ // child starts in, and the root's would put its mtime in the key.
+ ls := exec.Command("git", "-C", root, "ls-files", "-z", "--cached", "--others", "--exclude-standard")
out, err := ls.Output()
if err != nil {
t.Fatalf("testci: git ls-files: %v", err)
diff --git a/internal/tryequipo/tty_chain_test.go b/internal/tryequipo/tty_chain_test.go
index 93c52deb..38bd2d92 100644
--- a/internal/tryequipo/tty_chain_test.go
+++ b/internal/tryequipo/tty_chain_test.go
@@ -43,13 +43,14 @@ func TestAutomaticAnswerProcessChain(t *testing.T) {
if err = os.WriteFile(overlay, raw, 0600); err != nil {
t.Fatal(err)
}
- cmd := exec.CommandContext(ctx, "go", "build", "-overlay", overlay, "-o", runner, "./cmd/equipo-try")
- cmd.Dir = root
+ // From this directory, not the root: go test records a child's working
+ // directory, and the root's mtime moves on every CI job.
+ cmd := exec.CommandContext(ctx, "go", "build", "-overlay", overlay, "-o", runner, "../../cmd/equipo-try")
cmd.Env = append(os.Environ(), "CGO_ENABLED=0", "TMPDIR="+scratch)
// The chain goes on to go run cmd/equipo-try, which go tests the
// provider package with the direct_live tag, all from this tree.
testci.GoCommand(t, cmd)
- testci.GoPackages(t, root, nil, "direct_live", "./internal/runner/provider")
+ testci.GoPackages(t, "", nil, "direct_live", "../runner/provider")
testci.Files(t, "testdata/tty-chain", "../../scripts/try-equipo.sh")
testci.Tools(t, "python3", "sh")
if out, err := cmd.CombinedOutput(); err != nil {
diff --git a/scripts/__pycache__/ci-test.cpython-313.pyc b/scripts/__pycache__/ci-test.cpython-313.pyc
new file mode 100644
index 00000000..343daeab
Binary files /dev/null and b/scripts/__pycache__/ci-test.cpython-313.pyc differ
diff --git a/scripts/ci-test.py b/scripts/ci-test.py
index 31afc6db..3d0f54d8 100755
--- a/scripts/ci-test.py
+++ b/scripts/ci-test.py
@@ -163,13 +163,16 @@ def run_reporting_misses(cmd, env):
env = dict(env)
env["GODEBUG"] = ",".join(filter(None, [env.get("GODEBUG", ""), "gocachetest=1"]))
p = subprocess.Popen(cmd, env=env, stderr=subprocess.PIPE, text=True, bufsize=1)
+ missed = set()
for line in p.stderr:
if not line.startswith("testcache: "):
sys.stderr.write(line)
continue
m = re.match(r"testcache: (\S+): (.*)", line.strip())
- if m and not m.group(2).startswith(("test ID ", "save ")):
- print(f"cache miss: {m.group(1)}: {m.group(2)}", flush=True)
+ if m and m.group(1) not in missed and not m.group(2).startswith(("test ID ", "save ")):
+ missed.add(m.group(1))
+ reason = m.group(2).split(": cache entry not found")[0]
+ print(f"cache miss: {m.group(1)}: {reason}", flush=True)
return p.wait()