Skip to content

chore: mark the paths that need a hardware smoke, and gate unset template fields - #688

Merged
scttfrdmn merged 1 commit into
mainfrom
chore/hardware-sensitivity-gates
Oct 4, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
chore/hardware-sensitivity-gates

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Answers "what can we test without hardware every release, and can we mark the code that does need it?"

Starting point: v0.118.0 shipped eleven fixes. Four were findable only on hardware while the unit suite stayed green, and three pre-existing tests asserted the broken behaviour as correct. So "add more unit tests" is not the lesson on its own.

What the bugs actually had in common

Sorting this session's bugs by why they escaped is more useful than by subsystem:

Escape route Bugs Fixable in CI?
Test built its own fixture and confirmed the author's belief #683, #684a, #669 Yes
Test asserted the text of generated shell, not its behaviour #668, #660 Partly
Property belongs to the OS image, not the code #684b Only in a container
Property belongs to AWS (accepts? authorizes? routes?) #659, #683-subnet, #652/#665 Partly

The dominant route is the first, and it is not about hardware at all. #683's drain filtered Tags["spawn:job-array-id"], which ListInstances never populates — a test with a hand-built InstanceInfo that put the tag in Tags passes forever. #684a's region test set BinariesBucket itself, proving the template could interpolate a bucket while never checking a caller did.

The fix for that class is to render through the production builder, not a literal. That's the one gate I implemented here.

Implemented

1. TestMemberUserDataHasNoEmptyInterpolations — renders user-data via buildJobArrayMemberConfig (the shipping path) across five launch shapes, and fails on unset-field signatures: s3:///, malformed ARNs, unresolved {{...}}, literal <no value>, path-less mkdir -p. Confirmed to fail when #684 is reintroduced. Costs nothing and runs in the normal suite.

2. scripts/hardware-sensitive.txt — your marking idea. Each path carries the bug that earned it a place, so the list can be argued with rather than inherited:

pkg/userdata/            #684 (openmpi on a PATH the probe never had), #660
pkg/launcher/bootstrap.go #668 — gate release is runtime; tests see only text order
pkg/mpicohort/           #684's probe passed its unit test, could never pass live
pkg/aws/securitygroup.go #659 — needed both the rule shape AND fi_pingpong
pkg/aws/iam.go           #669 rejected; #652/#665 accepted but unauthorized
cmd/launch_jobarray.go   #683 — drain ran, reported nothing, terminated nothing
lambda/ttl-reaper/       CFN/IAM no compiler reaches; disarmed production once

3. make smoke-needed — reports whether anything since the last tag touched those paths. Excludes _test.go, because changing a test cannot change what an instance does and a noisy signal gets ignored. Tied to the tag, not the PR: you don't need a smoke per commit, you need one per release that touched these areas.

4. make smoke — this session's verification, written down. MPI rank spread across every node, cloud-init status, --mpi-command argument preservation, fi_pingpong -p efa, then an independent leak check that asks AWS rather than trusting its own terminate calls — because a drain that silently terminated nothing was one of the bugs. ~$0.05, ~10 minutes, NODES= and SKIP_EFA= knobs.

The point of (4) is that today's verification took an afternoon because it was improvised. Next time it's a command.

Deliberately not built yet

Three more that I think are worth doing, in value order, but each is its own piece of work and I'd rather propose than half-build:

A. Substrate tag round-trip contract — launch into substrate with spawn's real tag-writing code, read back via ListInstances, assert every field spawn later reads is populated. This catches #683 directly and generically: it tests that producer and consumer agree, instead of trusting a fixture. Highest value of the three.

B. AL2023 container checks — run the enrollment probe and bootstrap fragments inside public.ecr.aws/amazonlinux/amazonlinux:2023 with openmpi installed. This is the only non-hardware way to catch #684b, because "is the binary on PATH in a non-login shell" is a property of the image. Caveat worth stating: a container has no IMDS, no cloud-init and no systemd, so it tests fragments, not the bootstrap — which is why it supplements the smoke rather than replacing it.

C. shellcheck on rendered user-data — cheap, and would likely have caught the quoting class (#660) and flagged the unbounded while [ ! -f ] wait (#684). Needs a baseline pass first since the existing templates will light up.

What this does not claim

It does not claim the smoke becomes unnecessary. #659's SRD traffic and #684b's PATH are genuinely different in kind: one needs the fabric, the other needs the image. What it claims is narrower — that the largest category this session was tests trusting their own fixtures, which is free to fix, and that the remaining hardware-only set is small enough to name, mark, and smoke in ten minutes.

I'd also suggest filing the 16-node assembly flake if it recurs; it failed once and passed once, and one data point isn't a bug report.

Gates

gofmt -l empty, go vet ./..., go test -short ./..., changelog gate. Both scripts bash -n clean and exercised in both directions (make smoke-needed against the current tag → "No changes"; against v0.117.0 → the six areas with reasons).

Two bugs found in my own tooling while writing it, both worth noting because they're the same shapes this repo keeps hitting: --tag spawn:smoke=… is rejected (the spawn: prefix is reserved), and piping git diff straight into grep made grep's "no matches" exit status read as a git failure under pipefail — it reported "cannot diff" right after a successful tag.

…late fields

v0.118.0 shipped eleven fixes. Four were findable only on real hardware
while the unit suite stayed green, and three pre-existing tests asserted
the broken behaviour as correct. This is the testing response.

scripts/hardware-sensitive.txt names the paths whose correctness is not
provable without an instance, each with the bug that earned it a place.
`make smoke-needed` reports whether anything since the last tag touched
them, excluding test files — changing a test cannot change what an
instance does.

`make smoke` is the hand-assembled verification from that session written
down: MPI rank spread across every node, cloud-init status, --mpi-command
argument preservation, fi_pingpong EFA fabric check, and an INDEPENDENT
leak check that asks AWS rather than trusting the terminate calls.

TestMemberUserDataHasNoEmptyInterpolations renders user-data through the
production builder and fails on unset-field signatures (s3:///, malformed
ARNs, unresolved {{...}}, <no value>). The test that should have caught
#684 set BinariesBucket itself, so it proved the template could
interpolate a bucket while never checking that a caller did. Confirmed to
fail when #684 is reintroduced.
@codecov

codecov Bot commented Oct 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant