Refactor archived scopes to use ancestor-aware queries
What does this MR do and why?
Replace direct archived and non_archived scope implementations with
their ancestor-aware counterparts self_or_ancestors_archived and
self_and_ancestors_non_archived. This ensures that when a group is
archived, all of its descendant groups are correctly treated as
archived, maintaining proper hierarchical archive state inheritance.
References
Query plans
Since we're changing the scopes, many queries will be affected; therefore, we're using a feature flag. Here are a few query plans:
How to set up and validate locally
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.
Related to #579246
Edited by Abdul Wadood