Refactor/configuration normalize orderedset#599
Merged
Conversation
Systematic test matrix covering the observable behavior of all public Configuration APIs (current_state_value, configuration_values, configuration, current_state, model.state) across flat, compound, parallel, and complex parallel StateCharts. Verifies type contracts (scalar vs OrderedSet), value correctness, model identity, and the uninitialized async lifecycle. Uses pytest.parametrize over 14 topology x lifecycle scenarios x sync/async engines, plus setter and uninitialized edge cases (39 tests total). Signed-off-by: Fernando Macedo <fernando.macedo@jusbrasil.com.br>
Introduce two boundary functions (_read_from_model / _write_to_model) that confine the None|scalar|OrderedSet trichotomy to the model edge. All other methods (add, discard, states setter, values) now operate on a uniform OrderedSet, eliminating per-method type branching. The model still receives the same denormalized values as before (None for empty, scalar for single state, OrderedSet for multiple). Fixes edge case: configuration_values now returns OrderedSet() for uninitialized config instead of OrderedSet([None]), since None is not a valid state value. Prepares the codebase for the persistence protocol work (#597). Signed-off-by: Fernando Macedo <fernando.macedo@jusbrasil.com.br>
487574e to
6a48f18
Compare
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #599 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 42 42
Lines 5007 5007
Branches 813 810 -3
=========================================
Hits 5007 5007
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Summary
current_state_value,configuration_values,configuration,current_state, andmodel.stateacross flat, compound, parallel, and complex parallel topologies with both sync/async enginesConfigurationto introduce_read_from_model()/_write_to_model()boundary functions, confining theNone | scalar | OrderedSettrichotomy to the model edge. All other methods (add,discard,statessetter,values) now operate on uniformOrderedSetconfiguration_valuesreturnsOrderedSet()for uninitialized config instead ofOrderedSet([None]), sinceNoneis not a valid state value