Skip to content

CodeIndexer: Put force-push checking behind FF

What does this MR do and why?

In [Code Embeddings] Handle force pushes (#560713 - closed), we added a change in Ai::ActiveContext::Code::Indexer to check whether a new commit is due to a force-push. This force-push checking is a likely cause of Git timeout errors in other parts of Rails, see: Gitlab::Git::CommandTimedOut errors popping up ... (#568836 - closed).

In order to isolate this, we need to add the force-push checking behind a gitlab_com_derisk feature flag. In fact, this FF should have been added as part of [Code Embeddings] Handle force pushes (#560713 - closed) since Git calls are expensive, and the force-push check is not immediately needed for the initial Code Embeddings Indexing rollout.

This MR also adds logging around code that involve calls to git:

  • checking if a commit is present in a git repository
  • checking if a previously indexed commit is an ancestor of the latest commit
  • running the gitlab-elasticsearch-indexer, which makes "fetched changed files" calls to git

References

Screenshots or screen recordings

N/A - see validation steps

How to set up and validate locally

See validation steps: !200930 (merged)

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Pam Artiaga

Merge request reports

Loading