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
:groupcallback 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
References
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)
-
Changelog entry added, if necessary -
Documentation created/updated via this MR -
Documentation reviewed by technical writer or follow-up review issue created -
Tests added for this feature/bug -
Tested in all supported browsers -
Conforms to the code review guidelines -
Conforms to the style guides -
Conforms to the javascript style guides -
Conforms to the database guides -
Conforms to the merge request performance guidelines -
Internal refactoring only - no security, performance, or user-facing impact -
Improves code maintainability by removing redundant declarations -
Fixes callback chain ordering issues