@@ -7,6 +7,152 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
88## [ Unreleased]
99
10+ ## [ 1.9.0] 2025-09-09
11+
12+ ### Added
13+
14+ #### Enhanced Data Model Support
15+
16+ - ** ` Statifier.active_leaf_states/1 ` ** : Added public API function to retrieve only leaf states from active configuration
17+ - ** Leaf State Focus** : Returns only the leaf (atomic) states that are currently active, excluding ancestor states
18+ - ** MapSet Return** : Returns active leaf states as a MapSet for efficient membership testing and set operations
19+ - ** Public API** : Provides direct access to leaf state information for client applications
20+ - ** Documentation** : Comprehensive function documentation with clear usage examples
21+
22+ #### Enhanced Event Processing Improvements
23+
24+ - ** SCXML-Compliant Event Matching** : Complete implementation of W3C SCXML event matching patterns
25+ - ** Universal Wildcard** : "* " matches any event name per SCXML specification
26+ - ** Prefix Matching** : "foo" matches "foo", "foo.bar", "foo.bar.baz" with dot-separated token logic
27+ - ** OR Pattern Support** : "foo bar" matches events that match "foo" OR "bar" (space-separated alternatives)
28+ - ** Wildcard Suffix** : "foo.* " matches "foo.bar", "foo.baz" but not "foo" (requires additional tokens)
29+ - ** Token-Based Logic** : Proper dot-separated token parsing for hierarchical event names
30+
31+ - ** Error Event Generation** : Comprehensive error.execution event generation per SCXML specification
32+ - ** Assign Action Errors** : Failed assignments now generate error.execution events with detailed context
33+ - ** Error Event Structure** : Events include reason, type, location, and expression information
34+ - ** Internal Event Queue** : Error events properly queued as internal events for processing
35+ - ** Graceful Error Handling** : State machine continues execution after logging errors
36+
37+ #### Strict Nested Assignment Validation
38+
39+ - ** Enhanced Datamodel Validation** : Strict checking for nested map assignments to prevent auto-creation
40+ - ** Intermediate Structure Validation** : Assignments to nested paths require all intermediate structures to exist
41+ - ** Type Safety** : Prevents assignment to non-map intermediate values with clear error messages
42+ - ** SCXML Compliance** : Aligns with proper SCXML datamodel semantics for assignment operations
43+ - ** Error Reporting** : Detailed error messages indicating specific validation failures
44+
45+ ### Changed
46+
47+ #### Test Infrastructure Improvements
48+
49+ - ** Updated Internal Tests** : Modified 9 internal tests to expect strict nested assignment behavior
50+ - ** Correct SCXML Behavior** : Tests now verify proper failure when attempting to assign to non-existent intermediate structures
51+ - ** Error Expectation** : Tests properly expect {: error , reason} responses for invalid assignments
52+ - ** Maintained Coverage** : All test updates preserve comprehensive test coverage
53+
54+ #### Event Processing Updates
55+
56+ - ** Enhanced Event Module** : Improved event matching capabilities with comprehensive pattern support
57+ - ** Robust Pattern Matching** : Handles complex event patterns with proper token parsing
58+ - ** Performance Optimization** : Efficient string splitting and token comparison algorithms
59+ - ** Comprehensive Testing** : Full test coverage for all event matching scenarios
60+
61+ ### Fixed
62+
63+ #### Code Quality Improvements
64+
65+ - ** Removed Unnecessary Validation** : Eliminated whitespace validation from Evaluator resolve_location functions
66+ - ** Simplified Logic** : Removed redundant whitespace checking that wasn't addressing root issues
67+ - ** Cleaner Implementation** : Focus on core location resolution functionality without extra validation layers
68+ - ** Performance** : Reduced unnecessary string processing in location resolution
69+
70+ #### Datamodel Assignment Fixes
71+
72+ - ** Strict Assignment Implementation** : Fixed auto-creation of intermediate map structures in nested assignments
73+ - ** Prevented Invalid Behavior** : No longer auto-creates intermediate maps when assigning to nested paths
74+ - ** Proper Error Handling** : Clear error messages when attempting to assign to non-existent intermediate structures
75+ - ** SCXML Compliance** : Aligns with W3C SCXML specification for datamodel assignment semantics
76+
77+ ### Technical Improvements
78+
79+ #### Enhanced Test Coverage
80+
81+ - ** Comprehensive Event Testing** : Added extensive tests for SCXML event matching patterns
82+ - ** Universal Wildcard Tests** : Verification that "* " matches all event types
83+ - ** Prefix Pattern Tests** : Testing hierarchical event matching with dot notation
84+ - ** OR Logic Tests** : Validation of space-separated alternative event patterns
85+ - ** Wildcard Suffix Tests** : Complex wildcard pattern testing with proper token requirements
86+ - ** Coverage Achievement** : Improved test coverage to 90.1% (up from 89.7%)
87+
88+ #### Developer Experience
89+
90+ - ** Enhanced Error Messages** : Improved error context and logging throughout assignment operations
91+ - ** Structured Logging** : Comprehensive logging with metadata for debugging assignment failures
92+ - ** Debug Support** : Enhanced debugging capabilities with elixir log adapter recommendations
93+
94+ ### Examples
95+
96+ #### Event Matching Patterns
97+
98+ ``` xml
99+ <!-- Universal wildcard - matches any event -->
100+ <transition event =" *" target =" catch_all" />
101+
102+ <!-- Prefix matching - matches "user", "user.login", "user.logout" -->
103+ <transition event =" user" target =" user_handler" />
104+
105+ <!-- OR patterns - matches "start" OR "begin" OR "init" -->
106+ <transition event =" start begin init" target =" startup" />
107+
108+ <!-- Wildcard suffix - matches "system.error", "system.warning" but not "system" -->
109+ <transition event =" system.*" target =" system_handler" />
110+ ```
111+
112+ #### Error Event Handling
113+
114+ ``` xml
115+ <state id =" processing" >
116+ <onentry >
117+ <!-- This will generate error.execution event if foo doesn't exist -->
118+ <assign location =" foo.bar" expr =" 'value'" />
119+ </onentry >
120+
121+ <!-- Handle assignment errors -->
122+ <transition event =" error.execution" target =" error_state" >
123+ <log expr =" 'Assignment failed: ' + _event.data.reason" />
124+ </transition >
125+ </state >
126+ ```
127+
128+ #### Strict Assignment Validation
129+
130+ ``` elixir
131+ # This will now fail with proper error instead of auto-creating structures
132+ {:error , reason} = Datamodel .put_in_path (%{}, [" foo" , " bar" ], " value" )
133+ # reason: "Cannot assign to nested path: 'foo' does not exist"
134+
135+ # Proper usage requires intermediate structures to exist
136+ datamodel = %{" foo" => %{}}
137+ {:ok , updated} = Datamodel .put_in_path (datamodel, [" foo" , " bar" ], " value" )
138+ # updated: %{"foo" => %{"bar" => "value"}}
139+ ```
140+
141+ ### Migration Notes
142+
143+ - ** Event Matching** : Existing event patterns continue to work with enhanced capabilities
144+ - ** Assignment Behavior** : Code relying on auto-creation of intermediate structures may need updates
145+ - ** Error Handling** : New error.execution events provide better error visibility and handling
146+ - ** Test Coverage** : Internal tests updated to reflect correct SCXML assignment behavior
147+
148+ ### Notes
149+
150+ - ** Enhanced SCXML Compliance** : Improved adherence to W3C SCXML specification for event processing and datamodel operations
151+ - ** Better Error Handling** : Comprehensive error event generation and structured error reporting
152+ - ** Robust Event Processing** : Full implementation of SCXML event matching patterns with proper token-based logic
153+ - ** Strict Datamodel Semantics** : Proper validation of nested assignments prevents unexpected behavior
154+ - ** Test Coverage Improvement** : Achieved 90.1% test coverage with comprehensive event matching tests
155+
10156## [ 1.8.0] 2025-09-02
11157
12158### Added
0 commit comments