Add max limit to fetch query for group secrets

What does this MR do and why?

Group projects have an upper limit of 500, but we only fetch the first 100. This MR updates the query to fetch a maximum of 500 group secrets, since we do not have pagination implemented yet. Performance doesn't seem to be an issue. See How many secrets before Secrets Manager too slow/timeout?.

⚠️ Usually we would not merge backend and frontend changes in the same MR for GraphQL changes, but I think this should be safe to merge since: 1) the features are gated by feature flags (disabled by default); 2) if the frontend and backend are not yet synced, the frontend will just fetch the first 100, which is already the current behavior.

References

See How many secrets before Secrets Manager too slow/timeout?

Pagination will be tackled after GA, in #590913. This idea is to implement search functionality first so we can implement pagination.

Screenshots or screen recordings

How to set up and validate locally

  1. Upload a Premium license (or above).
  2. Set up openbao and enable the secrets manager on your gdk.
  3. Enable the secrets_manager and group_secrets_manager feature flags.
  4. Go to your group settings (Settings > General) and expand Permissions and group features. Enable the secrets manager for your group with the settings toggle.
  5. Run the following on rails console to seed your group with secrets:
    user = User.find_by_username('root')
    group = Group.find_by_name('group-with-500-secrets')
    
    Labkit::Correlation::CorrelationId.use_id('perf_test_static') do
      RequestStore.begin!
      begin
        500.times do |i|
          SecretsManagement::GroupSecrets::CreateService.new(group, user).execute(
            name: "SECRET_#{i+1}",
            description: 'A secret',
            value: "secret-value-#{i+1}",
            environment: '*',
            protected: true
          )
        end
      ensure
        RequestStore.end!
        RequestStore.clear!
      end
    end
  6. Go to /path-to-group/secrets and verify that all 500 secrets are loaded.

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