Commit c89bdc4
Refactors datamodel (#49)
* Refactors datamodel
Major changes:
- Create dedicated Statifier.Datamodel module for all datamodel operations
- Rename DataElement to Data for consistency with SCXML <data> elements
- Extract common In() function setup to reduce code duplication
- Consolidate datamodel tests into single comprehensive test file
Datamodel module features:
- Initialize datamodel from <data> elements with expression evaluation
- Build evaluation contexts for conditions and expressions
- Support for datamodel variable access (get/set/has/merge)
- Proper event data merging as top-level variables in conditions
- Session ID generation and SCXML built-in variables
Code quality improvements:
- Fix all credo consistency issues (meaningful unused variable names)
- Eliminate duplicate code between ConditionEvaluator and ValueEvaluator
- Extract common test setup with helper functions
- Pass all dialyzer type checks with no errors
- Achieve 0 credo issues with --strict flag
Testing improvements:
- Combine datamodel_test.exs and datamodel_init_test.exs
- Add comprehensive edge case testing
- Use setup blocks and helper functions to reduce duplication
- All 361 tests passing with 91.2% coverage
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Improves context handling
This refactor simplifies context building across evaluators and improves naming consistency:
- Replace complex tuple-based context with direct StateChart parameter
- Unify context building in `Datamodel.build_evaluation_context/2`
- Eliminate redundant `|| %{}` checks (field is always a map)
- Single source of truth for SCXML context preparation
- Rename StateChart field: `data_model` → `datamodel`
- Update helper function: `update_data_model/2` → `update_datamodel/2`
- Use proper typing: `Statifier.Datamodel.t()` instead of generic `map()`
- Consistent naming across codebase matches module name
- Cleaner evaluator APIs: `evaluate_condition(compiled, state_chart)`
- Remove complex context building from individual modules
- Better type safety and Dialyzer compliance (0 warnings)
- More intuitive parameter passing throughout
- Reduced code duplication across evaluators
- Better type documentation and IDE support
- Simplified test code with cleaner StateChart initialization
- All 566 tests passing with 91.9% coverage maintained
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Consolidates evaluators and improves datamodel
- Consolidate ConditionEvaluator and ValueEvaluator into unified Statifier.Evaluator module
- Move put_in_path function from Evaluator to Datamodel module for better separation of concerns
- Update all imports across codebase to use new unified evaluator
- Remove old evaluator modules and tests, create comprehensive consolidated test suite
- Improve error handling in Datamodel.put_in_path with proper {:ok, result} | {:error, reason} pattern
- Prepare architecture for future pluggable datamodel support (ECMAScript, XPath)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Adds new passing SCION and SCXML tests
- Mark datamodel and data_elements as :supported in feature registry
- Update feature detector tests to reflect new datamodel support status
- Add 13 new passing tests to baseline (9 SCION, 4 W3C)
- New test categories: assign actions, data model initialization, foreach loops, if/else control flow
- Significant progress in SCXML compliance: 61/184 total tests now passing (33%)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Adds datamodel, evaluator improvements to docs
- Document unified Statifier.Evaluator module consolidation
- Detail enhanced Datamodel module with improved error handling
- Record 13 new passing tests unlocked by these improvements
- Track progress from 48/184 to 61/184 total tests passing (33% compliance)
- Update feature detection improvements and test baseline changes
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 39408bd commit c89bdc4
25 files changed
Lines changed: 1388 additions & 965 deletions
File tree
- .githooks
- lib/statifier
- actions
- parser/scxml
- test
- statifier
- actions
- parser
- scxml
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
10 | 46 | | |
11 | 47 | | |
12 | 48 | | |
| |||
42 | 78 | | |
43 | 79 | | |
44 | 80 | | |
45 | | - | |
| 81 | + | |
46 | 82 | | |
47 | | - | |
| 83 | + | |
48 | 84 | | |
49 | 85 | | |
50 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
| 210 | + | |
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
335 | | - | |
| 335 | + | |
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
| |||
273 | 272 | | |
274 | 273 | | |
275 | 274 | | |
276 | | - | |
| 275 | + | |
277 | 276 | | |
278 | 277 | | |
279 | 278 | | |
| |||
306 | 305 | | |
307 | 306 | | |
308 | 307 | | |
309 | | - | |
| 308 | + | |
310 | 309 | | |
311 | 310 | | |
312 | 311 | | |
| |||
367 | 366 | | |
368 | 367 | | |
369 | 368 | | |
370 | | - | |
| 369 | + | |
371 | 370 | | |
372 | 371 | | |
373 | 372 | | |
| |||
486 | 485 | | |
487 | 486 | | |
488 | 487 | | |
489 | | - | |
| 488 | + | |
490 | 489 | | |
491 | 490 | | |
492 | 491 | | |
| |||
500 | 499 | | |
501 | 500 | | |
502 | 501 | | |
503 | | - | |
504 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
| 94 | + | |
| 95 | + | |
98 | 96 | | |
99 | 97 | | |
100 | | - | |
| 98 | + | |
101 | 99 | | |
102 | 100 | | |
103 | | - | |
104 | | - | |
105 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
106 | 104 | | |
107 | 105 | | |
108 | 106 | | |
| |||
114 | 112 | | |
115 | 113 | | |
116 | 114 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | 115 | | |
This file was deleted.
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
| |||
0 commit comments