Repository navigation
fix: [BUG][flow-engine] HardcodedId never reports a 15-character record ID, and reports words of 16, 17, or more than 18 characters - #517
Draft
nikhil-mittal-165 wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Git2Gus App is installed but the |
Contributor
Author
|
Self-review using the refreshed Code Analyzer regression-review skill. FindingsNo production-code defect found in the regex/checksum change. The new pattern constrains the helper to the documented 15-character base form and optional three-character checksum, while the existing Manual validation before mergeRequired:
Recommended:
Evidence checked: linked issue #2106, helper and caller behavior, checksum implementation, changed tests, and green Linux/macOS/Windows CI. The CLI run in the PR description is author-supplied evidence, not independently reproduced here. |
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
Addresses code-analyzer issue 2106 (referenced as plain text on purpose, so the issue is not mentioned or auto-closed).
Root Cause
The
id_patternregex inpackages/code-analyzer-flow-engine/FlowScanner/queries/optional_query.py:27is wrong.[a-zA-Z0-9]+[a-zA-Z0-9]{15}needs at least 16 characters, so 15-character IDs never match. Becauseis_valid_salesforce_id(line 1136) only verifies the checksum for length 18 and returns True for any other length the pattern accepts, words of 16, 17 or 19+ characters containing two adjacent digits are falsely reported. The lookahead(?=.*[0-9][0-9])misses valid 18-character IDs without two adjacent digits, and the optional suffix group expects 4 characters instead of 3 and is swallowed by the greedy prefix.Fix
Corrected
id_patternto^[a-zA-Z0-9]{5}0[a-zA-Z0-9]{9}(?:[A-Z0-5]{3})?$so 15 and 18 char Salesforce IDs validate and other lengths are rejected; added unit tests (test_salesforce_id.py).Testing
Functional Testing Evidence
Setup note:
sfis not installed, so setup_local_dev.py failed at step 5 (sf plugins link). Steps 1-4 built core and the CLI. Its step 3 symlink did not take effect, so it was re-run by hand and the CLI was run withnode code-analyzer/bin/run.jsand Python 3.12 on PATH.python3.12 -I -c 'from queries.optional_query import is_valid_salesforce_id'on the repro strings. 0012800000AbCdE True; 00Q5g00000Xyz12 True; Region2024Totals False; Invoice2024Number False; the extra 17- and 22-character words also False - PASS.run.js code-analyzer run --workspace flows --rule-selector flow:HardcodedId --view table. The flow has an Assignment with 0012800000AbCdE and one with Region2024Totals. A first run, before the symlink was redone, loaded a stale engine copy (old regex) and wrongly flagged Region2024Totals. After linking this branch, output was1 (Moderate) flow:HardcodedId T.flow-meta.xml:11:1(the 0012800000AbCdE assignment), with none for Region2024Totals - PASS.Overall Status: PASS
Files Changed
🤖 Generated with Claude Code