Key severity overrides on the rule that emitted the finding (#575) - #583
Merged
Merged
Conversation
Each analyzer rule now stamps its number on the findings it adds (PlanWarning.RuleNumber), and TryOverrideSeverity reads that number instead of matching WarningType against a rule-to-name table. The table had no entry for rules 34-37 and 39, for rule 30's Low Impact Index and Duplicate Index Suggestions, or for rule 10's RID Lookup, so overrides for them were silently ignored. The table, its unused reverse map and the static constructor that built it are gone. Engine warnings are still never overridden. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G625JBNh45iTR1hpT4CxNR
|
Reviewed. Verified against the full pre/post file contents (not just the diff hunks):
No T-SQL, no version-bump files, no PlanViewer.Web linked-compile changes in this PR, so those checklist items don't apply. No concerns. |
This was referenced Sep 27, 2026
Merged
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.
What does this PR do?
Fixes #575. A severity override now reaches every finding that its rule emits.
TryOverrideSeverityfound a finding's rule by matchingWarningTypeagainst theRuleWarningTypestable. The table had no entry for these findings, so an override for them did nothing and gave no error:The changes:
PlanWarninghas a newRuleNumberproperty (int?). Each rule sets it on each finding that it adds. That is 48 places inPlanAnalyzer.Node.csandPlanAnalyzer.Statement.cs. A script took each number from the enclosingRuleNN_...method. I checked the result by hand against the rule gates.TryOverrideSeverityreadsRuleNumberand does not look at the name.RuleWarningTypestable is gone. So are its reverse mapWarningTypeToRule, which nothing read, and the static constructor that built it.Some things did not change:
Source = SqlServer), as the issue asks. Those warnings carry no rule number.BenefitScorercome from no rule, so they carry no number. The scorer runs after the analyzer, so overrides never reached them before this PR either.ResultMappercopies named fields into its own types.Which component(s) does this affect?
How was this tested?
SeverityOverrideTests, 70 cases:Checklist
dotnet test)dotnet test)🤖 Generated with Claude Code
https://claude.ai/code/session_01G625JBNh45iTR1hpT4CxNR