fix(core): resolve Low code-review findings (Core-004,008,009,010,011,012)
- Core-004: add ConfigureAwait(false) to DriverHost.RegisterAsync / UnregisterAsync / DisposeAsync. - Core-008: rewrite the BuildAddressSpaceAsync XML doc to correctly name the caller (OpcUaApplicationHost.PopulateAddressSpaces) that owns the per-driver isolation. - Core-009: snapshot DriverResilienceOptions once per non-idempotent write in CapabilityInvoker.ExecuteWriteAsync. - Core-010: switch DriverResilienceOptions.Resolve to TryGetValue with a diagnostic error message when a tier table is missing a capability. - Core-011: add an optional diagnostic callback to PermissionTrieBuilder so production callers can surface scope-path mismatches. - Core-012: correct the stale WedgeDetector ctor summary and add the Reconnecting row to DriverHealthReport's state matrix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -42,13 +42,27 @@ public sealed record DriverResilienceOptions
|
||||
/// Look up the effective policy for a capability, falling back to tier defaults when no
|
||||
/// override is configured. Never returns null.
|
||||
/// </summary>
|
||||
/// <exception cref="KeyNotFoundException">
|
||||
/// Thrown when neither the override map nor the tier defaults carry an entry for the
|
||||
/// requested capability. The <c>TierDefaults_Cover_EveryCapability</c> invariant test
|
||||
/// in <c>DriverResilienceOptionsTests</c> guarantees every defined enum value is present
|
||||
/// in each tier's table, so this only fires when a caller passes an out-of-range value
|
||||
/// or someone adds a <see cref="DriverCapability"/> member without updating
|
||||
/// <see cref="GetTierDefaults"/>. The message names the missing capability and tier.
|
||||
/// </exception>
|
||||
public CapabilityPolicy Resolve(DriverCapability capability)
|
||||
{
|
||||
if (CapabilityPolicies.TryGetValue(capability, out var policy))
|
||||
return policy;
|
||||
|
||||
var defaults = GetTierDefaults(Tier);
|
||||
return defaults[capability];
|
||||
if (defaults.TryGetValue(capability, out var fallback))
|
||||
return fallback;
|
||||
|
||||
throw new KeyNotFoundException(
|
||||
$"No policy defined for capability '{capability}' under tier '{Tier}'. " +
|
||||
$"This indicates a {nameof(DriverCapability)} enum value missing from {nameof(GetTierDefaults)} — " +
|
||||
"add the capability to every tier's default table.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user