Skip to content

Refactor/configuration normalize orderedset#599

Merged
fgmacedo merged 2 commits intodevelopfrom
refactor/configuration-normalize-orderedset
Mar 16, 2026
Merged

Refactor/configuration normalize orderedset#599
fgmacedo merged 2 commits intodevelopfrom
refactor/configuration-normalize-orderedset

Conversation

@fgmacedo
Copy link
Owner

Summary

  • Add comprehensive API contract tests (39 tests) covering current_state_value, configuration_values, configuration, current_state, and model.state across flat, compound, parallel, and complex parallel topologies with both sync/async engines
  • Refactor Configuration to introduce _read_from_model() / _write_to_model() boundary functions, confining the None | scalar | OrderedSet trichotomy to the model edge. All other methods (add, discard, states setter, values) now operate on uniform OrderedSet
  • Fix edge case: configuration_values returns OrderedSet() for uninitialized config instead of OrderedSet([None]), since None is not a valid state value

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>
@fgmacedo fgmacedo force-pushed the refactor/configuration-normalize-orderedset branch from 487574e to 6a48f18 Compare March 16, 2026 15:30
@sonarqubecloud
Copy link

@codecov
Copy link

codecov bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (8d17ba9) to head (6a48f18).
⚠️ Report is 1 commits behind head on develop.

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           
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fgmacedo fgmacedo merged commit 67f2b0d into develop Mar 16, 2026
13 checks passed
@fgmacedo fgmacedo deleted the refactor/configuration-normalize-orderedset branch March 16, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant