Exit Zero Is Not Evidence: The Control Sample Clinical Labs Put Through Every Run
TL;DR: Most software batch jobs rely on exit codes as their only acceptance criteria, which confirms the process finished but not that the work was done correctly. Clinical laboratories solve this by running a "control sample"—a known-answer record—through the real process every single run. By adopting this discipline and its published false-alarm mathematics, engineering teams can detect silent data corruption and drift without drowning in noisy alerts.
In a recent account shared on r/devops, an engineer described a hardening script designed to secure a load balancer. The script executed, created an HTTPS listener with a 403 default action that left the application unreachable, printed a warning to a log no one was watching, and promptly exited 0. The automation platform saw the success code and moved on; the application, however, was dead.
This is not an isolated incident. As noted by practitioners on LinkedIn, the batch layer often suffers from "second-class engineering," where jobs that succeed technically fail to perform their actual work. Whether it is background jobs that repeat unnoticed while inventory moves, as discussed on X, or uptime checks that pass while the checkout flow is broken, the problem is identical: every one of those runs passed the only acceptance test it had.
What acceptance means when the process cannot be trusted to report on itself
In software operations, we have conflated "process completion" with "work validity." An exit status, a 200 OK response, or a completed DAG node are statements about the process. They confirm that the interpreter didn't crash and the memory wasn't exhausted. They do not, however, confirm that the data was transformed correctly, that a column wasn't silently truncated, or that a "successful" run didn't write exactly zero rows because its input was empty.
Where the work has a known correct answer, the process itself is not the reliable entity to ask for a status update. To ensure the integrity of the output, we must look at the work itself.
How a clinical laboratory decides a run is acceptable
Clinical laboratories operate under a higher stakes version of this same problem. If a blood analyzer reports a glucose level, the lab cannot simply trust the machine because it didn't display an "Error" light. According to the foundational 1981 Clinical Chemistry paper by Westgard et al., laboratories use a rigorous procedure known as "Internal Quality Control."
Instead of trusting the instrument's self-reporting, labs insert "control materials"—substances with known values—into the same analytical run as patient samples. These controls go through the exact same physical and chemical process. The run is accepted or rejected based on whether the results for these controls fall within specific limits, derived from the method's own observed standard deviation. The instrument's exit status is irrelevant if the control sample comes back wrong.
The false-alarm mathematics engineers need
The immediate objection most engineers have to adding checks is the "noise" factor. We have all experienced the threshold alert that fires every Sunday because of low traffic, leading to it being muted and eventually ignored.
The clinical field has already quantified this trade-off. According to Westgard QC, a single "1_2s" rule (rejecting a run when one control exceeds two standard deviations from the mean) is notoriously noisy. It falsely rejects roughly 9 percent of good runs when N=2, 14 percent at N=3, and nearly 18 percent at N=4. Tightening the limit to 3 standard deviations (1_3s) reduces false rejections to about 1 percent, but at the cost of missing medically significant errors.
The resolution in clinical chemistry is not a "better" single threshold, but a "multirule" approach:
- Serial Testing: A 1_2s rule is used only as a warning to trigger inspection by more specific rules.
- Parallel Testing: A combination of individually low-false-rejection rules is applied. If any fire, the run is rejected.
The five classic "Westgard Rules" include:
- 1_3s: Sensitive to random error and large systematic error.
- 2_2s: Rejects when two consecutive controls exceed the same 2s limit (systematic error).
- R_4s: Rejects when the range between controls in a run exceeds 4s (random error).
- 4_1s: Rejects when four consecutive controls exceed the same 1s limit (detects slow drift).
- 10x: Rejects when ten consecutive controls fall on the same side of the mean (detects subtle systematic shift).
Key Takeaway: Engineering teams should stop guessing at thresholds and instead design for an explicit target of 0.90 error detection and a false-rejection budget of 0.05 or less.
What transfers, stated narrowly
We must be careful not to over-apply the analogy. Most software batch outputs are not stable, continuous distributions like a chemical analyte.
What Transfers:
- The Control Record: Push a known-answer record through the real path of the job every run.
- Multirule Logic: Use more than one rule to evaluate the control, including rules that look back across previous runs to find systematic drift.
- Design Budgets: Set an explicit false-alarm budget before writing the first line of monitoring code.
What Does Not Transfer:
- Sigma Constants: The "2s" and "3s" limits assume a normal distribution that your database writes likely don't follow. Use percentiles or fixed invariants instead.
- Stop-the-Line Necessity: In a lab, a rejection is expensive. In software, we have the luxury of automated retries or diverted dead-letter queues.
Designing a control record for a real job
To implement this, you must construct a synthetic record that traverses the same code path as real work without polluting your production metrics.
| Failure Class | Control Property Checked | Rule Shape |
|---|---|---|
| Partial Write | Exact value check of control record | 1_3s (Individual run) |
| Duplicate Write | Unique constraint/count on control ID | 1_3s (Individual run) |
| Silent Truncation | String length/Checksum of control field | 1_3s (Individual run) |
| Empty Input | Presence of control in output | 1_3s (Individual run) |
| Stale Input/Drift | Latency timestamp on control record | 4_1s (Across 4 runs) |
For a job processing user billing, your "control" might be a specific test user ID. You know that for this ID, the job should always calculate exactly $10.00. If the output shows $0.00 or $10.000000001, the run is rejected, even if the database returned a successful commit.
Where this approach fails
There are environments where injecting synthetic data is unsafe or prohibited by audit requirements, such as core banking ledgers. In these cases, the honest answer is post-hoc reconciliation or read-path controls rather than in-process synthetic records. Furthermore, if the control records are not updated alongside schema changes, the QC process itself becomes a source of false negatives—a failure mode the lab literature calls "running the wrong QC."
Why this matters now
Operations teams are currently drowning in "symptom" alerts—notifying them that a system is down after the damage is done. By shifting the focus to acceptance criteria—deciding a run is good before it is promoted—we move from reactive firefighting to proactive quality assurance.
A control record that fails tells you a run is bad, but it rarely tells you why. The root cause could be a malformed input, a hidden schema change, an optimized query plan gone wrong, or underlying infrastructure instability. This gap between identifying a rejected run and finding the evidence for a fix is the specific problem we built Operate to solve. By watching production across the entire stack, Operate finds the evidence and drafts the PR, turning a failed control into a resolved incident.
The numbers to put on the wall
To start, a team only needs two numbers:
- The percentage of runs the controls would have rejected (Sensitivity).
- The percentage of good runs the controls actually rejected (False Rejection Rate).
Everything else—the multirules, the synthetic records, and the drift detection—is simply a means to make those two numbers acceptable.
Sources & further reading
- According to Westgard QC, the 1_2s rule produces a 9% false rejection rate at N=2, making it too noisy for most professional environments.
- As detailed in Westgard JO, Barry PL, et al. (1981), multirule procedures allow for high error detection with a controlled false-alarm budget.
- Practitioner experiences from r/devops and LinkedIn confirm that technical success (Exit 0) is frequently decoupled from business logic success.