feat(graph): add diagnosis routing skeleton

This commit is contained in:
zhuyongxin
2026-07-17 11:17:13 +08:00
parent 581daffdad
commit 42ba204532
26 changed files with 2455 additions and 0 deletions
@@ -0,0 +1,26 @@
## 1. Define Graph State And Audit Types
- [x] 1.1 Declare the BOM-managed Graph Core direct dependency; add diagnosis state keys, typed status/verdict enums, node/route/reason constants, and Replace/Append key strategies.
- [x] 1.2 Add validated orchestration event, transition, and trace value types with bounded routing-only map output.
## 2. Build The Deterministic Graph Skeleton
- [x] 2.1 Add non-null config-aware node action ports for Planner, Executor, Gatekeeper, Verified Input, Verifier, Evidence Retry, Composer, and Fallback.
- [x] 2.2 Implement fail-closed deterministic routers for every frozen Planner, Executor, Gatekeeper, Verifier, and Composer outcome.
- [x] 2.3 Build and compile the StateGraph with all nodes/edges, retry counter wrappers, evidence retry resets, Append events, and recursion limit 32.
## 3. Build The Trace Summary
- [x] 3.1 Implement orchestration trace construction from ordered events, including transitions, final reason, degraded flag, evidence retry count, and explicit invalid-input errors.
## 4. Verify With Fake Nodes
- [x] 4.1 Create reusable scriptable config-aware Fake Node fixtures that emit one terminal event per attempt and expose node order/call counts.
- [x] 4.2 Add real CompiledGraph tests for normal, Planner, Executor, and Gatekeeper routes including unknown fail-closed behavior.
- [x] 4.3 Add real CompiledGraph tests for Verifier, evidence retry, counter reset/independence, Composer, and recursion termination routes.
- [x] 4.4 Add trace builder and AppendStrategy assertions for exact event/transition order, fallback degradation, map shape, and invalid events.
## 5. Validate The Stage
- [x] 5.1 Run focused routing/trace tests, Maven test compilation, strict OpenSpec validation, and diff checks; resolve all regressions.
- [x] 5.2 Verify ChatService, real Agents, Gatekeeper service, database, and Trace API do not reference the skeleton; record that Maven E2E/log/DB checks are reserved for stage 5.