NEW @W-22462044@ MissingFaultHandler misattributes parent-flow findings onto subflow files with parent line numbers#479
Merged
Conversation
|
Git2Gus App is installed but the |
aruntyagiTutu
approved these changes
Jul 13, 2026
aruntyagiTutu
left a comment
Contributor
There was a problem hiding this comment.
Excellent fix for the stale XML root caching bug. This correctly addresses the misattribution of parent flow findings onto subflow files.
Key observations:
- ✅ Root cause identified: Cached
self.rootfrom parent flow was reused for subflows, causing line numbers from parent to be stamped on subflow filenames. - ✅ Minimal, surgical fix: Removed
__init__method and the conditional caching logic inexecute(), now always callsparser.get_root()fresh likeHardcodedIdalready does. - ✅ Consistency: Both
HardcodedIdandMissingFaultHandlernow use the same pattern. - ✅ Testing: Unit test updated (expected count 9→8), comprehensive functional testing documented in PR body.
- ✅ No performance concern:
parser.get_root()is already called multiple times per flow scan; one more call inMissingFaultHandlerwon't introduce noticeable overhead.
The fix is correct, well-tested, and aligns with team patterns.
Contributor
✅ Code Review CompleteAutomated review passed with no critical findings. Reviewed:
Great work fixing the MissingFaultHandler XML caching bug! 🎉 Generated by |
jag-j
approved these changes
Jul 13, 2026
e6ba7dc to
bd9dc15
Compare
MissingFaultHandler cached the parsed XML root on its first execute() call and reused it for all subsequent subflow frames. This caused findings attributed to subflow files but with line numbers from the parent flow's XML tree. Remove the caching so parser.get_root() is called fresh each time, matching HardcodedId's behavior.
bd9dc15 to
5434054
Compare
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.
Summary
Fixes forcedotcom/code-analyzer#2063
Root Cause
MissingFaultHandler in packages/code-analyzer-flow-engine/FlowScanner/queries/optional_query.py caches the parsed XML root (self.root) on its first execute() call and reuses it for all subsequent subflow frames within a single top-level flow scan. Since QueryManager preserves query instances across subflows (only calling reload() at the end of each root flow via final_query()), the cached root from the parent flow is reused when processing subflows. The execute() method then iterates the parent's XML tree while stamping findings with the current subflow's filename (from parser.get_filename()), producing findings attributed to the subflow file but with line numbers from the parent flow. HardcodedId in the same file does NOT cache the root (calls parser.get_root() fresh each time) and is unaffected. The fix is to remove the self.root caching in MissingFaultHandler.init and execute(), always calling parser.get_root() like HardcodedId does.
Fix
Removed stale XML root caching in MissingFaultHandler.execute() that caused subflow findings to use parent flow line numbers. Now calls parser.get_root() fresh each invocation, matching HardcodedId behavior.
Testing
Functional Testing Evidence
Tested on Dreamhouse project:
Overall Status: PASS ✅
Files Changed