Bisect Nightly iOS Builds to Find a Regression Despite Flaky Tests

Last updated: November 29, 2026

Quick Overview

Given an ordered list of nightly builds where the oldest passes and the newest fails a UI test that is also intermittently flaky, find the first build that introduced the real failure with as few test runs as possible.

Apple
Software Engineering Fundamentals
Software Engineer
Apple
November 29, 2026
Software Engineer
Technical Screen
Software Engineering Fundamentals
Medium

0

0

0 solved


Given an ordered list of nightly builds where the oldest passes and the newest fails a UI test that is also intermittently flaky, find the first build that introduced the real failure with as few test runs as possible.

Apple's release engineering runs huge automated suites against daily iOS builds, and flaky tests make naive bisection blame the wrong change. The interviewer tests binary search invariants plus statistical thinking about noisy signals.

What the Interviewer Expects
  • Keeps the invariant lo is good and hi is bad and searches between them
  • Turns a noisy test into a reliable predicate with repeated runs and a clear rule
  • Explains the asymmetry: a real regression always fails, flakiness only sometimes fails
  • Caches results so no build is tested twice
  • Quantifies the error probability and cost in total runs
Key Topics to Cover
binary search
flaky tests
debugging
probability
regression triage
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • What if the regression itself is intermittent (fails 50% of the time)?
  • How would you pick runs_per_probe to keep the misclassification rate under 1%?
  • How would you bisect across commits inside a nightly once you find the bad build?
  • How would you detect that the test is flaky in the first place and quarantine it?
Sharpen Your Skills on Codemia

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

Practice System Design Problems
Sample Answer
Requirements
  • Builds are ordered; first is known good, last is known bad.
  • run_test(build) returns pass or fail and costs minutes, so minimize calls.
  • Assumption to confirm: the regression fails deterministic...
High-Level Design

Under that assumption any single pass proves a build is good. So probe a build up to k times and call it bad only if all k runs fail. A good build is misclassified with probability pkp^k; with p = 0.3...


Submit Your Answer
Markdown supported