Skip to content

Commit 3ab720e

Browse files
committed
docs: add deep extraction commit to contribution guide
Add commit 8 (deep extraction improvements) with detailed description of C#, F#, and Razor changes. Update test results with final metrics showing 1058-node main component and 2177 edges. Made-with: Cursor
1 parent 478bdcb commit 3ab720e

1 file changed

Lines changed: 42 additions & 11 deletions

File tree

FSHARP_CONTRIBUTION_GUIDE.md

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,43 @@ Adds a post-extraction pass that resolves F# `open` import targets to actual fil
8787

8888
---
8989

90-
## Suggested PR Strategy
90+
### 8. `478bdcb` — fix: deep extraction improvements for C# and F#
9191

92-
1. **PR 1 (Commits 1 + 2):** "Add F# language support" — the main feature. Blocked on tree-sitter-fsharp PyPI availability.
93-
2. **PR 2 (Commit 3):** "Add BCL method blocklist to cross-file inference" — independent quality fix, can be submitted immediately.
94-
3. **PR 3 (Commit 4):** "Fix node ID collisions across same-name files" — independent quality fix, can be submitted immediately.
95-
4. **PR 4 (Commit 5):** "Merge stub nodes with real cross-language definitions" — general improvement, can be submitted immediately.
96-
5. **PR 5 (Commit 6):** "Resolve F# open statements to source files" — depends on PR 1.
92+
**Files:** `graphify/extract.py`
93+
**PR scope:** Independent improvement, benefits all .NET languages
94+
**Depends on:** Commits 2, 7
95+
96+
Multiple fixes to the C#, F#, and Razor extractors:
97+
98+
**C# improvements:**
99+
- Add `object_creation_expression` to `call_types` (`new Type()` → edge to the created type)
100+
- Extract generic type arguments from `invocation_expression` (`AddDbContext<BookDbContext>()` → edge to `BookDbContext`)
101+
- Walk `constructor_declaration` bodies for call graph extraction via `_csharp_extra_walk`
102+
- Walk `global_statement` (top-level C# code in `Program.cs`) for calls (`app.UseMiddleware<ApiKeyMiddleware>()` → edge to `ApiKeyMiddleware`)
103+
104+
**F# improvements:**
105+
- Fix `member_defn` body extraction: find body after `=` token instead of `child_by_field_name("body")` which returns `None` for F# members. This was causing all member method bodies to be invisible to call-graph analysis.
106+
- Extract root identifier from `dot_expression` chains (`PipelineMetrics.counter.Add()` → edge to `PipelineMetrics` module)
107+
108+
**Razor improvements:**
109+
- Extract generic type arguments from `@code` blocks (`ShowDialogAsync<SubmitBookDialog>()` → edge to `SubmitBookDialog`)
110+
- Extract `new Type()` patterns from `@code` blocks
111+
112+
**Impact:** Previously disconnected clusters (BookDbContext, ChapterStore, PageGistStore, BookProcessingHub, BkdWebApplicationFactory, PipelineMetrics, ApiKeyMiddleware, SubmitBookDialog) all joined the main component. Main component grew from 995 to 1058 nodes.
113+
114+
---
115+
116+
## Updated PR Strategy
117+
118+
1. **PR 1 (Commits 1 + 2):** "Add F# language support" — blocked on tree-sitter-fsharp PyPI.
119+
2. **PR 2 (Commit 3):** "Add BCL method blocklist" — **submit now**.
120+
3. **PR 3 (Commit 4):** "Fix node ID collisions" — **submit now**.
121+
4. **PR 4 (Commit 5):** "Merge stub nodes" — **submit now**.
122+
5. **PR 5 (Commit 6):** "Resolve F# open statements" — depends on PR 1.
123+
6. **PR 6 (Commit 7):** "Add Razor/Blazor support" — can be submitted independently.
124+
7. **PR 7 (Commit 8):** "Deep extraction improvements" — **submit now** (C# parts are generic; F#/Razor parts depend on PRs 1, 6).
97125

98-
PRs 2, 3, and 4 are independent improvements that benefit all languages and can be submitted right away without waiting for tree-sitter-fsharp.
126+
PRs 2, 3, 4, and the C# parts of 7 are independent improvements that benefit all languages and can be submitted right away.
99127

100128
## Local Build: tree-sitter-fsharp Python Bindings
101129

@@ -198,14 +226,17 @@ Tested on a mixed F#/C#/Blazor project (BooksKnowledgeDistillation):
198226
| Metric | Before | After all fixes |
199227
|--------|--------|-----------------|
200228
| Nodes | 1055 | 1127 |
201-
| Edges | 1699 | 1714 |
229+
| Edges | 1699 | 2177 |
202230
| INFERRED edges | 538 | 362 |
203-
| Communities | 57 | 56 |
231+
| Communities | 57 | 44 |
204232
| Isolated (degree=0) | 119 | 3 |
205-
| Main component | 915 | 995 |
206-
| Disconnected components | 24 | 32 |
233+
| Main component | 915 | 1058 |
234+
| Disconnected components | 24 | 20 |
207235
| Top hub | `Contains` (false!) | `BookService` (correct) |
208236
| F# types extracted | 0 | 44 (from Domain.fs alone) |
209237
| Razor pages extracted | 0 | 18 |
210238
| C# → F# inherits | broken (stubs) | correct (real definitions) |
211239
| DashboardFilterHelper | disconnected | in main component |
240+
| BookDbContext | disconnected | in main component |
241+
| PipelineMetrics | disconnected | in main component |
242+
| ApiKeyMiddleware | disconnected | in main component |

0 commit comments

Comments
 (0)