Skip to content

LSIF: Guard all backend actions behind enterprise

Warren Gifford requested to merge lsif-enterprise-backend into master

Created by: efritz

Summary: Ensure that LSIF-related resolvers and the lsif-server proxy is only registered when running in enterprise mode. See this slack thread for motivation.

What changed:

  • GraphQL changes:
    • Move lsif_*.go from graphqlbackend to enterprise/codeintelligence/resolvers. This is the bulk of the change as it required updating imports and reshuffling some of the code. No logic changed except for the creation of the commit resolver for lsif dumps (see LsifDumps method in the resolver).
    • Add graphqlbackend/code_intelligence.go, which defines the interfaces for each resolver and updates the implementation of schemaResolver to call the optionally-bound CodeIntelligenceResolver
    • Update concrete uses of old resolvers in graphqlbackend to use the interfaces defined in the bullet point above.
    • Add Type method to RepositoryResolver so that we can get the repository db record from a resolver. I didn't see another way to do this and I was previously using package-private variables. Feedback welcome on this point.
    • Renamed variable onlyInEnterprise to a8nOnlyInEnterprise to avoid conflicts between a8n and codeintelligence resolvers. This keeps the text of the error relevant to the endpoint that emits it.
  • HTTP changes:
    • Move the LSIF endpoints into enterprise/codeintelligence/lsifserver/proxy.
    • Add a non-internal package in the frontend httpapi which only contains a constant for the LSIF server proxy struct. This is set by enterprise mode. This change was meant to reflect the same way resolvers are set in the enterprise frontend for graphqlbackend (there is both an internal and non-internal version).
    • Update LSIF route registration to use the variable described in the bullet point above. If that variable is not set, then register a dummy "404 feature not enabled" endpoint.

Merge request reports

Loading