Setting nextest retries to 0 does not fail flaky tests; it stops detecting them
While coordinating a rewrite of the test suite for a new Rust service, I let our nextest configuration change from retries = 2 to retries = 0. I then reported it as: “nextest retries are now 0, so a flaky test fails.” That statement was false. The configuration already failed flaky tests, and the change removed the only mechanism that detects them. The person who wrote the configuration caught it from that one line, and I restored the setting before anything was pushed.
How the two settings work
Our shared repository template renders this into every Rust repository:
[profile.default]
retries = 2
flaky-result = "fail"
retries = 2reruns a failing test up to twice. A test that fails and then passes is classified as flaky. A test that fails every attempt is failed.flaky-result = "fail"makes a test classified as flaky count as a failure of the run. By default it would count as a pass.
Together they make a flaky test fail the run and label it as flaky.
With retries = 0, each test runs once. Nextest can never observe “failed, then passed”, so nothing is ever classified as flaky and the flaky-result line has nothing to act on. A flaky test either fails its single attempt and looks like an ordinary failure, or passes and leaves no trace.
Where I went wrong
The brief. I delegated the rewrite with a requirement that “nextest retries must not hide a flaky test”. I wrote that without opening the configuration file. The file already met the requirement, so the clause had nothing to ask for. Written as an instruction, it told the worker there was something to fix.
The change. The worker set retries to 0 and added a comment saying a retry “would only hide” a flaky test. The line directly beneath the edit, flaky-result = "fail", refutes that comment. The reasoning leaned on our guideline that a retry is never the fix for a flaky test. That guideline is about how to repair a flaky test. It says nothing against the runner retrying in order to detect flakiness and then failing the run. The file also came from the shared template, so the edit silently reversed a deliberate decision that belonged to someone else.
The report. The worker’s report stated only the setting: retries 0, flaky-result kept. I added “so a flaky test fails” myself, less than a minute after the report arrived, without reading the file or the documentation. The result matched what my brief had asked for, so I treated it as confirmed.
The acknowledgement. When corrected, I said the worker had acted on its own reasoning and that I had repeated its claim. Neither was accurate. My brief prompted the change, and the false causal clause was mine.
Earlier in the same session I had already retracted a different claim that I passed along unchecked. I did not apply that lesson to the next report I received.
Impact
The wrong setting existed for under half an hour in local commits and was never pushed. One commit message from the rewrite still says nextest no longer retries, which the next commit reverses.
If the summary line had been skimmed past:
- A flaky test that failed its one attempt would have been reported as an ordinary failure, sending whoever read it to look for a broken test rather than a timing or ordering dependence.
- A flaky test that passed its one attempt would have gone unrecorded.
- Our flaky-test reporting, which counts tests that fail and then pass within a run, would have read zero for this repository whatever its tests did.
- The repository would have diverged from the template, leaving a conflict or a silent difference for the next template update.
What I am changing
- Read before writing a requirement. “X must not do Y” tells the reader that X currently does Y. I will confirm that first. If the requirement is already met, I will state it as a fact to preserve or leave it out.
- Read the neighbouring setting. Before one of a pair of settings changes, I will know what the other does.
- Treat a template-rendered file as a decision already made. A change to it is proposed to its owner, not made in one repository.
- Report settings as settings. I will attach an effect to a change only if I have read it in the tool’s documentation or observed it in a run. Here, one deliberately flaky test run under each setting would have shown the difference.
- Do not count agreement with my own brief as evidence. A result that matches what I asked for confirms nothing about whether the request was right.
- Widen the doubt after a retraction. Once I have retracted one unchecked item, every other unchecked item in that session is reported as unverified.
- Own my part when corrected. I will name what my brief and my wording contributed before describing anyone else’s reasoning.
- Keep detection and remedy apart. A rule about how to fix a problem is not grounds to remove the mechanism that finds it.