impactsense-parser 0.1.1

Multi-language static analysis: parse codebases into an in-memory dependency graph for impact analysis
Documentation
================================================================================
IMPACT DEPENDENCY PARSER - CODE REVIEW & PENDING ITEMS
================================================================================
Date: January 28, 2026
Reviewer: Code Analysis Agent
Scope: Cross-microservice impact dependency analysis on code push

================================================================================
CURRENT IMPLEMENTATION STATUS
================================================================================

| Component                  | Status        | Notes                              |
|----------------------------|---------------|-------------------------------------|
| File parsing (multi-lang)  | IMPLEMENTED   | Java, JS/TS, Python, Rust, Go, Erlang, C# |
| File nodes                 | IMPLEMENTED   | path, language, project_name       |
| Class nodes                | IMPLEMENTED   | Java, C#                           |
| Module nodes               | IMPLEMENTED   | Erlang only                        |
| Function nodes             | IMPLEMENTED   | All languages                      |
| ApiEndpoint nodes          | PARTIAL       | Erlang/Cowboy, C#/ASP.NET only     |
| ExternalApi nodes          | IMPLEMENTED   | HTTP URL detection                 |
| DECLARES_* edges           | IMPLEMENTED   | All structural relationships       |
| DEPENDS_ON_FILE            | PARTIAL       | Java imports, Erlang modules       |
| CALLS_FUNCTION             | PARTIAL       | Java (intra-class), Erlang (intra-module) |
| HANDLED_BY                 | IMPLEMENTED   | ApiEndpoint -> Function            |
| CALLS_EXTERNAL_API         | IMPLEMENTED   | Function -> ExternalApi            |
| SAME_API                   | IMPLEMENTED   | Links ApiEndpoint <-> ExternalApi  |

================================================================================
CRITICAL SEVERITY - Blocks core microservice impact analysis
================================================================================

1. CROSS-MICROSERVICE API IMPACT TRACKING
   ---------------------------------------
   Issue: No mechanism to identify which microservice CONSUMES another 
          microservice's API
   
   Current State:
   - SAME_API links ApiEndpoint <-> ExternalApi by path matching
   - No project_name/microservice ownership on ExternalApi
   - Cannot answer: "If I change /omega/api/getavroutes, which microservices 
     are affected?"
   
   Missing Query Support:
     MATCH (provider:ApiEndpoint {path: "/orders/{id}"})<-[:EXPOSES]-(providerSvc:Microservice)
     MATCH (consumer:Function)-[:CALLS_EXTERNAL_API]->(ext:ExternalApi)-[:SAME_API]->(provider)
     MATCH (consumerSvc:Microservice)-[:CONTAINS]->(consumer)
     RETURN consumerSvc.name AS affected_microservice
   
   Required Fix:
   - Add Microservice/Service node type
   - Link via (:Microservice)-[:EXPOSES]->(:ApiEndpoint)
   - Propagate project_name to ExternalApi calls

--------------------------------------------------------------------------------

2. JAVA SPRING FRAMEWORK API DETECTION MISSING
   --------------------------------------------
   Issue: Most enterprise Java microservices use Spring Boot, but Spring 
          annotations are NOT detected
   
   Missing Detection:
   - @RestController, @Controller
   - @GetMapping("/path"), @PostMapping, @PutMapping, @DeleteMapping
   - @RequestMapping("/base")
   
   Impact: Java microservices won't have ApiEndpoint nodes created
   
   Location: graph.rs -> persist_java_structure() only handles classes/methods,
             no API endpoint extraction

--------------------------------------------------------------------------------

3. CROSS-PACKAGE/CROSS-CLASS JAVA CALL RESOLUTION
   -----------------------------------------------
   Issue: extract_java_calls() only resolves calls within same class or 
          through DIRECT imports
   
   Missing:
   - Calls through inheritance (super.method())
   - Calls on interface implementations
   - Wildcard imports (import com.redbus.genai.utils.*)
   - Static method calls across packages
   
   Current Limitation (graph.rs:1834-1847):
     // Only resolves local variables or direct imports
     if let Some(import_fqn) = import_map.get(first_ident) {
         receiver_type_fqn = Some(import_fqn.clone());
     }

================================================================================
HIGH SEVERITY - Significant gaps in dependency tracking
================================================================================

4. CROSS-MODULE ERLANG CALL RESOLUTION INCOMPLETE
   -----------------------------------------------
   Issue: DEPENDS_ON_FILE edge is created for module:function() calls, but 
          no CALLS_FUNCTION edge to the actual target function
   
   Current (graph.rs:854-870): Only creates file-to-file dependency, not 
                                function-to-function
   
   Impact: Cannot trace call chains across Erlang modules

--------------------------------------------------------------------------------

5. USES_CLASS RELATIONSHIP NOT IMPLEMENTED
   ----------------------------------------
   Issue: Schema documents USES_CLASS but it's NEVER created in graph.rs
   
   Missing Query Support:
   - "If OrderDetail class changes, which functions are affected?"
   - "Which classes use BusOperatorCancellationResult?"
   
   Schema Reference (neo4j-code-schema.md:62-64):
     - (:Function)-[:USES_CLASS]->(:Class) – function uses this type
     - (:Class)-[:USES_CLASS]->(:Class) – class uses another class

--------------------------------------------------------------------------------

6. JAVASCRIPT/TYPESCRIPT API DETECTION MISSING
   --------------------------------------------
   Issue: No Express, Fastify, NestJS, or Koa route detection
   
   Missing Detection:
   - app.get('/path', handler)
   - @Get('/path') decorators (NestJS)
   - Router middleware patterns
   
   Impact: Node.js microservices won't have ApiEndpoint nodes

