feat(audit): SSDL analysis - effective codepaths + nil-sentinel + organization verdict
- src/code_path_audit_ssdl.py: 9 functions translating per-aggregate findings into SSDL primitives (compute_effective_codepaths, count_branches_in_function, detect_nil_check_pattern, compute_field_access_efficiency, suggest_defusing_technique, render_ssdl_sketch/rollup, render_organization_deductions). - src/code_path_audit.py:render_rollups() now emits ssdl_analysis.md + organization_deductions.md alongside the existing 8 rollups. - src/code_path_audit_render.py:render_full_markdown() adds SSDL sketch section per profile (effective codepaths + defusing recommendations). Real findings (Metadata aggregate): - 35 consumers, 251 total branches, 1.13e18 effective codepaths - 6 nil-check functions (candidates for [N] sentinel) - 130 field-access sites, 0% typed (candidates for immediate-mode cache) - Verdict: needs restructuring Audit output grew 2136 -> 2415 lines. All 131 tests pass. Meta-audit clean (0 violations).
This commit is contained in:
@@ -10,6 +10,7 @@ from src.code_path_audit import (
|
||||
AggregateProfile,
|
||||
FunctionRef,
|
||||
)
|
||||
from src.code_path_audit_ssdl import render_ssdl_sketch
|
||||
|
||||
|
||||
def render_full_markdown(profile: AggregateProfile) -> str:
|
||||
@@ -130,6 +131,9 @@ def render_full_markdown(profile: AggregateProfile) -> str:
|
||||
pct = count / len(profile.access_pattern_evidence) * 100
|
||||
lines.append(f"- `{pat}`: {count} functions ({pct:.0f}%)")
|
||||
lines.append("")
|
||||
# SSDL Sketch (between Access pattern and Frequency)
|
||||
lines.append(render_ssdl_sketch(profile, "src"))
|
||||
lines.append("")
|
||||
# Frequency
|
||||
lines.append("## Frequency")
|
||||
lines.append("")
|
||||
|
||||
Reference in New Issue
Block a user