Skip to content

fix: flow-chain + mermaid rendering improvements - #45

Merged
hungpham10 merged 4 commits into
mainfrom
fix/flow-chain-mermaid-v3
Oct 8, 2026
Merged

hungpham10 merged 4 commits into
mainfrom
fix/flow-chain-mermaid-v3

Conversation

@hungpham10

Copy link
Copy Markdown
Owner

Summary

Complete overhaul of call-chain extraction and Mermaid flow-chart rendering to show clear structure:

Extractor improvements

  • Added markers: (17), (18), (20), (19), (21)
  • handler tags innermost call with +
  • handler tags innermost call with + (guarded by check)
  • Fixed switch discriminant extraction for Rust (scan children instead of field 'condition')

Mermaid rendering

  • Filter // from node rendering (group nested calls)
  • Remap edges from original chain indices to filtered indices
  • Run on filtered chain preserving IF/LOOP/SWITCH control flow
  • Cross-pass dedup to eliminate duplicate edges (fixes bug where edges appeared twice)
  • Call label appends when present
  • Multiple expressions render as separate blocks

Tests

  • Updated 21 golden chain tests to new marker format
  • Added 5 new tests: , , , ,
  • All 44 chain tests + 11 mermaid tests + 10 API tests pass

Verified via MCP

  • (node 1535): 8 calls show (symbols, chains_raw, call_names_raw, self.files, etc.)
  • (node 1047): 3 expressions render as separate switch blocks with , ,
  • Charts are fully connected single flow (no scattered sub-charts)
  • No more 'MARKER' nodes in output

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8705b5c0-bf67-44d0-8821-f9b8f1a7f7cb
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hungpham10
hungpham10 force-pushed the fix/flow-chain-mermaid-v3 branch 2 times, most recently from 9cd5da6 to 2e38803 Compare October 8, 2026 06:42
@codspeed

codspeed Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 13.2%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 2 regressed benchmarks
✅ 36 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ open+ingest 252.9 ms 296.5 ms -14.68%
❌ warm_no_hit 545.6 µs 617.8 µs -11.69%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing fix/flow-chain-mermaid-v3 (4180f84) with main (2bedb4e)

Open in CodSpeed

Hung Pham added 2 commits October 8, 2026 13:51
- Add CALL_ENTER/CALL_EXIT/STMT_END/SWITCH_START/SWITCH_CLOSE markers in extractor
- let_declaration handler: tag innermost call with into_var/is_new_var (NEW)
- assignment_expression handler: tag innermost call with into_var (is_new_var=false), guard with calls_before check
- Switch discriminant extraction fixed for Rust match_expression
- Mermaid: filter CALL_ENTER/CALL_EXIT/STMT_END from node rendering, remap edges, dedup cross-pass
- Mermaid: call label appends ' → {var}' when into_var present
- Mermaid: structural_edges on filtered chain preserves control flow (IF/LOOP/SWITCH)
- Update 21 golden chain tests to new marker format
- Add tests: rust_let_declaration, rust_multiple_let_declarations, rust_let_declaration_method_chain, rust_assignment_expression_no_call_rhs, rust_assignment_expression_with_call_rhs

All 44 chain tests + 21 mermaid/api tests pass.
@hungpham10
hungpham10 force-pushed the fix/flow-chain-mermaid-v3 branch from 2e38803 to f2923b6 Compare October 8, 2026 06:53
@codecov-commenter

codecov-commenter commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.96403% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.11%. Comparing base (2bedb4e) to head (4180f84).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/codegraph-extract/src/languages/common.rs 90.54% 7 Missing ⚠️
crates/codegraph-api/src/mermaid.rs 97.51% 4 Missing ⚠️
crates/codegraph-bench/src/bin/mem.rs 0.00% 1 Missing ⚠️
crates/codegraph-core/src/semgraph.rs 90.00% 1 Missing ⚠️
crates/codegraph-extract/src/languages/csharp.rs 0.00% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (94.96%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #45      +/-   ##
==========================================
+ Coverage   77.93%   78.11%   +0.17%     
==========================================
  Files          96       96              
  Lines       23067    23299     +232     
==========================================
+ Hits        17978    18200     +222     
- Misses       5089     5099      +10     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hungpham10
hungpham10 force-pushed the fix/flow-chain-mermaid-v3 branch from dd13bff to 40e3b3f Compare October 8, 2026 08:44
@hungpham10
hungpham10 merged commit 2f504c4 into main Oct 8, 2026
10 of 11 checks passed
@hungpham10
hungpham10 deleted the fix/flow-chain-mermaid-v3 branch October 9, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants