Skip to content

codeintel: Refactor inference code

Warren Gifford requested to merge ef/inference-refactor into main

Created by: efritz

️ All large line count files are mocks, there's not much non-trivial logic here.

This PR moves as much of our inference logic into lib as possible (things that don't depend on gitserver, db, etc) and also attempts to clean up the packages we have for auto-indexing (which are pretty spread out).

Now we have:

  • lib/codeintel/autoindex/config, which has our type definitions and marshalling functions to/from json/yaml
  • lib/codeintel/autoindex/inference, which looks at a repo structure through a GitClient interface and tries to return index jobs that are likely to succeed
  • enterprise/internal/codeintel/autoindex/enqueuer, which loads or infers configuration for a repository or package and schedules index jobs to be performed by an executor; called by
    • the frontend background process scheduling indexes
    • after a worker processes an index (for sg/sg on cloud only, currently)
    • via graphql requests

Reviewers:

I tried to make this diff-less but was difficult. All file changes are trivial EXCEPT FOR:

  • enterprise/internal/codeintel/autoindex/enqueuer/go.go (simplified; mostly came from enterprise/internal/codeintel/autoindex/inference/go.go package repo logic)
  • enterprise/internal/codeintel/autoindex/enqueuer/index_records.go (mostly came from the deleted code in enterprise/internal/codeintel/autoindex/enqueuer/enqueuer.go)
  • lib/codeintel/autoindex/inference/go.go (came from enterprise/internal/codeintel/autoindex/inference/go.go but was not sent as a copy)

Merge request reports

Loading