Repository navigation
Description
Found while verifying #790's alerts fix: the Tier 0 suite reported PASS for a
change the binary under test did not contain.
The mechanism
test/e2e/substrate_cli.go:99:
func tier0SpawnBin(t *testing.T) string {
...
if p := filepath.Join(root, "bin", "spawn"); fileExists(p) {
return p // <- used as-is, no freshness check
}
// Build once into the test binary's temp dir.
...
}If bin/spawn exists it is used unconditionally. bin/ is gitignored, so it
is exactly the kind of artifact that accumulates locally — mine was from 08:07
while the source had changed at 17:15.
What it cost
I added a new Tier 0 case asserting that spawn alerts create refuses when the
alert consumer is not deployed. Against the stale binary:
- the new negative test failed with "exited 0" — correct, but for the wrong
reason, and I spent a round trip looking for the bug in my own code; - worse,
TestTier0_AlertsRoundTripPASSED — because the stale binary had no
refusal at all, so the round-trip succeeded vacuously. A green round-trip was
evidence of nothing.
The second half is the real hazard: a failing test prompts investigation, a
passing one does not. Anyone who has ever run make build and later runs
go test -tags e2e_tier0 is testing whatever that build produced.
CI is unaffected — it starts from a clean checkout where bin/spawn does not
exist — which is precisely why this can persist unnoticed: it only misleads
locally, and only the person doing the verifying.
Suggested
Prefer the explicit build, or make reuse conditional on freshness:
- Simplest and safest: drop the
bin/spawnshortcut and alwaysgo build
intot.TempDir(). It costs one build pergo testinvocation, and the
existing comment already says "Build once into the test binary's temp dir." - If the shortcut is kept for speed, compare
bin/spawn's mtime against the
newest.gofile under the module root and rebuild when it is older — and
fail rather than silently reuse if the comparison cannot be made. - Either way, have the harness log which binary it is testing and its mtime.
The current run prints nothing, so there is no way to tell from the output
which binary produced a result.
Option 1 is the one consistent with the gate convention in CLAUDE.md: a check
that can pass against code it did not run is not a check.
Activity
fix(alerts): refuse an alert that cannot be delivered (#790) (#793)
scttfrdmn commentedon Oct 11, 2026
It bit a second time, in the same session, with a different symptom — worth
recording because the second failure mode is the opposite of the first.
Removing the
alertscommand for #783 and running the suite:cmd/alerts.gohad been deleted. The command no longer exists in the source —but
bin/spawnwas from 40 minutes earlier, so the gate enumerated the commandlist from a binary that still had it and demanded a coverage decision for a
command that is gone.
go build -o bin/spawn .and it passes.So the hazard runs both ways:
The second is merely annoying — you investigate and find nothing. The first is
the dangerous one. But both argue the same way, and together they rule out the
"compare mtimes" option in my original suggestion 2: the coverage gate derives
the command list from the binary, so it is not only prices or behaviour that go
stale, it is the inventory. Any freshness heuristic has to be right every
time, and
go buildintot.TempDir()is right by construction.Recommending option 1 (always build) more strongly than before.
remove: the spawn alerts path and the stranded self-hosted stack (#783)…
remove: alert-evaluator and the dashboard's alert-preferences endpoin…
fix(deploy): discover deploy scripts instead of listing them, and fix…
fix(test): stop two gates passing against stale artifacts (#792, #795) (
Pass -count=1 to every e2e make target
Pass -count=1 to every e2e make target (#833)