from itertools import product


def probes(started, ready, failures):
    if not started:
        return {"route": False, "restart": False,
                "outcome": "Startup gate"}
    restart = failures >= 3  # Chosen toy threshold, not a universal default.
    return {"route": ready and not restart, "restart": restart,
            "outcome": "Restart decision" if restart else
                       "Ready for traffic" if ready else "Not ready"}


# Verification: independent controls and startup gating.
assert probes(False, True, 4)["outcome"] == "Startup gate"
assert probes(True, False, 0) == {
    "route": False, "restart": False, "outcome": "Not ready"}
assert probes(True, True, 3)["restart"] is True
fixtures = []
for started, ready, failures in product((True, False), (True, False), range(5)):
    fixtures.append({"inputs": {"started": "yes" if started else "no",
                                "ready": "yes" if ready else "no",
                                "failures": str(failures)},
                     "expected": probes(started, ready, failures)})

import json
print(json.dumps({"fixtures": fixtures, "checks_passed": True}))
