None send warnings to vscode bridge for analytics - #1882
None send warnings to vscode bridge for analytics#1882ccallcottstevens wants to merge 5 commits into
Conversation
| const haystack = `${response.title ?? ''} ${response.message ?? ''}`.toLowerCase(); | ||
| return haystack.includes('rate limit'); |
There was a problem hiding this comment.
🔥 Code Bugs
Concatenating title and message with a space before searching can produce false positives when the phrase "rate limit" spans both fields (e.g. title="current rate", message="limit hit"); check each field independently instead: response.title?.toLowerCase().includes('rate limit') || response.message?.toLowerCase().includes('rate limit').
Details
📖 Explanation: The space-joined concatenation means a title ending in "rate" and a message beginning with "limit" would incorrectly match "rate limit".
| const haystack = `${response.title ?? ''} ${response.message ?? ''}`.toLowerCase(); | |
| return haystack.includes('rate limit'); | |
| // Check title and message independently to avoid false positives when "rate" and "limit" | |
| // are split across the two fields (e.g. title="current rate", message="limit hit"). | |
| return (response.title ?? '').toLowerCase().includes('rate limit') || | |
| (response.message ?? '').toLowerCase().includes('rate limit'); |
|
|
||
| private isRateLimitWarning(response: { title?: string; message?: string }): boolean { | ||
| return ( | ||
| !!response.title?.toLowerCase().includes('rate limit') || |
There was a problem hiding this comment.
⚠️ Maintainability - Best Practices
Consider extracting the string 'rate limit' into a constant to avoid magic strings and improve maintainability.
Details
📖 Explanation: Using a named constant makes the code more maintainable and reduces the risk of typos when the same string is used in multiple places.
What Is This Change?
I want to capture how often in the frontend users are hitting the rate limit warning so I am sending this metric through to Jira.
How Has This Been Tested?
Basic checks:
npm run lintnpm run testAdvanced checks:
Recommendations:
Rovo Dev code review: Rovo Dev is reviewing this pull request…
Refresh the page in a few minutes to see the results.