feat(extensibility): implement Plugin Architecture Framework with module:ClassName resolution #666

Merged
freemo merged 1 commit from feature/m6plus-plugin-architecture-framework into master 2026-03-10 14:58:30 +00:00
Owner

Summary

  • Implement plugin architecture framework with PluginLoader, PluginManager, types, and exception hierarchy in src/cleveragents/infrastructure/plugins/
  • Enable dynamic class loading via module:ClassName resolution with security prefix allowlist, entry point discovery via importlib.metadata, and @runtime_checkable Protocol validation
  • Add plugin lifecycle management (discover/activate/deactivate) with thread-safe RLock protection and config-driven registration

Key Changes

  • infrastructure/plugins/types.py: PluginState(StrEnum), ExtensionPoint(BaseModel), PluginDescriptor(BaseModel)
  • infrastructure/plugins/exceptions.py: PluginError, PluginLoadError, PluginNotFoundError, ProtocolMismatchError
  • infrastructure/plugins/loader.py: PluginLoader with load_class(), load_from_entry_points(), validate_protocol()
  • infrastructure/plugins/manager.py: PluginManager with lifecycle, config-driven registration, extension point catalog
  • application/container.py: Register PluginManager as Singleton in DI container
  • Tests: 48 Behave BDD scenarios, 10 Robot integration tests, ASV benchmarks
  • Coverage: 98.5% (threshold: 97%)

Testing

  • nox -s lint
  • nox -s typecheck (0 errors, 1 warning)
  • nox -s unit_tests (9776 scenarios passed)
  • Robot integration tests (10/10 passed)

ISSUES CLOSED: #585

## Summary - Implement plugin architecture framework with `PluginLoader`, `PluginManager`, types, and exception hierarchy in `src/cleveragents/infrastructure/plugins/` - Enable dynamic class loading via `module:ClassName` resolution with security prefix allowlist, entry point discovery via `importlib.metadata`, and `@runtime_checkable` Protocol validation - Add plugin lifecycle management (discover/activate/deactivate) with thread-safe `RLock` protection and config-driven registration ## Key Changes - **`infrastructure/plugins/types.py`**: `PluginState(StrEnum)`, `ExtensionPoint(BaseModel)`, `PluginDescriptor(BaseModel)` - **`infrastructure/plugins/exceptions.py`**: `PluginError`, `PluginLoadError`, `PluginNotFoundError`, `ProtocolMismatchError` - **`infrastructure/plugins/loader.py`**: `PluginLoader` with `load_class()`, `load_from_entry_points()`, `validate_protocol()` - **`infrastructure/plugins/manager.py`**: `PluginManager` with lifecycle, config-driven registration, extension point catalog - **`application/container.py`**: Register `PluginManager` as Singleton in DI container - **Tests**: 48 Behave BDD scenarios, 10 Robot integration tests, ASV benchmarks - **Coverage**: 98.5% (threshold: 97%) ## Testing - `nox -s lint` ✅ - `nox -s typecheck` ✅ (0 errors, 1 warning) - `nox -s unit_tests` ✅ (9776 scenarios passed) - Robot integration tests ✅ (10/10 passed) ISSUES CLOSED: #585
freemo added this to the v3.6.0 milestone 2026-03-10 03:07:24 +00:00
freemo force-pushed feature/m6plus-plugin-architecture-framework from 83fa4133f0
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 17s
CI / security (pull_request) Successful in 33s
CI / typecheck (pull_request) Successful in 35s
CI / unit_tests (pull_request) Successful in 2m37s
CI / docker (pull_request) Successful in 38s
CI / integration_tests (pull_request) Successful in 3m21s
CI / coverage (pull_request) Successful in 5m51s
CI / benchmark-regression (pull_request) Successful in 32m48s
to 521a552e56
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 14s
CI / build (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 19s
CI / typecheck (pull_request) Successful in 37s
CI / security (pull_request) Successful in 51s
CI / unit_tests (pull_request) Successful in 2m31s
CI / integration_tests (pull_request) Successful in 3m27s
CI / docker (pull_request) Successful in 56s
CI / coverage (pull_request) Successful in 6m7s
CI / lint (push) Successful in 12s
CI / build (push) Successful in 14s
CI / quality (push) Successful in 17s
CI / security (push) Successful in 42s
CI / typecheck (push) Successful in 44s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 2m37s
CI / docker (push) Successful in 39s
CI / integration_tests (push) Successful in 3m24s
CI / coverage (push) Successful in 5m9s
CI / benchmark-publish (push) Has been cancelled
CI / benchmark-regression (pull_request) Successful in 32m7s
2026-03-10 14:51:41 +00:00
Compare
freemo scheduled this pull request to auto merge when all checks succeed 2026-03-10 14:52:09 +00:00
freemo merged commit 521a552e56 into master 2026-03-10 14:58:30 +00:00
freemo deleted branch feature/m6plus-plugin-architecture-framework 2026-03-10 14:58:30 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core!666
No description provided.