Private
Public Access
0
0

feat(audit): wire cross_audit_findings aggregator into synthesize

Loops over audit_weak_types + audit_exception_handling from
the 6 audit_inputs, calls aggregate_cross_audit_findings per
audit, sums the buckets per profile.

Cross-audit aggregation is per-aggregate-flat (all findings go
into 1 bucket per audit). The 3-tier finding-to-aggregate
mapping (find_enclosing_function + type registry + file
heuristic) is the next gap - requires per-finding site
classification.
This commit is contained in:
2026-06-22 09:14:40 -04:00
parent 85f5808ae3
commit 8d2dffd7c5
7 changed files with 263 additions and 244 deletions
+20 -1
View File
@@ -1082,6 +1082,25 @@ def synthesize_aggregate_profile(
consumers, aggregate, type_registry, "src"
)
tac = compute_real_type_alias_coverage(aggregate, producers, consumers, type_registry, "src")
cross_findings = CrossAuditFindings((), (), (), (), ())
for audit_name in ("audit_weak_types", "audit_exception_handling"):
if audit_name in audit_inputs:
findings = audit_inputs[audit_name].get("findings", [])
example_file = findings[0].get("file", "") if findings else ""
example_line = findings[0].get("line", 0) if findings else 0
matched = aggregate_cross_audit_findings(
audit_name=audit_name,
findings=findings,
example_file=example_file,
example_line=example_line,
)
cross_findings = CrossAuditFindings(
weak_types=cross_findings.weak_types + matched.weak_types,
exception_handling=cross_findings.exception_handling + matched.exception_handling,
optional_in_baseline=cross_findings.optional_in_baseline + matched.optional_in_baseline,
config_io_ownership=cross_findings.config_io_ownership + matched.config_io_ownership,
import_graph=cross_findings.import_graph + matched.import_graph,
)
producer_count = len({f.fqname for f in producers})
consumer_count = len({f.fqname for f in consumers})
branches_on_errors = set()
@@ -1112,7 +1131,7 @@ def synthesize_aggregate_profile(
frequency_evidence=freq_evidence,
result_coverage=rc,
type_alias_coverage=tac,
cross_audit_findings=CrossAuditFindings((), (), (), (), ()),
cross_audit_findings=cross_findings,
decomposition_cost=dc,
optimization_candidates=candidates,
is_candidate=False,