Code Suggestions PAT field is no longer required on SM
What does this MR do and why?
Previously, "Personal access token" input field in the "Code Suggestions" section of the Application Settings could not be empty if "Enable Code Suggestions for this instance" toggle was ON. This was only allowed when the toggle was OFF.
Now you could have "Personal access token" input field empty even when the toggle is ON.
This change is necessary to support both the new and the old token flow. In the flow, the Code Suggestions token will be synced from the CustomersDot, so it will not be required to be set by the user.
Screenshots or screen recordings
Master
Checking the checkbox and sending an empty field will result in validation error:
This branch
You could have an empty token field and the instance toggle checked:
It wouldn't result in any errors sending the form:
How to set up and validate locally
Prerequisite: Make sure you have a license on your GDK! (so it will act as EE Premium/Ultimate)
Otherwise, the "Code Suggestions" section will not be shown to you in Application Settings.
Master
- Check
master
- Visit http://localhost:3000/admin/application_settings/general, scroll down, and find the
Code Suggestions
section - Check the checkbox and leave the PAT field empty
- Save the settings
- The validation error should appear
On this branch
- Check this branch:
419770-ai-make-pat-field-optional-for-sm
- Visit http://localhost:3000/admin/application_settings/general, scroll down, and find the
Code Suggestions
section - Check the checkbox and leave the PAT field empty
- Save the settings
- Make sure no errors happened
- In rails console, you could double-check the state in the DB:
[7] pry(main)> ::Gitlab::CurrentSettings.reload.ai_access_token
=> ""
[8] pry(main)> ::Gitlab::CurrentSettings.reload.instance_level_code_suggestions_enabled
=> true
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #419770 (closed)