fix(meta_analyzer): store None-end fallback key so static findings are not dropped#94
Open
Shrotriya-lalit wants to merge 1 commit into
Open
Conversation
…e not dropped apply_filter stored LLM confirmations keyed by (file, rule_id, start, end_line). Static analyzers almost never record end_line (it defaults to None), while the LLM fills it in for every finding it confirms. This key mismatch caused every static finding with end_line=None to be silently dropped when the LLM returned an explicit end_line, effectively discarding all static results after LLM enrichment. Fix: when storing a granular LLM confirmation with an explicit end_line N, also store a fallback key with end_line=None via setdefault so that a static finding at the same (file, rule_id, start_line) with end_line=None still matches. Closes NVIDIA#67 Signed-off-by: Lalit Shrotriya <shrotriya.lalit@outlook.com>
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.
Problem
LLMMetaAnalyzer.apply_filter()stored LLM-confirmed findings keyed by:Static analyzers almost never populate
end_line— it defaults toNone.The LLM, however, fills in
end_linefor every finding it confirms.This key mismatch meant every static finding with
end_line=Nonewas silentlydropped after LLM enrichment, even when the LLM had correctly confirmed it.
In practice, the meta-analyzer produced zero filtered findings for entire files.
Root Cause
Fix
When storing a granular LLM confirmation with an explicit
end_line, also storea fallback key with
end_line=Noneviasetdefault:setdefaultis used so that if the LLM also reports a finding at the samestart_line with
end_line=None, its enrichment takes precedence. Lookup orderis unchanged: exact key → start-only key → coarse key.
Tests
test_static_end_line_none_confirmed_when_llm_returns_end_line— reproduces the bug exactlytest_static_end_line_none_multiple_same_rule— multiple findings same rule, different start linestest_end_line_used_when_provided— regression: exact end_line match still worksCloses #67
Checklist
make lintpassesgit commit -s)