Backend Refactor Summary
Context
This summary captures the recent backend/state-engine refactor work and the follow-on fixes needed to stabilize the test suite. It documents the key changes and the commits involved so future contributors can trace the rationale and scope.
Commits Covered
- e760a1ce - refactor: consolidate state engine
- bd30ecf9 - fix: unblock full test run
What Changed
1) Unified State Engine
- Consolidated transactional and enhanced state engine behavior into the core
StateEngineimplementation. - Removed legacy engine subclasses and updated call sites to use feature flags.
- Introduced enum-based feature flags (
StateEngineFeature) to avoid stringly-typed feature requests.
2) Structured Backend Configuration
- Added typed backend configuration dataclasses for local, S3, and PostgreSQL backends.
- Added
BackendTypeenum to standardize backend selection. - Updated factory and hybrid execution paths to accept
BackendType+ config objects (or a backend instance) instead of string/dict pairs.
3) Test Suite Alignment
- Updated tests to use the unified API and feature enums.
- Updated hybrid execution API tests to patch
create_state_enginerather thanLocalStateBackendinside the hybrid module. - Adjusted provider loader tests to respect the provider cache directory setting when set
(now
provider_cache_dir, a flag and[tool.nf.config]key; integration tests set it per worker).
4) Transaction Safety Fix
- Fixed transaction commit/rollback to apply changes directly to the in-memory state
instead of re-entering resource locks via
update_resource_state, which could deadlock the test suite.
Files Touched (Highlights)
libs/netherframe.core/netherframe/core/backends/state_engine.pylibs/netherframe.core/netherframe/core/backends/state_engine_factory.pylibs/netherframe.core/netherframe/core/hybrid_execution.pylibs/netherframe.core/netherframe/core/phases/executor.pylibs/netherframe.core/netherframe/core/orchestration/unified_orchestrator.pylibs/netherframe.core/tests/test_hybrid_execution_api.pylibs/netherframe.core/tests/test_provider_loader.py- Docs updated under
docs/core/anddocs/guides/to reflect the new API
Testing
uv run poe test-alluv run poe test-all-full