@@ -268,15 +268,15 @@ def evaluate_instance(inst: dict, budget: int = 8000) -> dict | None:
268268 if frag_count == 0 :
269269 diagnostics .append ("WARN: diffctx returned 0 fragments" )
270270
271- if lo_all ["line_recall" ] == 0.0 and frag_count > 0 :
271+ if lo_all ["line_recall" ] < 1e-9 and frag_count > 0 :
272272 diagnostics .append ("DIAG: line_recall=0 with fragments>0 — possible line parse bug or no file overlap" )
273273
274- if file_recall == 0.0 and frag_count > 0 :
274+ if file_recall < 1e-9 and frag_count > 0 :
275275 diagnostics .append ("DIAG: file_recall=0 with fragments>0 — selected files don't overlap gold at all" )
276276 diagnostics .append (f" gold_files: { sorted (gf )[:5 ]} " )
277277 diagnostics .append (f" selected: { sorted (sel_files )[:5 ]} " )
278278
279- if nontrivial_recall == 0.0 and frag_count > 5 :
279+ if nontrivial_recall < 1e-9 and frag_count > 5 :
280280 diagnostics .append ("DIAG: nontrivial_recall=0 — diffctx may only be selecting patch-adjacent files" )
281281
282282 unparsed = sum (1 for f in output .get ("fragments" , []) if parse_lines_field (f .get ("lines" , "" )) is None )
@@ -335,7 +335,7 @@ def aggregate(results: list[dict]) -> None:
335335 print (f" { repo :30s} (n={ len (rr ):3d} ): nontrivial_recall={ avg_ntr :.3f} " )
336336
337337 zero_frag = sum (1 for r in ok if r ["fragments" ] == 0 )
338- zero_line = sum (1 for r in ok if r ["line_recall" ] == 0.0 and r ["fragments" ] > 0 )
338+ zero_line = sum (1 for r in ok if r ["line_recall" ] < 1e-9 and r ["fragments" ] > 0 )
339339
340340 print ("\n Diagnostic summary:" )
341341 print (f" Instances with 0 fragments: { zero_frag } /{ len (ok )} " )
@@ -380,8 +380,8 @@ def main():
380380 print (f"Nontrivial instances: { len (instances )} " )
381381
382382 if not args .no_shuffle :
383- random .seed (args .seed )
384- random .shuffle (instances )
383+ rng = random .Random (args .seed ) # NOSONAR — deterministic shuffle for benchmark reproducibility, not crypto
384+ rng .shuffle (instances )
385385 print (f"Shuffled with seed={ args .seed } " )
386386
387387 instances = instances [: args .limit ]
0 commit comments