Skip to content

Commit fcb834e

Browse files
committed
Simplify reactive pipeline diagram with clearer names
- Use readable names instead of abbreviations (decls not D, etc.) - Keep high-level abstraction (~25 nodes, hides internal details) - Document -mermaid flag for full 44-node auto-generated diagram - Regenerate SVG
1 parent a438152 commit fcb834e

File tree

3 files changed

+62
-130
lines changed

3 files changed

+62
-130
lines changed

analysis/reanalyze/ARCHITECTURE.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,12 @@ Files → file_data → decls, annotations, refs → live (fixpoint) → dead/li
235235
236236
![Reactive Pipeline](diagrams/reactive-pipeline.svg)
237237

238-
The Mermaid diagram above shows all 44 reactive nodes. Key stages:
238+
This is a high-level view (~25 nodes). For the full detailed diagram with all 44 nodes, run:
239+
```bash
240+
dune exec rescript-editor-analysis -- reanalyze -dce -config -ci -reactive -mermaid
241+
```
242+
243+
Key stages:
239244

240245
1. **File Layer**: `file_collection``file_data` → extracted collections
241246
2. **TypeDeps**: `decl_by_path` → interface/implementation refs → `all_type_refs`

analysis/reanalyze/diagrams/reactive-pipeline.mmd

Lines changed: 55 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -6,169 +6,96 @@ flowchart TB
66

77
subgraph FileData["Per-File Data"]
88
file_data[file_data]
9-
files[files]
10-
file_deps[file_deps]
119
end
1210

1311
subgraph Extracted["Extracted (ReactiveMerge)"]
1412
decls[decls]
1513
annotations[annotations]
1614
value_refs[value_refs]
1715
type_refs[type_refs]
18-
cross_file[cross_file<br/>items]
16+
cross_file_items[cross_file_items]
1917
end
2018

2119
subgraph TypeDeps["ReactiveTypeDeps"]
2220
decl_by_path[decl_by_path]
23-
intf_decls[intf_decls]
24-
impl_decls[impl_decls]
25-
intf_to_impl[intf→impl]
26-
impl_to_intf[impl→intf]
27-
same_path[same_path]
28-
combined_refs[combined<br/>refs_to]
29-
all_type_refs[all_type<br/>refs_from]
21+
all_type_refs[all_type_refs]
3022
end
3123

3224
subgraph ExcRefs["ReactiveExceptionRefs"]
33-
exc_collection[exception<br/>refs]
34-
exc_decls[exception<br/>decls]
35-
resolved_refs[resolved<br/>refs]
36-
resolved_from[resolved<br/>refs_from]
25+
exception_refs[exception_refs]
26+
exception_decls[exception_decls]
27+
resolved_refs[resolved_refs]
3728
end
3829

3930
subgraph DeclRefs["ReactiveDeclRefs"]
40-
decls_by_file[decls<br/>by_file]
41-
value_decl_refs[value<br/>decl_refs]
42-
type_decl_refs[type<br/>decl_refs]
43-
with_value[with_value<br/>refs]
44-
with_type[with_type<br/>refs]
45-
combined[combined]
31+
combined_refs[combined_refs]
4632
end
4733

4834
subgraph Liveness["ReactiveLiveness"]
49-
value_refs_from[value<br/>refs_from]
50-
type_refs_from[type<br/>refs_from]
51-
ext_value_refs[external<br/>value_refs]
52-
ext_type_refs[external<br/>type_refs]
53-
ext_referenced[externally<br/>referenced]
54-
annotated_roots[annotated<br/>roots]
55-
all_roots[all_roots]
35+
roots[roots]
5636
edges[edges]
5737
live[live<br/>fixpoint]
5838
end
5939

6040
subgraph Solver["ReactiveSolver"]
6141
dead_decls[dead_decls]
6242
live_decls[live_decls]
63-
modules_dead[modules<br/>with_dead]
64-
modules_live[modules<br/>with_live]
65-
dead_modules[dead<br/>modules]
66-
dead_by_file[dead<br/>by_file]
67-
issues_by_file[issues<br/>by_file]
68-
incorrect_dead[incorrect<br/>dead]
69-
modules_reported[modules<br/>reported]
70-
module_issues[module<br/>issues]
43+
dead_modules[dead_modules]
44+
dead_by_file[dead_by_file]
45+
issues_by_file[issues_by_file]
46+
incorrect_dead[incorrect_dead]
47+
module_issues[module_issues]
7148
end
7249

7350
subgraph Report["Report (iter only)"]
7451
OUTPUT[("REPORT")]
7552
end
7653

