fix: call sendFolderConfigs synchronously after login [IDE-1901]#1194
Draft
nick-y-snyk wants to merge 2 commits intorefactor/IDE-1786_folder-config-refactoringfrom
Draft
fix: call sendFolderConfigs synchronously after login [IDE-1901]#1194nick-y-snyk wants to merge 2 commits intorefactor/IDE-1786_folder-config-refactoringfrom
nick-y-snyk wants to merge 2 commits intorefactor/IDE-1786_folder-config-refactoringfrom
Conversation
sendFolderConfigs was called as a background goroutine after authentication, causing a race condition where the IDE would trigger a scan before SAST settings were fetched and cached. This resulted in a "Snyk Code is not enabled" error on the first scan after login. Running sendFolderConfigs synchronously ensures SAST settings are populated before the login command returns, which is consistent with how HandleFolders already calls sendFolderConfigs.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
The $/snyk.hasAuthenticated notification is sent via an async channel inside Authenticate(), so the IDE can react and trigger a scan before feature flags and SAST settings are populated. This caused "Snyk Code is not enabled" errors on the first scan after login. Add a postCredentialUpdateHook to AuthenticationService that runs after credentials are stored but before the notification is sent. The login command uses this hook to populate feature flags for all workspace folders, ensuring SAST settings are cached before the IDE can scan. Also extract populateAllFolderConfigs from buildLspFolderConfigs to avoid duplicated PopulateFolderConfig calls.
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.
Description
Fixes a race condition where the first scan after login fails with "Snyk Code is not enabled" error.
sendFolderConfigs()was called as a background goroutine (go sendFolderConfigs(...)) after authentication. The login command returned immediately, the IDE got notified of auth success and triggered a scan — but SAST settings hadn't been fetched yet. On the next scan, settings were cached and it worked.The fix removes the
gokeyword sosendFolderConfigsruns synchronously before returning the token. This is consistent withHandleFolders()which already calls it synchronously.Jira: IDE-1901
Checklist
make generate)make lint-fix)