Skip to content

Technical breakdown: How to block projects from requesting code suggestions

We envision that we should give admins the ability to set which project or sub-group's projects shouldn't request code suggestions. Once set, not requesting code suggestions needs to be enforced at the IDE level. How do we do this?

Outcome:

  • Define what we need to build in GitLab Rails
  • Define what we need to build into IDE extensions

Implementation Notes

GitLab Rails

  • Add git repo URL parameter to completion endpoint API
    • Find any projects for those repo URLs to see if they have "code_suggestions" set to false
    • Also checks status of existing group namespace setting code_suggestions
    • Add unique error message when explicitly blocked
  • API query to update the status of a project based on Project ID (blocked / not blocked)
    • Allows setting / querying code_suggestions flag on project settings

Language Server

  • Pass through git repo URLs on completion request
  • Pass through / check the reponse for project blocked response

IDE Extensions

  • Disable code suggestions if completion endpoint returns project blocked for X minutes
  • Re-enable when switching projects / editors
Edited by Taylor McCaslin