--------------------------------------------------------------------------------

7. PYTHON API DETECTION MISSING
   -----------------------------
   Issue: No Flask, FastAPI, or Django route detection
   
   Missing Detection:
   - @app.route('/path')
   - @router.get('/path')
   - path('orders/', views.order_list)
   
   Impact: Python microservices won't have ApiEndpoint nodes

--------------------------------------------------------------------------------

8. GO HTTP HANDLER DETECTION MISSING
   ----------------------------------
   Issue: No detection for http.HandleFunc(), Chi, Gin, or Echo routes
   
   Impact: Go microservices won't have ApiEndpoint nodes

================================================================================
MEDIUM SEVERITY - Gaps in completeness
================================================================================

9. CALL GRAPH MISSING FOR NON-JAVA LANGUAGES
   ------------------------------------------
   | Language   | CALLS_FUNCTION Status        |
   |------------|------------------------------|
   | Java       | PARTIAL (intra-class)        |
   | Erlang     | PARTIAL (intra-module)       |
   | JavaScript | NOT IMPLEMENTED              |
   | TypeScript | NOT IMPLEMENTED              |
   | Python     | NOT IMPLEMENTED              |
   | Rust       | NOT IMPLEMENTED              |
   | Go         | NOT IMPLEMENTED              |
   | C#         | NOT IMPLEMENTED              |

--------------------------------------------------------------------------------

10. C# NAMESPACE NOT EXTRACTED
    ---------------------------
    Issue: extract_csharp_symbols() doesn't extract namespaces
    
    Current (graph.rs:1452): Class FQN is just the class name, not 
                             Namespace.ClassName
    
    Impact: FQN collisions possible, less precise impact queries

--------------------------------------------------------------------------------

11. PARAMETER/RETURN TYPE EXTRACTION INCOMPLETE
    --------------------------------------------
    Schema Defines: param_types, return_type, param_count
    
    Implemented: Only Erlang arity
    
    Missing For: Java, C#, TypeScript, Go, Python

--------------------------------------------------------------------------------

12. KAFKA/MESSAGE QUEUE DEPENDENCIES NOT TRACKED
    ---------------------------------------------
    Issue: extract_external_http_urls() only finds HTTP URLs
    
    Missing:
    - Kafka producer/consumer topics
    - RabbitMQ queues
    - gRPC service calls
    - Redis pub/sub channels
    
    Impact: Async microservice communication not captured

--------------------------------------------------------------------------------

13. DATABASE/STORAGE DEPENDENCIES NOT TRACKED
    ------------------------------------------
    Issue: No detection of:
    - SQL table access
    - MongoDB collection access
    - Elasticsearch index access
    
    Impact: Data layer dependencies invisible

================================================================================
LOW SEVERITY - Nice-to-have improvements
================================================================================

14. TEST CODE NOT SEPARATED
    ------------------------
    Issue: Test files parsed same as production code
    
    Impact: Noisy impact analysis results
    
    Suggestion: Add is_test: bool property or exclude **/test/**, **/*_test.* 
                patterns

--------------------------------------------------------------------------------

15. THIRD-PARTY DEPENDENCY ANALYSIS MISSING
    ----------------------------------------
    Issue: pom.xml, package.json, Cargo.toml, go.mod not parsed
    
    Impact: Cannot detect impacts from library version changes

--------------------------------------------------------------------------------

16. NO INCREMENTAL PARSING
    -----------------------
    Issue: Full codebase re-parse on every run
    
    Impact: Slow for large monorepos
    
    Suggestion: Track file hashes, only re-process changed files

--------------------------------------------------------------------------------

17. MISSING UNIT TESTS FOR CORE LOGIC
    ----------------------------------
    Issue: Only 2 unit tests exist (lib.rs, scanner.rs)
    
    Missing Tests For:
    - extract_java_symbols()
    - extract_java_calls()
    - extract_erlang_functions()
    - extract_csharp_api_endpoints()
    - normalize_api_path()

--------------------------------------------------------------------------------

18. NEO4J QUERY PERFORMANCE NOT OPTIMIZED
    --------------------------------------
    Issue: One query per node/edge, no batching (info.txt:129-131)
    
    Current: Thousands of round-trips for large repos
    
    Suggestion: Batch nodes/edges into UNWIND queries (already done for 
                Erlang functions, but not for other cases)

================================================================================
SUMMARY PRIORITY MATRIX
================================================================================

| Priority  | Count | Items                                                    |
|-----------|-------|----------------------------------------------------------|
| CRITICAL  |   3   | Cross-microservice tracking, Spring API detection,      |
|           |       | Cross-class call resolution                              |
| HIGH      |   5   | Erlang cross-module calls, USES_CLASS, JS/TS/Python/Go  |
|           |       | API detection                                            |
| MEDIUM    |   5   | Non-Java call graphs, C# namespaces, Types, Kafka/DB    |
|           |       | dependencies                                             |
| LOW       |   5   | Test separation, third-party deps, incremental parsing, |
|           |       | unit tests, batching                                     |

================================================================================
RECOMMENDED NEXT STEPS (Priority Order)
================================================================================

1. Add Java Spring API detection - Most common Java framework
2. Implement USES_CLASS relationship - Enables class-level impact queries
3. Add Microservice node linking - Core requirement for cross-service impact
4. Extend cross-class call resolution - Handle inheritance/interfaces
5. Add JS/TS Express route detection - Common Node.js pattern
6. Add C# call graph extraction - Mirror Java implementation

================================================================================
END OF REPORT
================================================================================

path as variable