Private
Public Access
0
0

feat(audit): enriched markdown renderer - 15 sections per profile + 2 new rollups

render_full_markdown in src/code_path_audit_render.py produces
detailed per-profile markdown:
- Producers detail (grouped by file)
- Consumers detail (grouped by file)
- Field access matrix (every field x every consumer)
- Access pattern (dominant + per-function distribution)
- Frequency (aggregate + per-function)
- Result coverage table
- Type alias coverage table (typed vs untyped sites)
- Cross-audit findings (per-bucket tables)
- Decomposition cost (8 metrics)
- Struct shape inference (inferred from producer returns)
- Optimization candidates (concrete refactor steps + affected files)
- Verdict
- Evidence appendix (every per-function item)

New rollups:
- field_usage.md: cross-aggregate field access frequency
- call_graph.md: producer/consumer tables grouped by aggregate

Total report: 1814 lines (was 1204).
This commit is contained in:
2026-06-22 10:12:48 -04:00
parent 5405345c5a
commit 59eeee819e
23 changed files with 1690 additions and 326 deletions
+9 -1
View File
@@ -1187,7 +1187,8 @@ def run_audit(
md_path = agg_dir / f"{profile.name}.md"
tree_path = agg_dir / f"{profile.name}.tree"
dsl_path.write_text(to_dsl_v2(profile, generated_date=date), encoding="utf-8")
md_path.write_text(to_markdown(profile), encoding="utf-8")
from src.code_path_audit_render import render_full_markdown
md_path.write_text(render_full_markdown(profile), encoding="utf-8")
tree_path.write_text(to_tree(profile), encoding="utf-8")
output_paths[profile.name] = str(dsl_path)
return Result(data=AuditSummary(aggregate_profiles=tuple(profiles), output_paths=output_paths))
@@ -1233,11 +1234,18 @@ def render_rollups(summary: AuditSummary, output_dir: Path) -> dict[str, str]:
if p.is_candidate:
cand_lines.append(f"- **{p.name}**: candidate; would be detected after any_type_componentization_20260621 merges")
candidates_path.write_text("\n".join(cand_lines), encoding="utf-8")
from src.code_path_audit_render import render_field_usage_rollup, render_call_graph_rollup
field_usage_path = output_dir / "field_usage.md"
field_usage_path.write_text(render_field_usage_rollup(profiles), encoding="utf-8")
call_graph_path = output_dir / "call_graph.md"
call_graph_path.write_text(render_call_graph_rollup(profiles), encoding="utf-8")
return {
"summary.md": str(summary_path),
"cross_audit_summary.md": str(cross_audit_path),
"decomposition_matrix.md": str(decomposition_matrix_path),
"candidates.md": str(candidates_path),
"field_usage.md": str(field_usage_path),
"call_graph.md": str(call_graph_path),
}
def code_path_audit_v2(