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 27c01196ab)
This commit is contained in:
Deepjyoti-Sarmah authored and safishamsi committed 2026-11-09 16:46:28 +00:00
1 parent 7058cbd612
commit acae154d4c
3 files changed
+8 -8

No files matched your search

+5 -5
View File
@@ -6897,7 +6897,7 @@ def _resolve_csharp_extension_calls(
third-party type) cannot have its instance members enumerated, so the third-party type) cannot have its instance members enumerated, so the
instance-wins rule is replaced by two conservative proofs: the member name instance-wins rule is replaced by two conservative proofs: the member name
is not one a BCL type owns (``ToString``, ``GetValue``, …), and no regular 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. one tier below a receiver whose declaration table typed it.
A chained receiver (``v.ToString().Mask()``) has no type at all: typing 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", "context": "call",
"confidence": "INFERRED", "confidence": "INFERRED",
# 0.85 when the extractor's declaration table typed the receiver; # 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 # 0.75 when the receiver's type is out of corpus (or absent) and
# rests on the BCL/regular-name guards (the discrete rubric has # the binding rests on the BCL/regular-name guards — the discrete
# no 0.75, see references/extraction-spec.md). # INFERRED rubric in references/extraction-spec.md.
"confidence_score": 0.70 if roc else 0.85, "confidence_score": 0.75 if roc else 0.85,
"source_file": src_file, "source_file": src_file,
"source_location": rc.get("source_location"), "source_location": rc.get("source_location"),
"weight": 1.0, "weight": 1.0,
+1 -1
View File
@@ -855,7 +855,7 @@ def apply_strategy(
if (caller, cand.method_id) in existing: if (caller, cand.method_id) in existing:
continue continue
existing.add((caller, cand.method_id)) 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)) added.append(_edge(caller, cand, rc, score))
return added return added
+2 -2
View File
@@ -124,8 +124,8 @@ def test_out_of_corpus_extension_edge_is_scored_lower():
if e.get("relation") == "calls" if e.get("relation") == "calls"
and by_id.get(e["target"], {}).get("metadata", {}).get("extension") and by_id.get(e["target"], {}).get("metadata", {}).get("extension")
} }
assert scores[".Mask()"] == 0.70 assert scores[".Mask()"] == 0.75
assert scores[".Twice()"] == 0.70 assert scores[".Twice()"] == 0.75
def test_bcl_member_name_on_an_undeclared_type_is_not_bound(): def test_bcl_member_name_on_an_undeclared_type_is_not_bound():