[llvm-branch-commits] [CI] Make premerge advisor exit with code 0 if failures are explained (PR #172394)

David Spickett via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Dec 16 02:35:08 PST 2025


================
@@ -158,6 +158,16 @@ def get_failures(junit_objects) -> dict[str, list[tuple[str, str]]]:
     return failures
 
 
+def are_all_failures_explained(
+    failures: list[tuple[str, str]], failure_explanations: dict[str, FailureExplanation]
+) -> bool:
+    for failure in failures:
+        failed_action, _ = failure
+        if failed_action not in failure_explanations:
+            return False
+    return True
----------------
DavidSpickett wrote:

I see that the type of an explanation is:
```
class FailureExplanation(TypedDict):
    name: str
    explained: bool
    reason: Optional[str]
```
So I'd have expect to see checks that:
* the failure is a key in `failure_explanations` (which you've done)
* the key `explained` is set to true
* the `reason` key is set to some non-empty string (though I'm not sure what explained True and empty reason means, maybe this is fine)

If I haven't misinterpreted the type here, maybe you don't ever expect to be given FailureExplanation where explained is false?

If so I think here is a good opportunity to enforce that with an extra check that explained is true.

https://github.com/llvm/llvm-project/pull/172394


More information about the llvm-branch-commits mailing list