Fix re-archiving projects and subgroups after group unarchive
What does this MR do and why?
When a group was unarchived, the unarchive_descendants! and
unarchive_all_projects! methods only updated namespace_settings.archived
and projects.archived columns but did not reset the namespaces.state
column. This left the state machine in an archived state, preventing
projects and subgroups from being re-archived later.
Update both methods to also reset namespaces.state to ancestor_inherited
for previously archived descendants and project namespaces.
Query plans
- https://console.postgres.ai/gitlab/gitlab-production-main/sessions/49394/commands/147383
- https://console.postgres.ai/gitlab/gitlab-production-main/sessions/49394/commands/147384
How to set up and validate locally
Follow these steps on the master branch, and the project archival should fail. On this branch, project archival should succeed after following these steps:
- Create a new group
- Create a project inside that group
- Archive the project
- Navigate to the group's Settings > General > Advanced
- Click "Archive" to archive the group
- Click "Unarchive" to unarchive the group
- Navigate to the project's Settings > General > Advanced
- Click "Archive" to archive the project
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 #590990 (closed)