Plugin lifecycle hooks defined
Why it matters
A plugin system without distinct lifecycle stages cannot release resources cleanly. When plugins open database connections, start intervals, or attach event listeners but have no deactivation or destruction hook to call, those resources accumulate for the process lifetime. Disabling a plugin through the UI becomes theater — the plugin keeps running. Over time this produces connection pool exhaustion, timer accumulation, and memory growth that lead to host instability. ISO 25010 maintainability.modularity requires components to be independently removable; lifecycle hooks are the mechanism that makes removal safe.
Severity rationale
Critical because missing deactivation and cleanup hooks make plugin removal impossible at runtime, turning every installed plugin into a permanent resource leak that can exhaust connections and crash the host.
Remediation
Add at minimum three lifecycle stages to the plugin interface in your host's type definitions. The host must invoke each method at the right moment and handle errors from each independently so one plugin's broken teardown does not block others from cleaning up.
interface Plugin {
/** Called once when plugin is first loaded. Set up state. */
init(context: PluginContext): Promise<void>;
/** Called when plugin becomes active. Start listening/processing. */
activate(): Promise<void>;
/** Called when plugin is disabled. Stop processing, keep state. */
deactivate(): Promise<void>;
/** Called when plugin is removed. Release all resources. */
destroy(): Promise<void>;
}
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Plugin / Extension Architecture Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · maintainability.modularity — Modularity — degree to which a system is composed of discrete components such that a change to one component has minimal impact on other components
Taxons
History
- 2026-04-18·v1.0.0·Initial import from plugin-extension-architecture·automated