Is a Failing Nightly Regression Test a Real Bug or a Flake

Last updated: November 29, 2026

Quick Overview

A nightly test catches a real regression 95% of the time and fails spuriously 5% of the time on correct code; about 2% of submissions introduce a regression. Given a failure, how likely is a real bug, and how does a rerun that fails again or passes change that?

MathWorks
Statistics & Math
Software Engineer
MathWorks
November 29, 2026
Software Engineer
Phone Screen
Statistics & Math
Easy

0

0

0 solved


A nightly test catches a real regression 95% of the time and fails spuriously 5% of the time on correct code; about 2% of submissions introduce a regression. Given a failure, how likely is a real bug, and how does a rerun that fails again or passes change that?

MathWorks runs very large nightly test suites across MATLAB and Simulink, and engineers constantly triage failures as real or flaky. This question checks Bayes' rule with a low base rate and sequential updating, framed in a way the interviewer actually deals with.

What the Interviewer Expects
  • Writes Bayes' rule with prior, likelihood and evidence explicitly
  • Notices the low base rate makes a single failure only weak evidence
  • Updates correctly for a second independent run
  • States the independence assumption and when it fails
  • Turns the numbers into a triage policy
Key Topics to Cover
Bayes' rule
base rates
sequential updating
conditional independence
test triage
How to Approach This
  1. Define your hypotheses (H0 and H1) clearly before performing any test.
  2. Calculate required sample size BEFORE running an experiment, using power analysis.
  3. Remember the Central Limit Theorem: sample means become approximately normal with large n.
  4. Watch for Simpson's paradox. Always segment data by key dimensions.
  5. Distinguish between statistical significance and practical significance.
Possible Follow-up Questions
  • Flakes are often correlated with the machine or time of day. How does correlation between reruns change the conclusion?
  • How would you estimate the flake rate per test from historical pass and fail data?
  • If reruns cost 20 minutes of lab time, how many reruns would you schedule before paging the submitter?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Browse Statistics Questions
Sample Answer
Clarify

Let BB be 'the change introduced a regression'. Given P(B)=0.02P(B) = 0.02, P(F∣B)=0.95P(F \mid B) = 0.95, P(F∣¬B)=0.05P(F \mid \neg B) = 0.05. Assume reruns are independent given the true state of the code, and a real regres...

Approach

Apply Bayes' rule once for the first failure, then again treating the posterior as the new prior (or multiply likelihoods for both runs at once)....


Submit Your Answer
Markdown supported

Related Questions