Skip to content

Commit 8b2bd86

Browse files
fix: completeness now accounts for missed files
Previously, completeness was calculated only across matched files (files both the tool and human touched), ignoring missed files entirely. This gave inflated scores -- e.g., 97.2% when only 4 out of 31 Go files were matched. Now, every missed Go file in the ground truth contributes a 0% score to the average. If the tool matches 4 files at 97% but misses 10 files, completeness = (4*97% + 10*0%) / 14 = 27.7%, not 97%. This gives an honest picture of how much of the total implementation the tool actually covered. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent a86c8b6 commit 8b2bd86

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

benchmark/compare.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,12 +403,13 @@ def compare_iteration(
403403
),
404404
))
405405

406+
missed_go_files = go_truth_files - go_gen_files
407+
for _missed in missed_go_files:
408+
completeness_scores.append(0.0)
409+
406410
completeness = statistics.mean(completeness_scores) * 100 if completeness_scores else 0.0
407411
convention = statistics.mean(convention_scores) * 100 if convention_scores else 0.0
408412

409-
if not matched_files and go_truth_files:
410-
completeness = 0.0
411-
412413
score = IterationScore(
413414
iteration=gen_result.iteration,
414415
completeness=round(completeness, 1),

benchmark/report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def generate_ep_report(
6363
lines.append("")
6464
lines.append("**Metric definitions:**")
6565
lines.append("")
66-
lines.append("- **Completeness**: What % of the human's structs, fields, and functions did the tool also generate? Higher = tool covered more of the ground truth.")
66+
lines.append("- **Completeness**: What % of the human's Go implementation did the tool cover? Accounts for ALL Go files in the ground truth -- matched files are scored by struct/field/function overlap, missed files count as 0%.")
6767
lines.append("- **Convention**: What % of kubebuilder markers (`+kubebuilder:validation:Required`, `+optional`, etc.) match between generated and ground truth?")
6868
lines.append("- **Build**: Did `make build` pass on the generated code?")
6969
lines.append("- **Matched**: Files the tool generated that also exist in the human implementation (true positives).")

0 commit comments

Comments
 (0)