From 7843b87e8735480e51c61b3a120b875b838fed34 Mon Sep 17 00:00:00 2001 From: JohnnyT Date: Sun, 7 Sep 2025 17:12:02 -0600 Subject: [PATCH 1/2] Adds Statifier.active_leaf_states --- README.md | 117 +++++++++-------------------------------------- lib/statifier.ex | 38 ++++++++++++++- 2 files changed, 59 insertions(+), 96 deletions(-) diff --git a/README.md b/README.md index e3f53a0..5f128a0 100644 --- a/README.md +++ b/README.md @@ -10,84 +10,26 @@ An Elixir implementation of SCXML (State Chart XML) state charts with a focus on W3C compliance. -## Features - -- ✅ **Complete SCXML Parser** - Converts XML documents to structured data with precise location tracking -- ✅ **State Chart Interpreter** - Runtime engine for executing SCXML state charts -- ✅ **Secure Invoke System** - Handler-based external service integration with SCXML compliance -- ✅ **Modular Validation** - Document validation with focused sub-validators for maintainability -- ✅ **Compound States** - Support for hierarchical states with automatic initial child entry -- ✅ **Initial State Elements** - Full support for `` elements with transitions (W3C compliant) -- ✅ **Parallel States** - Support for concurrent state regions with simultaneous execution -- ✅ **Eventless Transitions** - Automatic transitions without event attributes (W3C compliant) -- ✅ **Conditional Transitions** - Full support for `cond` attributes with expression evaluation -- ✅ **Executable Content** - Complete support for ``, ``, ``, ``, `` elements -- ✅ **Parameter Processing** - Unified parameter evaluation for `` and `` elements -- ✅ **Value Evaluation** - Non-boolean expression evaluation using Predicator v3.0 for actual data values -- ✅ **Data Model Integration** - StateChart data model with dynamic variable assignment and persistence -- ✅ **O(1) Performance** - Optimized state and transition lookups via Maps -- ✅ **Event Processing** - Internal and external event queues per SCXML specification -- ✅ **Parse → Validate → Optimize Architecture** - Clean separation of concerns -- ✅ **Feature Detection** - Automatic SCXML feature detection for test validation -- ✅ **Regression Testing** - Automated tracking of passing tests to prevent regressions -- ✅ **Git Hooks** - Pre-push validation workflow to catch issues early -- ✅ **Logging Infrastructure** - Protocol-based logging system with TestAdapter for clean test environments -- ✅ **Test Infrastructure** - Compatible with SCION and W3C test suites with integrated logging -- ✅ **Code Quality** - Full Credo compliance with proper module aliasing -- ✅ **History States** - Complete shallow and deep history state support per W3C SCXML specification -- ✅ **Multiple Transition Targets** - Support for space-separated multiple targets in transitions - -## Current Status - -### Working Features - -- ✅ **Basic state transitions** and event-driven changes -- ✅ **Hierarchical states** with optimized O(1) state lookup and automatic initial child entry -- ✅ **Initial state elements** - Full `` element support with transitions and comprehensive validation -- ✅ **Parallel states** with concurrent execution of multiple regions and proper cross-boundary exit semantics -- ✅ **Eventless transitions** - Automatic transitions without event attributes (also called NULL transitions in SCXML spec), with cycle detection and microstep processing -- ✅ **Conditional transitions** - Full `cond` attribute support with Predicator v3.0 expression evaluation and SCXML `In()` function -- ✅ **Assign elements** - Complete `` element support with location-based assignment, nested property access, and mixed notation -- ✅ **If/Else/ElseIf conditional actions** - Complete ``, ``, `` conditional execution blocks -- ✅ **Invoke elements** - Secure `` element support with handler-based external service integration and SCXML-compliant event generation -- ✅ **Parameter processing** - Unified `` element evaluation with strict/lenient error handling modes -- ✅ **Value evaluation system** - Enhanced Evaluator module with centralized parameter processing and non-boolean expression evaluation -- ✅ **Enhanced expression evaluation** - Predicator v3.0 integration with deep property access and type-safe operations -- ✅ **History states** - Complete shallow and deep history state implementation with recording, restoration, and validation -- ✅ **Multiple transition targets** - Support for space-separated multiple targets (e.g., `target="state1 state2"`) -- ✅ **Enhanced parallel state exit logic** - Proper W3C SCXML exit set computation for complex parallel hierarchies -- ✅ **Transition conflict resolution** - Child state transitions take priority over ancestor transitions per W3C specification -- ✅ **SCXML-compliant processing** - Proper microstep/macrostep execution model with exit set computation and LCCA algorithms -- ✅ **Modular validation** - Refactored from 386-line monolith into focused sub-validators -- ✅ **Feature detection** - Automatic SCXML feature detection prevents false positive test results -- ✅ **SAX-based XML parsing** with accurate location tracking for error reporting -- ✅ **Performance optimizations** - O(1) state/transition lookups, optimized active configuration -- ✅ **Source field optimization** - Transitions include source state for faster event processing -- ✅ **Comprehensive logging** - Protocol-based logging system with structured metadata and test environment integration - -### Planned Features - -- Internal and targetless transitions -- More executable content (`