From 35cb578ce2d223c12c9cf4469536552acf3d6dbd Mon Sep 17 00:00:00 2001 From: Marius Ciepluch <11855163+norandom@users.noreply.github.com> Date: Fri, 11 Sep 2026 11:47:41 +0200 Subject: [PATCH] bench(ranking): a baseline records the head of the evidence order, region by region So it says what sits ahead of a pinned CVE -- tier, score, site -- and not only how much of it; the within-tier ties are the next thing to read. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01T7XD7x5KonMdmGRkp63EQG --- benchmarks/ranking/position.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/benchmarks/ranking/position.py b/benchmarks/ranking/position.py index 243bfb0..4e2cd8d 100644 --- a/benchmarks/ranking/position.py +++ b/benchmarks/ranking/position.py @@ -28,6 +28,8 @@ from openultrasast.model.shipped import declared_sources # noqa: E402 from openultrasast.preprocess import preprocess_repository # noqa: E402 from openultrasast.repos import checkout_path, load_repo_recipes # noqa: E402 +HEAD = 150 # how much of the evidence order a baseline records, region by region + def ordered_regions(root: Path) -> list[ScanRegion]: """The regions in the order `scan_repository` examines them. One definition, imported, never copied.""" @@ -62,14 +64,30 @@ def evidence_ordered_regions(root: Path, regions: list[ScanRegion], language: st if callable(getattr(cpg, "cleanup", None)): cpg.cleanup() tiers = Counter(e.tier for e in evidence.values()) + ordered = order_by_evidence(regions, evidence) + best: dict[tuple[str, str], tuple[int, float]] = {} + for (path, function, _family), vector in evidence.items(): + best[(path, function)] = max(best.get((path, function), (-1, 0.0)), vector.order_key) facts = { + # The head of the order, with each region's (tier, score), so a baseline says WHAT sits ahead of a + # pinned CVE and not only how much of it -- the within-tier ties are the next thing to read. + "head": [ + { + "position": i, + "tier": best.get((r.path, r.function or ""), (-1, 0.0))[0], + "score": best.get((r.path, r.function or ""), (-1, 0.0))[1], + "site": f"{r.path}:{r.function or ''}", + "rank": r.rank, + } + for i, r in enumerate(ordered[:HEAD]) + ], "build_seconds": build_seconds, "evidence_seconds": evidence_seconds, "pairs": len(evidence), "pairs_unanswered": failed, "tier_counts": {str(k): v for k, v in sorted(tiers.items())}, } - return order_by_evidence(regions, evidence), facts + return ordered, facts def measure(name: str, root: Path, known: list[dict[str, object]], *, by_evidence: bool = False, language: str = "") -> dict[str, object]: