Update group-level template retrieval to use new finder behind constrain_group_project_templates feature flag
Summary
Update the logic that returns group-level custom project templates to the UI to use the new dedicated finder when the constrain_group_project_templates feature flag is enabled.
Background
The current template retrieval path uses GroupsFinder which generates expensive queries. A new dedicated finder is being created to address this (see sibling issue in parent epic). This issue covers integrating that new finder into the existing code path behind the constrain_group_project_templates feature flag so the change can be rolled out incrementally.
See the investigation in #296815 (closed) (now closed as won't fix) and the feature flag rollout issue #586332 for full context.
Proposal
- When
constrain_group_project_templatesis enabled:- Use the new dedicated finder to retrieve templates scoped to the relevant group
- Return project-level paginated results to the UI
- When
constrain_group_project_templatesis disabled:- Preserve the existing behavior as a fallback
Acceptance criteria
- Template retrieval logic is updated to use the new finder when the feature flag is enabled
- Existing behavior is preserved when the feature flag is disabled
- API responses return project-level paginated results under the new code path
- Integration specs cover both feature flag states
- No performance regressions (validated with query analysis)
Edited by 🤖 GitLab Bot 🤖