fix(r2-02): enforce the spec's no-retry invariant for Write/AlarmAcknowledge overrides (01/S-8, 03/S12 layer 1)
This commit is contained in:
+37
@@ -319,6 +319,43 @@ public sealed class DriverResilienceOptionsParserTests
|
||||
read.BreakerFailureThreshold.ShouldBe(ResiliencePolicyRanges.MinEnabledBreakerFailureThreshold);
|
||||
}
|
||||
|
||||
// ---- 01/S-8 = 03/S12: write-shaped capabilities never retry ----
|
||||
|
||||
/// <summary>A Write retryCount override is forced to 0 with a diagnostic (writes are non-idempotent).</summary>
|
||||
[Fact]
|
||||
public void WriteRetryOverride_IsForcedToZero_WithDiagnostic()
|
||||
{
|
||||
var options = DriverResilienceOptionsParser.ParseOrDefaults(
|
||||
DriverTier.A, "{\"capabilityPolicies\":{\"Write\":{\"retryCount\":5}}}", out var diag);
|
||||
|
||||
options.Resolve(DriverCapability.Write).RetryCount.ShouldBe(0);
|
||||
diag.ShouldNotBeNull();
|
||||
diag.ShouldContain("Write never retries");
|
||||
}
|
||||
|
||||
/// <summary>An AlarmAcknowledge retryCount override is forced to 0 with a diagnostic.</summary>
|
||||
[Fact]
|
||||
public void AlarmAcknowledgeRetryOverride_IsForcedToZero_WithDiagnostic()
|
||||
{
|
||||
var options = DriverResilienceOptionsParser.ParseOrDefaults(
|
||||
DriverTier.A, "{\"capabilityPolicies\":{\"AlarmAcknowledge\":{\"retryCount\":3}}}", out var diag);
|
||||
|
||||
options.Resolve(DriverCapability.AlarmAcknowledge).RetryCount.ShouldBe(0);
|
||||
diag.ShouldNotBeNull();
|
||||
diag.ShouldContain("AlarmAcknowledge never retries");
|
||||
}
|
||||
|
||||
/// <summary>A Read (idempotent) retryCount override is still honored — the invariant is write-shaped only.</summary>
|
||||
[Fact]
|
||||
public void ReadRetryOverride_StillHonored()
|
||||
{
|
||||
var options = DriverResilienceOptionsParser.ParseOrDefaults(
|
||||
DriverTier.A, "{\"capabilityPolicies\":{\"Read\":{\"retryCount\":5}}}", out var diag);
|
||||
|
||||
options.Resolve(DriverCapability.Read).RetryCount.ShouldBe(5);
|
||||
diag.ShouldBeNull();
|
||||
}
|
||||
|
||||
/// <summary>In-range overrides pass through untouched with no diagnostic.</summary>
|
||||
[Fact]
|
||||
public void InRangeOverrides_PassThrough_NoDiagnostic()
|
||||
|
||||
Reference in New Issue
Block a user