praefect/nodes: Serialize writes in TextPrinter
What races
PingAll starts one goroutine per node and passes every node the same TextPrinter. Printf writes the message and then the newline as two separate calls with no lock, so lines from different nodes interleave on stdout in praefect dial-nodes and praefect check. The readiness check discards its output and is unaffected. The race detector fires only when the writer is not safe for concurrent use, such as a test buffer. The race detector caught it in the CI of !9547 (closed), part of gitlab#634072.
flowchart LR
A[node goroutine 1] --> P[shared TextPrinter, now with a mutex]
B[node goroutine 2] --> P
P -->|message, then newline| W[writer]Reproduce
Run the connectivity check test with two nodes, and the new TextPrinter unit test, under go test -race. Both fail without the fix.
Fix
TextPrinter holds a mutex and Printf takes it, so each line is written whole.
Validation
make lint and make race-go TEST_PACKAGES=./internal/praefect/... pass on a test VM.
An AI coding assistant wrote this change and ran the checks above on test VMs.