Bisect the history
Why it matters "It worked last month" is valuable information. If you can test any old version, the change that broke things can be found in a handful of checks, before anyone reads a line of the diff.
A deploy history holds 64 versions, oldest first. Version 0 worked; version 63, the current one, is broken. Somewhere a single change broke it, and every version after that is broken too. Checking a version means building it and running a ten-minute test suite.
Checking each version in turn costs up to 62 checks: most of a day. Checking the middle version halves the suspects each time. This is what git bisect does for you.
is_bad(31) # True: the break is at 31 or earlier
is_bad(15) # False: it is after 15Write find_first_bad(n, is_bad). Versions are numbered 0 to n-1; version 0 is known good and version n-1 is known bad (n is at least 2); once a version is bad, every later one is bad. is_bad(v) checks one version. Return the first bad version. Budget: at most 6 checks for 64 versions, and at most 10 checks for 1,000 versions.
Spotted a problem in this lesson? Report it · Ask about this lesson
This exercise opens soon
Finish the lesson before it and this one unlocks. The whole course is free, no account needed, and you can read this lesson right now.
This browser is blocking cookies for learn.floati.life, so lessons you finished here cannot open in order. Allow cookies for this site and reload.