Skip to content

Consolidates active states and removes old apis#81

Merged
johnnyt merged 5 commits intomainfrom
cleanup
Aug 30, 2025
Merged

Consolidates active states and removes old apis#81
johnnyt merged 5 commits intomainfrom
cleanup

Conversation

@johnnyt
Copy link
Member

@johnnyt johnnyt commented Aug 30, 2025

This branch consolidates and cleans up the active states API while removing backwards compatibility layers for a more maintainable and explicit codebase.

Key Changes:

API Consolidation:

  • Consolidated active states functions into Configuration module as single source of truth
  • Renamed functions for clarity: active_states → active_leaf_states, active_ancestors → all_active_states
  • Removed wrapper functions from StateChart and Interpreter modules to eliminate API duplication
  • Updated all 857 tests to use the consolidated API directly

Backwards Compatibility Cleanup:

  • Removed legacy delegate functions (Statifier.validate, Statifier.interpret)
  • Removed unused Statifier.parse_only function that provided no additional value
  • Updated all documentation and examples to use explicit module references
  • Forced explicit module usage: Users must now call Statifier.Interpreter.initialize() and Statifier.Validator.validate() directly

Code Quality Improvements:

  • Implemented proper logging in Interpreter.initialize replacing TODO comments
  • Fixed history tracking logic to use all active states (including ancestors) for proper shallow history computation
  • Cleaned up unused aliases and removed compilation warnings
  • Enhanced test coverage with proper module imports and cleaner structure

Benefits:

  • Clearer API: Single source of truth for active state queries with unambiguous function names
  • Better maintainability: Explicit module usage eliminates API confusion
  • Improved architecture: Clean separation between leaf states and all active states
  • Enhanced debugging: Proper structured logging for validation warnings

All 857 tests pass with 91.2% code coverage maintained throughout the refactoring.

johnnyt and others added 5 commits August 29, 2025 20:05
**Major API consolidation:**
- Renames Configuration.active_states → active_leaf_states (clear semantics)
- Renames Configuration.active_ancestors → all_active_states (intuitive naming)
- Removes redundant wrapper functions from StateChart and Interpreter modules
- All active state queries now go directly to Configuration (single source of truth)

**Architecture improvements:**
- Eliminates multiple confusing ways to get active states
- Reduces maintenance overhead with single canonical implementation
- Clearer module responsibilities: Configuration owns all active state logic
- Self-documenting function names prevent usage errors

**Comprehensive updates:**
- Updated all 857 tests to use new Configuration API directly
- Added Configuration aliases to test files requiring them
- Fixed history tracking to use all_active_states for proper shallow history computation
- Updated README examples and documentation

**Breaking changes:**
- StateChart.active_states/1 and Interpreter.active_states/1 functions removed
- StateChart.active_ancestors/1 and Interpreter.active_ancestors/1 functions removed
- All active state queries must now use Configuration module directly

**Benefits:**
- Zero ambiguity in function naming and behavior
- Reduced API surface area with focused responsibility
- Better maintainability with single source of truth
- Cleaner architecture with explicit module dependencies

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove legacy delegate functions from Statifier module
- Update all usages to use proper module references directly
- Implement proper logging in Interpreter.initialize for validation warnings
- Clean up unused aliases

This change forces users to be explicit about which modules they're calling,
improving code clarity and removing API ambiguity.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Aug 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
lib/statifier.ex 100.00% <ø> (ø)
lib/statifier/configuration.ex 100.00% <ø> (ø)
lib/statifier/interpreter.ex 85.40% <100.00%> (-0.63%) ⬇️
lib/statifier/interpreter/transition_resolver.ex 100.00% <100.00%> (ø)
lib/statifier/logging/log_manager.ex 92.45% <ø> (ø)
lib/statifier/state_chart.ex 95.65% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@johnnyt johnnyt merged commit 3cf737e into main Aug 30, 2025
10 checks passed
@johnnyt johnnyt deleted the cleanup branch August 30, 2025 10:57
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