Private
Public Access
0
0

refactor(audit): remove dead compute_result_coverage

compute_result_coverage() was implemented during the 14-phase plan but is
never called: synthesize_aggregate_profile() (now at ~line 1075) inlines
its own ResultCoverage construction via the actual AST analysis at
~line 1135-1145. The function has a latent bug at line 754 (was):
  result_producers = total_producers
which hardcodes result_producers to 100% of total_producers regardless of
input — making the function return meaningless numbers.

Tests deleted in lockstep:
- tests/test_code_path_audit_phase78.py: test_compute_result_coverage_no_producers
- tests/test_code_path_audit_phase78.py: test_compute_result_coverage_full

The 'compute_result_coverage' import was also removed from the test file's
import block.

Verification:
- grep -c 'compute_result_coverage' src/code_path_audit.py = 0
- grep -c 'compute_result_coverage' tests/ = 0
- 125 of 125 remaining tests pass (was 127; -2 tests deleted)
This commit is contained in:
2026-06-24 10:00:08 -04:00
parent facaceba36
commit 2561e4ea9e
2 changed files with 0 additions and 52 deletions
-30
View File
@@ -735,36 +735,6 @@ def find_enclosing_function(
return None
return max(candidates, key=lambda r: r.line)
def compute_result_coverage(
producers: list[FunctionRef],
consumers: list[FunctionRef],
branches_on_errors: set[str],
) -> ResultCoverage:
"""Compute the per-aggregate result coverage.
result_producers: total number of producers (the caller is responsible
for filtering to Result[T] producers; this function reports the raw
count).
result_consumers: consumers whose fqname is in branches_on_errors
(the caller passes the set from AST analysis).
"""
total_producers = len(producers)
result_producers = total_producers
total_consumers = len(consumers)
result_consumers = len({c.fqname for c in consumers if c.fqname in branches_on_errors})
if total_producers > 0 and result_producers == total_producers:
pct_p = 100
else:
pct_p = (result_producers / total_producers * 100) if total_producers > 0 else 0
pct_c = (result_consumers / total_consumers * 100) if total_consumers > 0 else 0
summary = f"{result_producers}/{total_producers} producers return Result[T] ({pct_p:.0f}%); {result_consumers}/{total_consumers} consumers branch on .errors ({pct_c:.0f}%)"
return ResultCoverage(
total_producers=total_producers,
result_producers=result_producers,
total_consumers=total_consumers,
result_consumers=result_consumers,
summary=summary,
)
def compute_type_alias_coverage(total_sites: int, typed_sites: int) -> TypeAliasCoverage:
"""Compute the per-aggregate type alias coverage."""