Maximum Changes that don't Break the Build Let's say I have a set of changes, e.g. replacing foo with bar in a codebase, how do I programmatically discover the largest set of replacements that will not break my tests. let's assume that the call-sites are independent.

I can come up with a binary-search-like algorithm which would be worst case O(n) time. Proposed binary-search-like algorithm:

possible_changes = Set(Range(0, n - 1)) // all callsites
working_changes = Set()

while (possible_changes non empty) {
  for (range in possible_changes) {
    remove the range from possible_changes

    if (range causes failures) {
      if (range size == 1) {
        // forget the range
      } else {
        left, right = split the range
        if (range size == 2) {
          if (left does not cause failure) {
            add left to working_changes
            // forget right
          } else if (right does not cause failure) {
            add right to working changes
          }
        } else {
          add left to possible_changes
          add right to possible_changes
        }
      }
    } else {
      add range to working_changes
    }
  }
}


Is there a faster way, besides above to find all changes that would work?
The problem you're trying to solve is undecidable, since you can't tell if any of the changes makes the program go into an infinite loop.