analysis update

This commit is contained in:
2026-06-13 09:04:02 +02:00
parent e2798b26cf
commit 2251a587d9
6 changed files with 37 additions and 411 deletions

View File

@@ -1,63 +1,57 @@
# Execution Plan for Extended Analysis
# Execution Plan for Extended Analysis (Revised for Robustness)
## Phase 0: Surgical Refactoring (The Enrichment Hook)
- [ ] Create `AnalysisResult` and `CodebaseMetadata` models.
- [ ] Update `ExportService.generateOutputs` to accept `AnalysisResult`.
- [ ] Implement `EnrichmentService` and `AnalysisEnricher` interface.
- [ ] Wrap current parser outputs in `AnalysisResult` within `ExportService`.
- [x] Create `AnalysisResult` and `CodebaseMetadata` models.
- [x] Update `ExportService.generateOutputs` to accept `AnalysisResult`.
- [x] Implement `EnrichmentService` and `AnalysisEnricher` interface.
- [x] Wrap current parser outputs in `AnalysisResult` within `ExportService`.
## Phase 1: Foundation
## Phase 1: Foundation & Semantic Core
- [ ] **JDT Binding Resolution**: Configure `ASTParser` with project classpath and `setResolveBindings(true)`.
- [ ] **Workspace Scoping**: Implement scanner with configurable exclude patterns (`test/`, `build/`, `node_modules/`).
- [ ] **ConstantResolver**: Implement lookup for `public static final` constants across class boundaries using JDT bindings.
- [ ] **Basic PropertyResolver**: Scan `application.properties/yml` for simple key-value pairs.
- [ ] Implement `JdtIntelligenceProvider` as the primary semantic analyzer.
- [ ] Implement `RegexIntelligenceProvider` for fast, lightweight metadata extraction.
...
## Phase 2: Direct Trigger Detection
- [ ] Implement `GenericEventDetector` using `ASTVisitor` to find `sendEvent` calls.
- [ ] Enhance `CodebaseContext` to provide mapping from `MethodDeclaration` to its callers (within the same codebase).
## Phase 2: Trigger Discovery & Instance Identity
- [ ] **GenericEventDetector**: Find `sendEvent` calls using `ASTVisitor`.
- [ ] **InstanceIdentifier**: Detect which State Machine is being targeted (via `@Qualifier`, bean names, or generic types `StateMachine<S, E>`).
- [ ] **Trigger Filter**: Link `sendEvent` calls to specific SM instances to avoid noise in multi-SM projects.
- [ ] Enhance `CodebaseContext` to provide mapping from `MethodDeclaration` to its callers using bindings.
## Phase 3: Entry Point Mapping
- [ ] Implement `SpringMvcDetector` for REST endpoints.
- [ ] Implement `MessageListenerDetector` for Kafka/JMS.
- [ ] Implement `ConfigurableTriggerDetector` for user-defined patterns.
- [ ] **SpringMvcDetector**: Detect REST endpoints (using `ConstantResolver` for paths).
- [ ] **MessageListenerDetector**: Detect Kafka/JMS listeners (using `ConstantResolver` for topics/queues).
- [ ] **ConfigurableTriggerDetector**: Support user-defined patterns for custom frameworks.
## Phase 4: Call Graph Integration
- [ ] Develop a simple call graph builder to link `Entry Points` to `Trigger Points` via intermediate service calls.
- [ ] Support inheritance in call graph resolution (e.g., calling a method defined in an interface/base class).
- [ ] Develop a call graph builder to link `Entry Points` to `Trigger Points` via intermediate service calls.
- [ ] Support inheritance in call graph resolution (using JDT bindings to resolve method overrides).
## Phase 5: Correlation and Visualization
## Phase 5: Visualization & Diagnostics
- [ ] Update `ExportService` to include trigger information.
- [ ] Update DOT exporter to show "external" entry points as boxes pointing to transitions.
- [ ] Update SCXML exporter to include trigger metadata in `<transition>` tags.
- [ ] Update DOT/SCXML exporters to show entry points.
- [ ] **Diagnostic Nodes**: Show "Potential/Unresolved Trigger" nodes when a `sendEvent` is found but the event name or SM instance cannot be resolved.
## Phase 6: Validation
## Phase 6: Validation (Milestone 1)
- [ ] Create a "Complex Sample Project" with REST controllers, services, and multiple state machines.
- [ ] Add unit tests for each detector and the aggregator.
- [ ] Verify that inheritance in both state machine config and controllers is correctly handled.
## Phase 7: Advanced Value Resolution
- [ ] Implement `PropertyResolver` to scan `application.properties/yml`.
- [ ] Add support for `@Value` tracking in fields and constructors.
- [ ] Implement constant resolution for cross-class references in annotations.
- [ ] Integrate value propagation into the call graph analysis (linking injected values to `sendEvent` arguments).
## Phase 7: Advanced Resolution & Data Flow
- [ ] **Complex ValueResolver**: Handle string concatenations and variable references in annotations/logic.
- [ ] **Payload Analysis**: Extract payload types from entry points and track field usage in `sendEvent` calls.
- [ ] **@Value Propagation**: Track property values injected into fields and constructors.
## Phase 8: Advanced String Expression Resolution
- [ ] Implement `ValueResolver` to handle string concatenations and variable references.
- [ ] Support cross-class constant lookup using JDT.
- [ ] Update all Enrichers (MVC, Rabbit, JMS) to use `ValueResolver` for metadata extraction.
- [ ] Verify with complex path patterns in the integration test suite.
## Phase 9: Instance Identification & Persistence Mapping
- [ ] Implement `InstanceIdentifier` to track State Machine IDs (via `@Qualifier`, bean names, or factories).
## Phase 8: Persistence & Lifecycle Mapping
- [ ] Detect persistence restoration logic (`persister.restore`).
- [ ] Update all Enrichers to include `stateMachineId` and `isRestoredFromPersistence` in metadata.
- [ ] Verify multi-SM identification in the integration test suite.
- [ ] Map "Resume" points where the machine state is loaded from a DB based on external identifiers.
- [ ] Update metadata to distinguish between "New Instance" and "Restored Instance" triggers.
## Phase 10: Incoming Payload Analysis
- [ ] Implement payload type extraction for REST and Message entry points.
- [ ] Detect usage of payload fields in `sendEvent` or `restore` calls.
- [ ] Add `payloadType` to `EntryPoint` and `TriggerPoint` models.
## Phase 9: Advanced Ecosystem Support
- [ ] **Reactive Chains**: Analyze WebFlux/Project Reactor lambdas (`doOnNext`, `flatMap`) for hidden triggers.
- [ ] **Interceptors & Filters**: Detect `HandlerInterceptor` and `Filter` implementations and map them to endpoints.
## Phase 11: Interceptor & Filter Mapping
- [ ] Implement detection of `HandlerInterceptor` and `Filter` implementations.
- [ ] Map interceptors to endpoints using `WebMvcConfigurer` analysis.
- [ ] Provide "Interceptor Context" metadata for each mapped endpoint.
## Phase 10: External Dependency Interop
- [ ] **Library Hints**: Allow users to provide a JSON map of "Method -> Event" for third-party libraries where source is unavailable.
- [ ] **External JAR Analysis**: (Optional) Configure JDT to scan source-attachments of dependencies if available.