Fix gitlab:setup failure on fresh database

What does this MR do and why?

Contributes to #591292

Problem

Running gitlab:setup on a fresh PostgreSQL database fails with PG::UndefinedTable: ERROR: relation "feature_gates" does not exist.

This regression was introduced in 18.9 by !220200 (merged) which added a circuit breaker to the Gitaly client. The CircuitBreaker#enabled? method calls Feature.enabled? before the database schema is initialized, causing Flipper to query the non-existent feature_gates table.

Solution

Check Feature::FlipperFeature.table_exists? before calling Feature.enabled? in CircuitBreaker#enabled?. This follows the established pattern used in lib/feature/gitaly.rb.

References

Screenshots or screen recordings

Not applicable - no UI changes.

How to set up and validate locally

  1. Create a fresh PostgreSQL database (without running migrations)
  2. Run bundle exec rake gitlab:setup
  3. Verify the setup completes without PG::UndefinedTable errors

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.

Merge request reports

Loading