KatInterview

Taming Flaky Regressions and Sharpening Failure Classification

System DesignModel answer
MediumModel answerSystem DesignQAregression testingtest reliability

Last updated

Design an acceptance strategy for non-deterministic test output, then build a classification scheme that goes beyond pass/fail to drive precise triage.

Context

You are a QA engineer responsible for a regression suite that runs nightly against a complex software system. Some components — rendering pipelines, numerical solvers, ML inference paths — produce outputs that legitimately vary run to run even when the software is working correctly. Your current setup flags any deviation from a golden reference as a failure, drowning the team in noise and eroding trust in the suite.

Your tech lead has asked you to fix two things before the next release cycle.


Part 1 — Handle Valid Output Variation Without Hiding Real Bugs

Some test failures are not bugs: floating-point results shift across hardware, image encoders produce slightly different file sizes, timing metrics fluctuate under load. A naive golden-file comparison rejects all of it.

Describe a principled approach to accepting a range of valid outputs while keeping the suite sensitive to genuine regressions.

Your answer should address:

  • How you define and document an acceptance rule (tolerance band, set of allowed values, statistical threshold, etc.) so that it is traceable to a specification or measured baseline rather than chosen arbitrarily.
  • How you distinguish a real product defect from a test environment problem, a flaky dependency, or measurement noise — and what evidence you collect to tell them apart.
  • How changes to the acceptance oracle are reviewed and controlled so that someone cannot quietly widen a tolerance to make a failing test green.

Part 2 — Replace Pass/Fail With a Structured Outcome Model

A binary pass/fail label loses information. A crash in a core subsystem and a cosmetic rendering glitch on an unsupported peripheral both show up as "FAIL," yet they demand completely different responses.

Design a classification scheme for observed test outcomes that supports faster, more accurate triage.

Your answer should address:

  • The dimensions you would record for each failure: what happened, why you think it happened, how severe the impact is, and how confident you are in that diagnosis.
  • How product impact (who is affected, under what conditions) and reproducibility (consistent, intermittent, environment-specific) feed into prioritization.
  • What you do with failures that resist diagnosis — how you avoid prematurely marking them as benign while still keeping the queue manageable.

What a Strong Answer Looks Like

  • A concrete acceptance-rule design that reduces noise without simply relaxing assertions or retrying until green.
  • Explicit separation of test category (what the test is for) from outcome classification (what actually happened).
  • A triage path with traceable decisions, clear ownership, and no silent suppression of unresolved issues.

Hints

Hint 1

For Part 1, ask yourself: what is the source of truth for 'valid'? A tolerance pulled from thin air is just as dangerous as no tolerance at all — anchor it to a spec, a physics constraint, or a statistically derived baseline from known-good runs.

Hint 2

For the oracle change-control problem, think about how production code changes are governed: code review, approval gates, audit logs. Apply the same discipline to your acceptance criteria.

Hint 3

For Part 2, think in separate columns: outcome (what the test reported), suspected cause (product bug vs. environment vs. test), severity (blast radius for a real user), and confidence (how sure are you of the cause). A crash with 100% reproduction rate and a timing flap that appears 5% of the time need completely different queues.