77-
%% File Layer
7854
file_collection -->|process| file_data
79-
file_data --> files
80-
file_data --> file_deps
81-
file_data --> decls
82-
file_data --> annotations
83-
file_data --> value_refs
84-
file_data --> type_refs
85-
file_data --> cross_file
86-
87-
%% TypeDeps
88-
decls --> decl_by_path
89-
decls --> intf_decls
90-
decls --> impl_decls
91-
decl_by_path --> intf_to_impl
92-
decl_by_path --> impl_to_intf
93-
decl_by_path --> same_path
94-
intf_decls --> intf_to_impl
95-
impl_decls --> impl_to_intf
96-
intf_to_impl --> combined_refs
97-
impl_to_intf --> combined_refs
98-
same_path --> combined_refs
99-
combined_refs --> all_type_refs
100-
101-
%% ExceptionRefs
102-
cross_file --> exc_collection
103-
decls --> exc_decls
104-
exc_collection --> resolved_refs
105-
exc_decls --> resolved_refs
106-
resolved_refs --> resolved_from
107-
108-
%% DeclRefs
109-
decls --> decls_by_file
110-
decls --> with_value
111-
decls --> with_type
112-
decls_by_file --> value_decl_refs
113-
decls_by_file --> type_decl_refs
114-
value_decl_refs --> with_value
115-
type_decl_refs --> with_type
116-
with_value --> combined
117-
with_type --> combined
118-
119-
%% Liveness inputs
120-
value_refs --> value_refs_from
121-
type_refs --> type_refs_from
122-
all_type_refs --> type_refs_from
123-
resolved_from --> value_refs_from
124-
125-
%% Liveness external refs
126-
decls --> ext_value_refs
127-
decls --> ext_type_refs
128-
value_refs_from --> ext_value_refs
129-
type_refs_from --> ext_type_refs
130-
value_refs_from --> value_decl_refs
131-
type_refs_from --> type_decl_refs
132-
ext_value_refs --> ext_referenced
133-
ext_type_refs --> ext_referenced
134-
135-
%% Liveness roots
136-
decls --> annotated_roots
137-
annotations --> annotated_roots
138-
ext_referenced --> all_roots
139-
annotated_roots --> all_roots
140-
141-
%% Liveness fixpoint
142-
combined --> edges
143-
all_roots --> live
55+
file_data -->|flatMap| decls
56+
file_data -->|flatMap| annotations
57+
file_data -->|flatMap| value_refs
58+
file_data -->|flatMap| type_refs
59+
file_data -->|flatMap| cross_file_items
60+
61+
decls -->|flatMap| decl_by_path
62+
decl_by_path -->|union+join| all_type_refs
63+
64+
cross_file_items -->|flatMap| exception_refs
65+
decls -->|flatMap| exception_decls
66+
exception_refs -->|join| resolved_refs
67+
exception_decls -->|join| resolved_refs
68+
69+
decls --> combined_refs
70+
value_refs --> combined_refs
71+
type_refs --> combined_refs
72+
all_type_refs --> combined_refs
73+
resolved_refs --> combined_refs
74+
75+
decls --> roots
76+
annotations --> roots
77+
78+
combined_refs -->|flatMap| edges
79+
roots --> live
14480
edges --> live
14581

146-
%% Solver partition
147-
decls --> dead_decls
148-
decls --> live_decls
149-
live --> dead_decls
150-
live --> live_decls
82+
decls -->|join| dead_decls
83+
live -->|NOT in| dead_decls
84+
decls -->|join| live_decls
85+
live -->|IN| live_decls
15186

152-
%% Solver modules
153-
dead_decls --> modules_dead
154-
live_decls --> modules_live
155-
modules_dead --> dead_modules
156-
modules_live --> dead_modules
87+
dead_decls --> dead_modules
88+
live_decls --> dead_modules
15789

158-
%% Solver issues
159-
dead_decls --> dead_by_file
160-
dead_by_file --> issues_by_file
90+
dead_decls -->|flatMap| dead_by_file
91+
dead_by_file -->|flatMap| issues_by_file
16192

162-
%% Solver incorrect @dead
163-
live_decls --> incorrect_dead
93+
live_decls -->|join @dead| incorrect_dead
16494
annotations --> incorrect_dead
16595

166-
%% Solver module issues
167-
issues_by_file --> modules_reported
168-
dead_modules --> module_issues
169-
modules_reported --> module_issues
96+
dead_modules -->|join| module_issues
97+
issues_by_file --> module_issues
17098

171-
%% Output
17299
issues_by_file -->|iter| OUTPUT
173100
incorrect_dead -->|iter| OUTPUT
174101
module_issues -->|iter| OUTPUT
@@ -182,11 +109,11 @@ flowchart TB
182109
classDef solver fill:#ffe6f0,stroke:#cc6699,stroke-width:2px
183110
classDef output fill:#e6ffe6,stroke:#2e8b2e,stroke-width:2px
184111

185-
class file_collection,file_data,files,file_deps fileLayer
186-
class decls,annotations,value_refs,type_refs,cross_file extracted
187-
class decl_by_path,intf_decls,impl_decls,intf_to_impl,impl_to_intf,same_path,combined_refs,all_type_refs typeDeps
188-
class exc_collection,exc_decls,resolved_refs,resolved_from excDeps
189-
class decls_by_file,value_decl_refs,type_decl_refs,with_value,with_type,combined declRefs
190-
class value_refs_from,type_refs_from,ext_value_refs,ext_type_refs,ext_referenced,annotated_roots,all_roots,edges,live liveness
191-
class dead_decls,live_decls,modules_dead,modules_live,dead_modules,dead_by_file,issues_by_file,incorrect_dead,modules_reported,module_issues solver
112+
class file_collection,file_data fileLayer
113+
class decls,annotations,value_refs,type_refs,cross_file_items extracted
114+
class decl_by_path,all_type_refs typeDeps
115+
class exception_refs,exception_decls,resolved_refs excDeps
116+
class combined_refs declRefs
117+
class roots,edges,live liveness
118+
class dead_decls,live_decls,dead_modules,dead_by_file,issues_by_file,incorrect_dead,module_issues solver
192119
class OUTPUT output

analysis/reanalyze/diagrams/reactive-pipeline.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)