Refactor: Remove duplicate before_action :group declarations

What does this MR do and why?

Removes redundant before_action :group declarations from group controllers that already inherit this callback from their parent Groups::ApplicationController.

This refactoring was identified during testing as part of the step-up authentication group protection work in !199800 . The duplicate declarations were causing callback chain ordering issues and test failures. When a child controller redeclares before_action :group, it doesn't replace the parent's declaration—it adds another callback to the chain. This can cause the callback to execute at unexpected times or in incorrect order with other callbacks like enforce_step_up_auth_for_namespace.

This cleanup will help reduce the handling of special cases in regards to the testing of step-up authentication group protection, making the test suite more maintainable and predictable.

This refactoring ensures that:

  • Controllers properly inherit the :group callback from the parent
  • Callback execution order is predictable and consistent
  • Test failures caused by callback ordering issues are resolved
  • Simplified testing for step-up authentication features

🛠️ with ❤️ at Siemens

References

  • Related MR: !199800 (Step-up authentication group protection)
  • Related issue: #556943

Screenshots or screen recordings

Not applicable - internal refactoring only, no UI changes.

How to set up and validate locally

This is an internal refactoring with no user-facing changes. Validation is done through the test suite. The CI pipeline will verify that all affected tests pass.

To validate locally, run the affected controller tests:

# Shared projects controller tests
bundle exec rspec spec/controllers/groups/shared_projects_controller_spec.rb

# Children controller tests
bundle exec rspec spec/controllers/groups/children_controller_spec.rb

# Contribution analytics controller tests (EE)
bundle exec rspec ee/spec/controllers/groups/contribution_analytics_controller_spec.rb

MR acceptance checklist

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

MR Checklist (@gerardo-navarro)
Edited by Gerardo Navarro

Merge request reports

Loading