Inactive Project Deletion - disabling feature does not reset scheduled deletion dates
Summary
- Inactive project deletion is a feature that will automatically prune projects once they pass an inactivity interval threshold.
- An administrative user can deactivate this feature, however this does not clear the
scheduled_deletion_date
attribute on projects that have had the attribute set - This means if the administrative user later re-enables this feature, the past calculated
scheduled_deletion_date
will be reused (and not recalculated based on the date that Inactive Project Deletion is re-enabled).
Steps to reproduce
- Enable Inactive Project Deletion on a self-managed instance
- After projects are marked for deletion, disable the feature
- After some time (at least 1 day, or manually change the system date) re-enable the feature
- Visit a project that was previously marked for deletion and observe the displayed banner (or inspect the project in the Rails console)
Example Project
What is the current bug behavior?
- Scheduled inactive project deletion dates are not reset when the Inactive Project Deletion feature is disabled
- If the feature is later re-enabled, the previously calculated deletion dates will be used (rather than being recalculated based on the date that the feature was re-enabled)
What is the expected correct behavior?
- When the Inactive Project Deletion feature is re-enabled, the scheduled deletion dates should be based on the re-enablement date
- A new mail notification should be sent, as the documentation states:
The project is scheduled for deletion 1 month (12 months - 11 months) after warning email.
Relevant logs and/or screenshots
- The feature was initially enabled on
2024-03-28
, and then disabled. - These screenshots was taken earlier today (
2024-04-08
):
Interestingly, while show_inactive_project_deletion_banner
is true
, the project is also not marked for deletion (this is likely due to the project attribute inactive
still being set to true
):
Results of GitLab environment info
Screenshots captured on 16.6.4
(Customer support ticket).
Possible fixes
Currently, we're refreshing the value only when there are changes to inactive_projects_delete_after_months
column, but we should consider delete_inactive_projects
as well.
It could be done, by adding a new callback to app/models/application_setting.rb
, such as:
after_commit :reset_deletion_warning_redis_key, if: -> { delete_inactive_projects_changed?(from: true, to: false) }
Edited by Christina Lohr