Fix ref cache searches during concurrent rebuilds

What does this MR do and why?

Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/586458

Problem

Untrusted ref cache searches could read an absent or stale Redis set while another request held the rebuild lock, returning missing or stale refs.

Solution

  • Match rebuilt cache values in memory when the cache is untrusted.
  • Preserve SSCAN MATCH searches for trusted cache hits.
  • Handle dotfiles, slashes, NUL patterns, and refs reconciled during rebuild.
  • Cover absent and stale cache searches while another rebuild holds the lock.

References

https://gitlab.com/gitlab-org/gitlab/-/issues/586458

How to set up and validate locally

  1. Run: bundle exec rspec spec/lib/gitlab/repositories/rebuildable_set_cache_spec.rb

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Merge request reports

Loading
Loading