mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-16 03:49:26 +00:00
unseen-eval: calibrated replay deadline + native agreement check, docker-lane diagnostics, proof 4.4 record; engine runner cleans up fetched sources
gVisor replays exhausted the hook's 30 s deadline in the snapshot step on a 1,725-file repository; cluster replays now use 30 s x a measured slowdown factor, verified on a native sample. The engine runner deletes each pin's fetched source (1.8 GB had accumulated), caps the cache at 500 MB and refuses below 1.5 GB free. Proof 4.4: two engine pins via the generic dispatcher match the VM baseline exactly. Implemented with Codex. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
5dc86c2f3f
commit
6d27c9bfcf
@@ -199,12 +199,59 @@ def score(records, *, seed=0):
|
||||
return {
|
||||
**metrics(usable),
|
||||
"total": len(records),
|
||||
"deadlines": [
|
||||
{"lane": lane, "deadline_seconds": deadline, "deadline_scale": factor, "applied_deadline_scale": applied, "count": count}
|
||||
for (lane, deadline, factor, applied), count in sorted(
|
||||
Counter(
|
||||
(r.get("lane", "unknown"), r.get("deadline_seconds"), r.get("deadline_scale"), r.get("applied_deadline_scale"))
|
||||
for r in records
|
||||
).items(),
|
||||
key=lambda pair: str(pair[0]),
|
||||
)
|
||||
],
|
||||
"coverage": {state: counts[state] for state in STATES},
|
||||
"breakdowns": breakdown,
|
||||
"confirmed": metrics([r for r in usable if r.get("label_check", r.get("confirmed")) in ("confirmed", True)]),
|
||||
}
|
||||
|
||||
|
||||
def agreement(cluster, native):
|
||||
"""Missing, failed or wrong-lane records are unknown, never matching quiet pushes."""
|
||||
cc = {r["id"]: r for r in cluster}
|
||||
if len(cc) != len(cluster) or len({r["id"] for r in native}) != len(native):
|
||||
raise ValueError("duplicate agreement identities")
|
||||
pairs, unknown, disagreements = [], [], []
|
||||
for n in sorted(native, key=lambda r: r["id"]):
|
||||
c = cc.get(n["id"])
|
||||
if (
|
||||
c is None
|
||||
or c.get("lane") not in {"ax", "kind"}
|
||||
or n.get("lane") != "docker"
|
||||
or c.get("image") != n.get("image")
|
||||
or c.get("base_deadline_seconds") != n.get("base_deadline_seconds")
|
||||
or coverage(c) == "instrument_failure"
|
||||
or coverage(n) == "instrument_failure"
|
||||
):
|
||||
unknown.append(n["id"])
|
||||
continue
|
||||
cluster_flag, native_flag = false_alarm(c), false_alarm(n)
|
||||
same = cluster_flag == native_flag
|
||||
pairs.append({"change_id": n["id"], "cluster_flagged": cluster_flag, "native_flagged": native_flag, "same": same})
|
||||
if not same:
|
||||
disagreements.append(n["id"])
|
||||
report = rate([p["same"] for p in pairs])
|
||||
eligible = bool(pairs) and not unknown and report["wilson95"][0] >= 0.95
|
||||
return {
|
||||
**report,
|
||||
"requested": len(native),
|
||||
"pairs": pairs,
|
||||
"unknown": unknown,
|
||||
"disagreements": disagreements,
|
||||
"baseline_eligible": eligible,
|
||||
"flagged": not eligible,
|
||||
}
|
||||
|
||||
|
||||
def budgets(rows, *, thresholds=None, binary=False):
|
||||
ordinary = [r for r in rows if r["kind"] == "ordinary"]
|
||||
vulnerable = [r for r in rows if r["kind"] != "ordinary"]
|
||||
@@ -295,12 +342,20 @@ def main():
|
||||
parser.add_argument("records", type=Path, help="JSON array of joined change/instrument/push records")
|
||||
parser.add_argument("--out", type=Path, required=True)
|
||||
parser.add_argument("--against", type=Path, help="production-arm records for a paired adoption gate")
|
||||
parser.add_argument("--native", type=Path, help="native sample root; auto-detected under replay root")
|
||||
parser.add_argument("--slice-id")
|
||||
parser.add_argument("--informed", action="store_true")
|
||||
args = parser.parse_args()
|
||||
current = load_records(args.records)
|
||||
result = score(current)
|
||||
native = args.native or (args.records / "native" if args.records.is_dir() and (args.records / "native").exists() else None)
|
||||
if native:
|
||||
result["native_agreement"] = agreement(current, load_records(native))
|
||||
result["baseline_eligible"] = result["native_agreement"]["baseline_eligible"]
|
||||
result["flagged"] = result["native_agreement"]["flagged"]
|
||||
result["unseen"] = gate(load_records(args.against) if args.against else [], current, slice_id=args.slice_id, informed=args.informed)
|
||||
if native and result["flagged"]:
|
||||
result["unseen"] = {"gate": "not_run", "reason": "native_agreement"}
|
||||
args.out.write_text(json.dumps(result, sort_keys=True, indent=2) + "\n")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user