oficina / equipo Public

CI: name each cache miss; repo scan skips the root dir's mtime

The first rerun of ci-speed replayed most packages but reran
directlive, one contracts package and two others, with no way to see
which. Each lane now prints a line per package that missed go's test
cache. RepoFiles no longer declares the module root directory, whose
modification time moves on every CI job.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 48d3f683ca4a358409172274feecc66460e7c8c3 parent 5a1890a
2 files changed, +23 −1
  • internal/testci/testci.go +5 −0
  • scripts/ci-test.py +18 −1

CI passed — run details

diff --git a/internal/testci/testci.go b/internal/testci/testci.go
index d0f1c3a1..8d649218 100644
--- a/internal/testci/testci.go
+++ b/internal/testci/testci.go
@@ -185,6 +185,10 @@ func RepoFiles(t testing.TB) {
if err != nil {
t.Fatalf("testci: git ls-files: %v", err)
}
+ // Every directory but the root is declared, so a file added anywhere
+ // below it reruns the test. The root's own modification time moves on
+ // every CI job (the runner and the gate's tools touch it), which would
+ // make the test uncacheable; its tracked files are declared one by one.
dirs := map[string]bool{root: true}
for _, name := range strings.Split(string(out), "\x00") {
if name == "" {
@@ -198,6 +202,7 @@ func RepoFiles(t testing.TB) {
dirs[d] = true
}
}
+ delete(dirs, root)
for d := range dirs {
if err := open(d); err != nil {
t.Fatalf("testci: %v", err)
diff --git a/scripts/ci-test.py b/scripts/ci-test.py
index 42dc1643..31afc6db 100755
--- a/scripts/ci-test.py
+++ b/scripts/ci-test.py
@@ -152,10 +152,27 @@ def budget_test(packages, env):
print(f"uncached: {p}: {UNCACHED[p]}", flush=True)
cmd = rastrillo() + ["budget", "test", "-tags", TAGS, "-timeout", TIMEOUT] + extra + group
print("+ " + " ".join(cmd), flush=True)
- status = subprocess.call(cmd, env=env) or status
+ status = run_reporting_misses(cmd, env) or status
return status
+def run_reporting_misses(cmd, env):
+ """Run cmd with go's test cache debugging on, and print one line per
+ package that missed the cache instead of go's ID-by-ID trace, so the
+ log says what ran and, where go knows, why."""
+ 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)
+ 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)
+ return p.wait()
+
+
def run_lane(name):
packages = lane_packages(name)
print(f"test lane {name}: {' '.join(packages)}", flush=True)