Skip to content

Index project access levels as PRIVATE when missing project_feature

What does this MR do and why?

I kept running into indexing errors in gdk after reseeding my database. I narrowed it down to the GitLab Instance / Monitoring project (which is created without a project_feature record). I decided to refactor the project_feature indexing code and just set everything to private if the project_feature is null and updated the specs.

Screenshots or screen recordings

N/A

How to set up and validate locally

I'm not sure if this is a reliable way to reproduce because the self monitoring project doesn't always fail to index:

  1. re-seed your database
  2. make sure gdk is enabled for elasticsearch and that advanced search is enabled for search/indexing
  3. run rake gitlab:elastic:index to create the index from scratch

another way to reproduce this is:

  1. find a project with a null project_feature (or delete the record for an existing project)
  2. in rails console call the as_indexed_json method: Project.find(19).__elasticsearch__.as_indexed_json
  3. verify it does not throw an error and sets all of the *_access_level keys to PRIVATE (10)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Terri Chu

Merge request reports