Skip to content

feat(plugin): add tagged health results and scoped cached execution - #38

Merged
rian-be merged 6 commits into
developmentfrom
Health-Execution
Sep 14, 2026
Merged

rian-be merged 6 commits into
developmentfrom
Health-Execution

Conversation

@rian-be

@rian-be rian-be commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Extends the structured plugin health contract with tagged results and safe host side execution: plugin health checks run inside dedicated scoped IServiceProvider, latency is measured by the host and kept out of plugin Data, and completed executions are cached with a configurable TTL, single-flight de-duplication, and correct cancellation behavior (D7–D8).

Tagged Health Results (D5–D6)

  • adds optional Tags collection to PluginHealthResult, kept distinct from plugin owned diagnostic Data
  • DevTokens and DevTools emit tags alongside their structured results
  • tags round trip through result preservation and caching without being merged into status, reason, or diagnostic data

Scoped Health Execution (D7)

  • PluginHealthExecutor runs each plugin health check inside dedicated async scope, resolves scoped dependencies from that scope, and disposes it on success, failure, or cancellation
  • latency is measured with a monotonic Stopwatch and wrapped host side in PluginHealthExecutionResult(Results, Duration) it is never written into plugin Data
  • exceptions and cancellation propagate explicitly and are never converted into fabricated Healthy result

Health Result Caching (D8)

  • completed executions are cached as CachedPluginHealthExecution(Results, Duration, ExpiresAt) keyed per plugin, so one plugin's result is never returned for another
  • configurable TTL (Health:CacheTtl, default 30s) a zero TTL explicitly disables caching
  • single flight deduplicates concurrent refreshes per plugin while unrelated plugins continue executing concurrently
  • cancelled or incomplete executions never populate the cache

Validation

  • 136/136 tests pass (32 Abstractions, 94 Host, 10 Integration)
  • dotnet build completes with zero errors across the solution (only pre-existing warnings remain: CS8602, NU1510/NU1608, xUnit1031)
  • git diff --check passes
  • PluginContractValidator passes; DevTokens and DevTools keep compiling and loading with no contract changes

Result

Plugins report tagged health results while the host executes them safely in scoped isolation, measures latency without polluting plugin data, and serves cached executions within a configurable TTL with correct single flight, expiry, disabled cache, and cancellation semantics that never corrupt the cache.

Closes #16
Closes #17
Closes #18

@rian-be rian-be added enhancement New feature or request area/abstractions AuthKit.Plugins.Abstractions contract area/health-checks Plugin health check contract/infra (Section D) area/host Host-side runtime (DI, OpenAPI, health exec) contract Changes the plugin contract additive Additive, non-breaking change labels Sep 14, 2026
@rian-be rian-be self-assigned this Sep 14, 2026
@rian-be
rian-be merged commit e934cf4 into development Sep 14, 2026
9 checks passed
@rian-be
rian-be deleted the Health-Execution branch September 14, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

additive Additive, non-breaking change area/abstractions AuthKit.Plugins.Abstractions contract area/health-checks Plugin health check contract/infra (Section D) area/host Host-side runtime (DI, OpenAPI, health exec) contract Changes the plugin contract enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Structural Health Checks [Task] Host Health Execution, Caching, and Scoped Dependencies [Task] Add Health Metadata, Tags, and Diagnostics

1 participant