nextSourceAfter function
The source after failed; null when exhausted or off-chain, so a hand-picked pipeline keeps its own error.
Implementation
String? nextSourceAfter(String failed, List<String> candidates) {
final int index = candidates.indexOf(failed);
if (index == -1 || index + 1 >= candidates.length) return null;
return candidates[index + 1];
}