luigidemasi opened a new issue, #60: URL: https://github.com/apache/camel-kit/issues/60
> Imported from [luigidemasi/camel-kit#104](https://github.com/luigidemasi/camel-kit/issues/104), opened by [luigidemasi](https://github.com/luigidemasi) on 2026-06-25. > Closed by [luigidemasi/camel-kit#116](https://github.com/luigidemasi/camel-kit/pull/116), merged on 2026-06-26. --- ## Description `GraphBuilder` currently runs multiple parsers in parallel and passes the same mutable `ProjectGraph` instance to each parser. `ProjectGraph` uses concurrent/synchronized collections, so this works mechanically, but graph construction remains coupled to shared mutable state and parser execution timing. This makes the graph layer harder to reason about as new parsers are added. It also weakens error handling: parser failures are currently reported with `System.err.println`, and callers receive only the final graph, not structured diagnostics about skipped files, parser failures, timeouts, or partial graph quality. Relevant files: - `camel-kit-graph/src/main/java/io/github/luigidemasi/camelkit/graph/GraphBuilder.java` - `camel-kit-graph/src/main/java/io/github/luigidemasi/camelkit/graph/ProjectGraph.java` - `camel-kit-graph/src/main/java/io/github/luigidemasi/camelkit/graph/parser/GraphParser.java` - graph parser implementations under `camel-kit-graph/src/main/java/io/github/luigidemasi/camelkit/graph/parser/` ## Expected Behavior Graph construction should be deterministic and should expose parser diagnostics to callers. Suggested shape: - `GraphParser` produces a parser-local graph fragment instead of mutating the shared graph directly. - `GraphBuilder` merges parser fragments in a stable order. - `GraphBuilder` returns a result object such as `GraphBuildResult(graph, diagnostics)`. - Parser diagnostics include parser name, scanned files, warnings, failures, and timeout information. - Existing CLI commands can still serialize the graph as before, while optionally surfacing diagnostics. ## Additional Context A likely incremental implementation path: 1. Introduce `GraphBuildResult`. 2. Introduce `ParserDiagnostic`. 3. Add a `ProjectGraph fragment = new ProjectGraph()` per parser execution. 4. Merge fragments into the final graph after all futures complete. 5. Preserve existing `build(Path)` behavior initially, delegating to a new `buildWithDiagnostics(Path)` method. 6. Update tests to assert deterministic node/edge counts and diagnostic behavior. ## Acceptance Criteria - `GraphBuilder` no longer passes the same mutable `ProjectGraph` instance to all parallel parsers. - Parser failures and timeouts are captured as diagnostics instead of only printing to stderr. - Existing graph commands keep working. - Existing graph tests pass. - Add or update tests covering parser diagnostics and deterministic merge behavior. ## Validation Run: `./mvnw -pl camel-kit-graph test -Dformat.skip=true` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
