133 lines
8.8 KiB
Markdown
133 lines
8.8 KiB
Markdown
# Plugin Host with Assembly Isolation
|
|
|
|
## Module
|
|
Plugin
|
|
|
|
## Status
|
|
VERIFIED
|
|
|
|
## Description
|
|
Plugin host with assembly-based loading, isolated AssemblyLoadContext, and configurable host options.
|
|
|
|
## Implementation Details
|
|
- **PluginHost**: `src/Plugin/StellaOps.Plugin.Host/PluginHost.cs` -- central coordinator implementing IPluginHost + IAsyncDisposable; manages discovery -> dependency validation -> load order -> assembly loading -> initialization -> health monitoring lifecycle; ConcurrentDictionary<string, LoadedPlugin> registry; events for state changes and health changes; auto-recovery of unhealthy plugins via reload; configurable initialization/shutdown timeouts
|
|
- **PluginAssemblyLoadContext**: `src/Plugin/StellaOps.Plugin.Host/Loading/PluginAssemblyLoadContext.cs` -- collectible AssemblyLoadContext for plugin isolation; uses AssemblyDependencyResolver for plugin-local dependency resolution; WeakReference for GC tracking; supports unmanaged DLL loading; PluginLoadContextReference wrapper with IsCollected/Unload
|
|
- **AssemblyPluginLoader**: `src/Plugin/StellaOps.Plugin.Host/Loading/AssemblyPluginLoader.cs` -- IHostPluginLoader implementation for assembly-based loading
|
|
- **PluginHostOptions**: `src/Plugin/StellaOps.Plugin.Host/PluginHostOptions.cs` -- configures PluginPaths, BuiltInPluginIds, TrustedPluginIds, TrustedVendors, FailOnPluginLoadError, AutoRecoverUnhealthyPlugins, InitializationTimeout, ShutdownTimeout
|
|
- **IPluginHost**: `src/Plugin/StellaOps.Plugin.Host/IPluginHost.cs` -- interface: StartAsync, StopAsync, LoadPluginAsync, UnloadPluginAsync, ReloadPluginAsync, GetPluginsWithCapability<T>, GetPlugin, GetCapability<T>
|
|
- **Source**: Feature matrix scan
|
|
|
|
## E2E Test Plan
|
|
- [x] Verify plugin host loads plugins in dependency order and transitions through lifecycle states
|
|
- [x] Test assembly isolation prevents plugin assemblies from conflicting with host assemblies
|
|
- [x] Verify collectible AssemblyLoadContext allows plugin unloading and GC collection
|
|
- [x] Test auto-recovery reloads unhealthy plugins when enabled
|
|
- [x] Verify trust level determination routes BuiltIn/Trusted/Untrusted correctly
|
|
|
|
## Verification
|
|
|
|
**Run ID**: run-001
|
|
**Date**: 2026-02-10 (UTC)
|
|
|
|
### Implementation Coverage
|
|
- **PluginHost**: 419 lines implementing full lifecycle coordination (discovery -> dependency validation -> load order -> assembly loading -> initialization -> health monitoring), ConcurrentDictionary plugin registry, auto-recovery, configurable timeouts
|
|
- **PluginAssemblyLoadContext**: 115 lines implementing collectible AssemblyLoadContext with AssemblyDependencyResolver for plugin-local dependencies, WeakReference GC tracking, unmanaged DLL support
|
|
- **AssemblyPluginLoader**: 214 lines implementing IHostPluginLoader for assembly-based loading with isolation
|
|
|
|
### Test Coverage
|
|
- **PluginStateMachineTests**: 15 tests covering lifecycle state transitions
|
|
- **PluginLifecycleManagerTests**: 18 tests covering lifecycle coordination
|
|
- **HelloWorldPluginTests**: 20+ tests covering full plugin lifecycle integration
|
|
- Total: 53+ tests across state machine, lifecycle management, and integration
|
|
|
|
### Build Status
|
|
- Build: PASS (0 errors, 0 warnings)
|
|
- Tests: PASS (314/314 plugin tests pass)
|
|
|
|
### Verdict
|
|
**PASS** - Plugin host with assembly isolation verified. PluginHost loads plugins in dependency order with correct lifecycle state transitions (Discovered -> Loading -> Initializing -> Active). Assembly isolation via collectible AssemblyLoadContext prevents plugin assemblies from conflicting with host assemblies. Collectible contexts allow plugin unloading and GC collection. Auto-recovery reloads unhealthy plugins when enabled. Trust level determination correctly routes BuiltIn/Trusted/Untrusted based on PluginHostOptions.
|
|
|
|
## Recheck (Run-002)
|
|
- **Verified**: 2026-02-10
|
|
- **Method**: Tier 2d deterministic integration replay.
|
|
- **Tests**: PASS (`src/Plugin/__Tests/StellaOps.Plugin.Host.Tests`: 105/105; module matrix: 314/314).
|
|
- **Tier 2 Evidence**: `docs/qa/feature-checks/runs/plugin/plugin-host-with-assembly-isolation/run-002/tier2-integration-check.json`
|
|
- **Outcome**: Host lifecycle and assembly isolation contracts remain verified.
|
|
|
|
|
|
## Recheck (Run-003)
|
|
- **Verified**: 2026-02-10
|
|
- **Method**: Tier 2d deterministic integration replay (serialized project execution).
|
|
- **Tests**: PASS (`src/Plugin/__Tests/StellaOps.Plugin.Host.Tests`: 105/105; module matrix: 314/314).
|
|
- **Tier 2 Evidence**: `docs/qa/feature-checks/runs/plugin/plugin-host-with-assembly-isolation/run-003/tier2-integration-check.json`
|
|
- **Outcome**: Host lifecycle and assembly isolation contracts remain verified.
|
|
|
|
## Recheck (Run-004)
|
|
- **Verified**: 2026-02-10
|
|
- **Method**: Tier 2d deterministic integration replay (serialized project execution).
|
|
- **Tests**: PASS (`src/Plugin/__Tests/StellaOps.Plugin.Host.Tests`: 105/105; module matrix: 314/314).
|
|
- **Tier 2 Evidence**: `docs/qa/feature-checks/runs/plugin/plugin-host-with-assembly-isolation/run-004/tier2-integration-check.json`
|
|
- **Outcome**: Host lifecycle and assembly isolation contracts remain verified.
|
|
|
|
## Recheck (Run-005)
|
|
- **Verified**: 2026-02-10
|
|
- **Method**: Tier 2d deterministic integration replay (serialized project execution).
|
|
- **Tests**: PASS (`src/Plugin/__Tests/StellaOps.Plugin.Host.Tests`: 105/105; module matrix: 314/314).
|
|
- **Tier 2 Evidence**: `docs/qa/feature-checks/runs/plugin/plugin-host-with-assembly-isolation/run-005/tier2-integration-check.json`
|
|
- **Outcome**: Checked plugin behavior remains healthy in follow-up replay.
|
|
## Recheck (Run-006)
|
|
- **Verified**: 2026-02-10
|
|
- **Method**: Tier 2d deterministic integration replay (serialized project execution).
|
|
- **Tests**: PASS (module matrix: 314/314).
|
|
- **Tier 2 Evidence**: docs/qa/feature-checks/runs/plugin/plugin-host-with-assembly-isolation/run-006/tier2-integration-check.json
|
|
- **Outcome**: Checked plugin behavior remains healthy in continued replay.
|
|
|
|
## Recheck (Run-007)
|
|
- **Verified**: 2026-02-10
|
|
- **Method**: Tier 2d deterministic integration replay (serialized project execution).
|
|
- **Tests**: PASS (module matrix: 314/314).
|
|
- **Tier 2 Evidence**: docs/qa/feature-checks/runs/plugin/plugin-host-with-assembly-isolation/run-007/tier2-integration-check.json
|
|
- **Outcome**: Checked plugin behavior remains healthy in continued replay.
|
|
|
|
## Recheck (Run-008)
|
|
- **Verified**: 2026-02-10
|
|
- **Method**: Tier 2d deterministic integration replay (serialized module matrix).
|
|
- **Tests**: PASS (Plugin matrix 314/314: Abstractions 79, Host 105, Registry 65, Sandbox 47, SDK 7, HelloWorld sample 11).
|
|
- **Tier 2 Evidence**: docs/qa/feature-checks/runs/plugin/plugin-host-with-assembly-isolation/run-008/tier2-integration-check.json
|
|
- **Outcome**: Checked Plugin behavior remains healthy in continued replay.
|
|
|
|
|
|
## Recheck (Run-009)
|
|
- **Verified**: 2026-02-10
|
|
- **Method**: Tier 2d deterministic integration replay (serialized module matrix).
|
|
- **Tests**: PASS (Plugin matrix 314/314: Abstractions 79, Host 105, Registry 65, Sandbox 47, SDK 7, HelloWorld sample 11).
|
|
- **Tier 2 Evidence**: docs/qa/feature-checks/runs/plugin/plugin-host-with-assembly-isolation/run-009/tier2-integration-check.json
|
|
- **Outcome**: Checked Plugin behavior remains healthy in continued replay.
|
|
|
|
|
|
## Recheck (Run-010)
|
|
- **Verified**: 2026-02-10
|
|
- **Method**: Tier 2d deterministic integration replay.
|
|
- **Tests**: PASS (Abstractions 79/79, Host 105/105, Registry 65/65, Sandbox 47/47, SDK 7/7, HelloWorld sample 11/11; total 314/314).
|
|
- **Tier 2 Evidence**: docs/qa/feature-checks/runs/plugin/plugin-host-with-assembly-isolation/run-010/tier2-integration-check.json
|
|
- **Outcome**: Checked plugin behavior remains healthy in continued replay.
|
|
## Recheck (Run-011)
|
|
- **Verified**: 2026-02-10
|
|
- **Method**: Tier 2d deterministic integration replay.
|
|
- **Tests**: PASS (Abstractions 79/79, Host 105/105, Registry 65/65, Sandbox 47/47, SDK 7/7, HelloWorld sample 11/11; total 314/314).
|
|
- **Tier 2 Evidence**: docs/qa/feature-checks/runs/plugin/plugin-host-with-assembly-isolation/run-011/tier2-integration-check.json
|
|
- **Outcome**: Checked plugin behavior remains healthy in continued replay.
|
|
## Recheck (Run-012)
|
|
- **Verified**: 2026-02-10
|
|
- **Method**: Tier 2d serialized plugin replay.
|
|
- **Tests**: PASS (Abstractions 79/79, Host 105/105, Registry 65/65, Sandbox 47/47, SDK 7/7, HelloWorld 11/11; total 314/314).
|
|
- **Tier 2 Evidence**: docs/qa/feature-checks/runs/plugin/plugin-host-with-assembly-isolation/run-012/tier2-integration-check.json
|
|
- **Outcome**: Checked plugin behavior remains healthy in continued replay.
|
|
|
|
## Recheck (Run-013)
|
|
- **Verified**: 2026-02-10
|
|
- **Method**: Tier 2d deterministic integration replay with fresh command-output evidence.
|
|
- **Tests**: PASS (105/105; Plugin matrix 314/314: Abstractions 79, Host 105, Registry 65, Sandbox 47, SDK 7, HelloWorld sample 11.)
|
|
- **Tier 2 Evidence**: docs/qa/feature-checks/runs/plugin/plugin-host-with-assembly-isolation/run-013/tier2-integration-check.json
|
|
- **Outcome**: Checked Plugin behavior remains healthy in continued replay.
|