From f2fcb7606c8add904374306c65df209d1ccfeedd Mon Sep 17 00:00:00 2001 From: Oliver Kieselbach Date: Thu, 9 Jul 2026 15:55:15 +0200 Subject: [PATCH] fix(shared): suppress CS8603 false positive in RuleProvenance.Normalize netstandard2.0's string.IsNullOrEmpty lacks [NotNullWhen(false)], so the compiler cannot prove the else branch is non-null. Null-forgiving assert. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../AutopilotMonitor.Shared/Models/Rules/RuleProvenance.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Shared/AutopilotMonitor.Shared/Models/Rules/RuleProvenance.cs b/src/Shared/AutopilotMonitor.Shared/Models/Rules/RuleProvenance.cs index b84df7ca..f4f4ad0b 100644 --- a/src/Shared/AutopilotMonitor.Shared/Models/Rules/RuleProvenance.cs +++ b/src/Shared/AutopilotMonitor.Shared/Models/Rules/RuleProvenance.cs @@ -31,7 +31,9 @@ namespace AutopilotMonitor.Shared.Models /// Null/empty is treated as so pre-existing rows (written /// before this field) keep the historical "binary owns it" semantics. public static string Normalize(string? provenance) - => string.IsNullOrEmpty(provenance) ? Embedded : provenance; + // netstandard2.0's IsNullOrEmpty lacks [NotNullWhen(false)], so the compiler can't + // see that the else branch is non-null (CS8603) — assert it. + => string.IsNullOrEmpty(provenance) ? Embedded : provenance!; /// True when the row is a GitHub-reseeded rule not in the deployed binary's catalog /// — i.e. exempt from the embedded catalog-based sunset and runtime filter.