oficina / estilo Public

CI: verify the module cache first, and re-fetch a damaged module

A runner's copy of rastrillo v0.23.0 had lost sessions/migrations/, so
go vet failed on main and every branch for a reason no commit could fix.
test-modcache runs go mod verify and re-downloads any module Go reports
as modified or missing, before anything else in the gate.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev af588c0741c3a7640a9234156315034fd5a028b4 parent 1e66804
2 files changed, +31 −5
  • .amadan/ci.d/05-modcache +8 −0
  • Makefile +23 −5

CI failed — run details

CI log
=== modcache ===
github.com/carlosframework/rastrillo v0.23.0: dir has been modified (/tmp/oficina-estilo-ci-runner/workdir/repos/oficina__estilo/cache/go-mod/github.com/carlosframework/rastrillo@v0.23.0)
github.com/dustin/go-humanize v1.0.1: dir has been modified (/tmp/oficina-estilo-ci-runner/workdir/repos/oficina__estilo/cache/go-mod/github.com/dustin/go-humanize@v1.0.1)
github.com/google/uuid v1.6.0: dir has been modified (/tmp/oficina-estilo-ci-runner/workdir/repos/oficina__estilo/cache/go-mod/github.com/google/uuid@v1.6.0)
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec: dir has been modified (/tmp/oficina-estilo-ci-runner/workdir/repos/oficina__estilo/cache/go-mod/github.com/remyoudompheng/bigfft@v0.0.0-20230129092748-24d4a6f8daec)
golang.org/x/sys v0.46.0: dir has been modified (/tmp/oficina-estilo-ci-runner/workdir/repos/oficina__estilo/cache/go-mod/golang.org/x/sys@v0.46.0)
modernc.org/libc v1.74.1: dir has been modified (/tmp/oficina-estilo-ci-runner/workdir/repos/oficina__estilo/cache/go-mod/modernc.org/libc@v1.74.1)
modernc.org/mathutil v1.7.1: dir has been modified (/tmp/oficina-estilo-ci-runner/workdir/repos/oficina__estilo/cache/go-mod/modernc.org/mathutil@v1.7.1)
modernc.org/memory v1.11.0: dir has been modified (/tmp/oficina-estilo-ci-runner/workdir/repos/oficina__estilo/cache/go-mod/modernc.org/memory@v1.11.0)
modernc.org/sqlite v1.55.0: dir has been modified (/tmp/oficina-estilo-ci-runner/workdir/repos/oficina__estilo/cache/go-mod/modernc.org/sqlite@v1.55.0)
re-fetching github.com/carlosframework/rastrillo@v0.23.0
re-fetching github.com/dustin/go-humanize@v1.0.1
re-fetching github.com/google/uuid@v1.6.0
re-fetching github.com/remyoudompheng/bigfft@v0.0.0-20230129092748-24d4a6f8daec
re-fetching golang.org/x/sys@v0.46.0
re-fetching modernc.org/libc@v1.74.1
re-fetching modernc.org/mathutil@v1.7.1
re-fetching modernc.org/memory@v1.11.0
re-fetching modernc.org/sqlite@v1.55.0
all modules verified
=== vet ===
CGO_ENABLED=0 go vet ./...
=== fmt ===
=== build ===
CGO_ENABLED=0 go build ./...
error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.
make: *** [Makefile:53: test-build] Error 1

amadan: step build failed: exit status 2

amadan: job failed at step build — its output is above, not at the tail of this log
diff --git a/.amadan/ci.d/05-modcache b/.amadan/ci.d/05-modcache
new file mode 100755
index 0000000..9c19be6
--- /dev/null
+++ b/.amadan/ci.d/05-modcache
@@ -0,0 +1,8 @@
+#!/bin/sh
+# One step of estilo's CI. It runs a Makefile target rather than its own
+# copy of the commands, so CI and the local gate stay ONE definition:
+# `make test` runs these same targets in this same order, and
+# `make test-modcache` is exactly what CI runs here. Debugging CI is
+# running it.
+set -eu
+exec make test-modcache
diff --git a/Makefile b/Makefile
index 21b9927..8c90674 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-.PHONY: build test test-vet test-fmt test-build test-go
+.PHONY: build test test-modcache test-vet test-fmt test-build test-go
# CGO_ENABLED=0 for the same reason sheets-core sets it: nothing here
# should grow a cgo dependency by accident. estilo has no cgo-driven
@@ -15,8 +15,26 @@ build:
# Order is cheapest-and-fastest first: vet and gofmt are near-instant,
# build catches compile errors before time is spent on tests, and
# go test — which includes the prefix-rule tripwire (internal/lint)
-# and the day-token drift check (theme) — runs last.
-test: test-vet test-fmt test-build test-go
+# and the theme's gates (token set, contrast, accent goldens) — runs last.
+# test-modcache goes first: nothing after it means anything if the
+# dependencies on disk are not the ones go.sum names.
+test: test-modcache test-vet test-fmt test-build test-go
+
+# Checks the module cache holds exactly what go.sum names, and re-fetches
+# any module Go reports as modified or missing. Written down because of
+# 2026-09-29: a CI runner's copy of rastrillo v0.23.0 had lost
+# sessions/migrations/, so `go vet` failed on main and every branch alike
+# for a reason no commit here could fix. The cache is a cache; a damaged
+# entry is removed and downloaded again, never trusted.
+test-modcache:
+ @out=$$(go mod verify 2>&1) && { echo "$$out"; exit 0; }; \
+ echo "$$out"; \
+ for m in $$(echo "$$out" | awk '/: (dir has been modified|missing)/ { v = $$2; sub(/:$$/, "", v); print $$1 "@" v }'); do \
+ d="$$(go env GOMODCACHE)/$$m"; \
+ echo "re-fetching $$m"; \
+ chmod -R u+w "$$d" 2>/dev/null; rm -rf "$$d"; \
+ done; \
+ go mod download && go mod verify
test-vet:
CGO_ENABLED=0 go vet ./...
@@ -35,8 +53,8 @@ test-build:
CGO_ENABLED=0 go build ./...
# Includes internal/lint's prefix-rule tripwire (AGENTS.md's
-# estilo-*/rst- split) and theme's day-token drift check (AGENTS.md's
-# two-pin case). -count=1 so a cached "ok" can never stand in for
+# estilo-*/rst- split) and theme's gates (AGENTS.md, "Theme"; the
+# token-set check is the two-pin case). -count=1 so a cached "ok" can never stand in for
# actually having run.
test-go:
CGO_ENABLED=0 go test -count=1 ./...