Skip to content

Commit 8c30a17

Browse files
refactor(141): simplify code per /simplify review (#161)
- Remove 3 "Feature 141" comment markers, use domain-descriptive names - Remove causal_relationship dead code in generate_chain_mermaid() — parser never populates this field, .get() always fell through to "enables" Co-authored-by: Claude <noreply@anthropic.com>
1 parent e85ada0 commit 8c30a17

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

scripts/extract-report-data.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ def render_mermaid_to_png(attack_trees: list, target_dir: Path, template_dir: Pa
827827

828828

829829
# =============================================================================
830-
# Attack Chain Processing (Feature 141 — Phase 3.5 cross-layer correlation)
830+
# Attack Chain Processing
831831
# =============================================================================
832832

833833
# Canonical MAESTRO layer names for Mermaid diagram node labels.
@@ -902,14 +902,7 @@ def generate_chain_mermaid(chain: dict) -> str:
902902
dst_match = re.match(r"(L\d)", raw_dst)
903903
src = src_match.group(1) if src_match else raw_src.replace(" ", "")
904904
dst = dst_match.group(1) if dst_match else raw_dst.replace(" ", "")
905-
# Use causal_relationship from the source finding if available
906-
causal = findings[i].get("causal_relationship", "")
907-
if not causal:
908-
causal = "enables"
909-
# Truncate long labels for diagram readability
910-
if len(causal) > 40:
911-
causal = causal[:37] + "..."
912-
lines.append(f' {src} -->|"{causal}"| {dst}')
905+
lines.append(f' {src} -->|"enables"| {dst}')
913906

914907
return "\n".join(lines)
915908

@@ -1428,7 +1421,7 @@ def generate_report_data_typ(data: dict) -> str:
14281421
lines.append("#let attack-trees = ()")
14291422
lines.append("")
14301423

1431-
# 3r: Attack Chain Data (Feature 141)
1424+
# 3r: Attack Chain Data
14321425
lines.append("// --- Attack Chain Data -------------------------------------------------------")
14331426
lines.append(f"#let has-attack-chains = {_typst_bool(data.get('has_attack_chains', False))}")
14341427
attack_chains = data.get("attack_chains", [])
@@ -1707,7 +1700,7 @@ def main():
17071700
data["has_attack_trees"] = False
17081701
data["attack_trees"] = []
17091702

1710-
# Attack chain data (Feature 141 — cross-layer correlation)
1703+
# Attack chain data (cross-layer correlation)
17111704
if artifacts.get("has_attack_chains"):
17121705
has_chains, chains = prepare_attack_chains(target_dir, data["findings"], template_dir)
17131706
data["has_attack_chains"] = has_chains

0 commit comments

Comments
 (0)