From acae154d4c79026fc0730dd0b91901c109b98d93 Mon Sep 17 00:00:00 2001 From: Deepjyoti-Sarmah Date: Thu, 29 Oct 2026 02:24:06 +0530 Subject: [PATCH] fix(csharp): use the 0.75 discrete tier for guarded extension edges (#4828) The INFERRED rubric is {0.55, 0.65, 0.75, 0.85, 0.95}; the guarded rungs were emitting 0.70, which test_inferred_confidence_rubric rejects (and which the rubric has no tier for). 0.75 is the intended one-step-below-0.85 score. (cherry picked from commit 27c01196ab74bc7333802a097044fbdaa8b65f7d) --- graphify/extract.py | 10 +++++----- tests/csharp_extension_harness.py | 2 +- tests/test_csharp_extension_resolution.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/graphify/extract.py b/graphify/extract.py index c00f06fe7..f98cf010c 100644 --- a/graphify/extract.py +++ b/graphify/extract.py @@ -6897,7 +6897,7 @@ def _resolve_csharp_extension_calls( third-party type) cannot have its instance members enumerated, so the instance-wins rule is replaced by two conservative proofs: the member name is not one a BCL type owns (``ToString``, ``GetValue``, …), and no regular - method anywhere in the corpus has that name. Such an edge is INFERRED 0.70, + method anywhere in the corpus has that name. Such an edge is INFERRED 0.75, one tier below a receiver whose declaration table typed it. A chained receiver (``v.ToString().Mask()``) has no type at all: typing it @@ -7141,10 +7141,10 @@ def _resolve_csharp_extension_calls( "context": "call", "confidence": "INFERRED", # 0.85 when the extractor's declaration table typed the receiver; - # 0.70 when the receiver's type is out of corpus and the binding - # rests on the BCL/regular-name guards (the discrete rubric has - # no 0.75, see references/extraction-spec.md). - "confidence_score": 0.70 if roc else 0.85, + # 0.75 when the receiver's type is out of corpus (or absent) and + # the binding rests on the BCL/regular-name guards — the discrete + # INFERRED rubric in references/extraction-spec.md. + "confidence_score": 0.75 if roc else 0.85, "source_file": src_file, "source_location": rc.get("source_location"), "weight": 1.0, diff --git a/tests/csharp_extension_harness.py b/tests/csharp_extension_harness.py index cf7d0fd92..628f9b3a2 100644 --- a/tests/csharp_extension_harness.py +++ b/tests/csharp_extension_harness.py @@ -855,7 +855,7 @@ def apply_strategy( if (caller, cand.method_id) in existing: continue existing.add((caller, cand.method_id)) - score = 0.85 if not (roc or recv_type is None) else 0.70 + score = 0.85 if not (roc or recv_type is None) else 0.75 added.append(_edge(caller, cand, rc, score)) return added diff --git a/tests/test_csharp_extension_resolution.py b/tests/test_csharp_extension_resolution.py index 2af791aa2..7436955a9 100644 --- a/tests/test_csharp_extension_resolution.py +++ b/tests/test_csharp_extension_resolution.py @@ -124,8 +124,8 @@ def test_out_of_corpus_extension_edge_is_scored_lower(): if e.get("relation") == "calls" and by_id.get(e["target"], {}).get("metadata", {}).get("extension") } - assert scores[".Mask()"] == 0.70 - assert scores[".Twice()"] == 0.70 + assert scores[".Mask()"] == 0.75 + assert scores[".Twice()"] == 0.75 def test_bcl_member_name_on_an_undeclared_type_is_not_bound():