Implement immutable DecisionGraph for decision table components #169
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements a complete immutable, thread-safe DecisionGraph system that represents decision tables and their components as a graph structure, as specified in issue #168.
Overview
The DecisionGraph provides an in-memory representation where:
Coordinates
,Conditions
,Rules
,DecisionTables
, andRuleFragments
"part_of"
,"lhs_of"
,"rhs_of"
, and"operator_of"
This follows the architectural decision (ADR-0003) to separate static logic structure from per-session execution state.
Implementation Details
Core Components
DecisionGraph
interface with immutable graph operationsInMemoryDecisionGraph
concrete implementation with filtering and traversalGraphNode
andGraphEdge
interfaces for type safetyNode Types
CoordinateNode
- represents coordinates in decision tablesConditionNode
- represents logical conditionsRuleNode
- represents decision rulesDecisionTableNode
- represents complete decision tablesRuleFragmentNode
- represents rule fragmentsEdge Types
PartOfEdge
- "part_of" relationships (e.g., Rule is part of DecisionTable)LhsOfEdge
- "lhs_of" relationships (left-hand side dependencies)RhsOfEdge
- "rhs_of" relationships (right-hand side dependencies)OperatorOfEdge
- "operator_of" relationshipsBuilder Pattern
Type-Safe Querying
Key Features
✅ Immutable & Thread-Safe: Built once, safely shared across threads
✅ Type-Safe: Compile-time guarantees for node/edge types
✅ Explicit Relationships: All component dependencies clearly modeled
✅ Performance Optimized: One-time construction, efficient traversal
✅ Comprehensive Testing: 100% test coverage for new components
✅ Builder Pattern: Convenient graph construction
✅ Documentation: Usage examples and architectural guidance
Testing
The implementation includes comprehensive test coverage:
All existing tests continue to pass, ensuring no regression.
Fixes #168.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.