Repository navigation
feat(plugin): add structured async plugin health checks with cancellation - #37
Merged
Merged
Conversation
Co-Authored-By: Zarin <55444728+sean6224@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds first class structured and asynchronous health check contract to the AuthKit plugin API: plugins can now report multiple structured health results for independent dependencies while respecting host provided cancellation. The previous boolean health hook is replaced by default interface implementation so existing plugins remain source compatible and stay healthy by default when they do not implement custom checks.
Structured Health Models (D1–D2)
PluginHealthStatuswithHealthy,Degraded, andUnhealthyclassificationsPluginHealthResultcarryingStatus, optionalReason, and optional plugin-owned diagnosticDataExtended Health Contract (D3–D4)
Task<bool> CheckHealthAsync(IServiceProvider)onIAuthKitPluginwith an additive default interface implementation:Task<IReadOnlyList<PluginHealthResult>> CheckHealthAsync(IServiceProvider, CancellationToken = default)Healthy, so plugins without custom checks never become implicitly unhealthyDevTokensandDevToolsadopt the structured contract, including a Marten-backed check forDevTokensHost Integration
/healthendpoint collects every plugin's result list, propagatesRequestAborted, and aggregates via the maximum per plugin status (Healthy+Degraded->Degraded), returning 200 or 503 accordinglyHealthRuleinvokes the new async contract with a cancellation token and rejects plugins that return no resultsJwtKeyStoreInitializer, which previously crashed when multiple hosts started concurrently)Validation
dotnet buildcompletes with zero errors across the solutiongit diff --checkpassesPluginContractValidatorpasses end to end againstDevToolsandDevTokensResult
Plugins report structured, asynchronous, cancellable health for each dependency or capability independently, the host aggregates these results without collapsing them to a boolean, and existing plugin implementations continue to compile, load, and report healthy without modification.
Closes #14
Closes #15