This is an automated email from the ASF dual-hosted git repository.

zyxxoo pushed a commit to branch refactor/rust-rewrite-design
in repository https://gitbox.apache.org/repos/asf/hugegraph.git


The following commit(s) were added to refs/heads/refactor/rust-rewrite-design 
by this push:
     new cc916b792 fix(oracle): classify malformed history input
cc916b792 is described below

commit cc916b792cb8c271acd9f98a0b7c8452480ca331
Author: vaughn <[email protected]>
AuthorDate: Sun Sep 13 15:24:19 2026 +0800

    fix(oracle): classify malformed history input
---
 tools/raft-linearizability/checker.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/raft-linearizability/checker.py 
b/tools/raft-linearizability/checker.py
index 2926b05af..033c6b594 100644
--- a/tools/raft-linearizability/checker.py
+++ b/tools/raft-linearizability/checker.py
@@ -39,8 +39,15 @@ def main():
     ap = argparse.ArgumentParser(description=__doc__)
     ap.add_argument("history", help="JSON file containing an array of 
operations")
     args = ap.parse_args()
-    with open(args.history, encoding="utf-8") as f:
-        ok, detail = check(json.load(f))
+    try:
+        with open(args.history, encoding="utf-8") as f:
+            payload = json.load(f)
+        if not isinstance(payload, list):
+            raise ValueError("history must be a JSON array")
+        ok, detail = check(payload)
+    except (OSError, ValueError, TypeError, KeyError, json.JSONDecodeError) as 
exc:
+        print(json.dumps({"linearizable": False, "detail": f"invalid history: 
{exc}"}))
+        return 2
     print(json.dumps({"linearizable": ok, "detail": detail}))
     return 0 if ok else 1
 

Reply via email to