-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete users that haven't logged in for too long #647
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #647 +/- ##
======================================
Coverage ? 53.80%
======================================
Files ? 157
Lines ? 6644
Branches ? 0
======================================
Hits ? 3575
Misses ? 3069
Partials ? 0 ☔ View full report in Codecov by Sentry. |
This is to ensure that local changes in the `app` folder are reflected in the Docker container such that newly written tests can be run through without having to rebuild the whole Docker image.
… tests" This reverts commit b3f3ec8.
fosterfarrell9
approved these changes
Aug 13, 2024
This was referenced Aug 13, 2024
Closed
Closed
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #410.
Description
UserCleaner
class. Please complain if they don't explain some concepts that are actually implemented!Changes
UserCleaner
class (with unit tests).UserCleaner
is entirely deleted.ghost_hash
for users. Add newdeletion_date
field for users.config/initializers/after_sign_in.rb
No mail bounce detection anymore
What about mail bounce detection? Sadly enough, detecting mail bounces is a non-trivial problem. Parsing the body of mails is not robust enough as texts like "Mail could not be sent" are not standardized. There exists a good strategy called Variable envelope return path (VERP) which sounds very promising. However, we might ask ourselves if it's worth the effort to implement this in light of the benefits we get.
Yes, a mail server of a user might be down for some time. But how likely is it that a user hasn't logged in to MaMpf for at least 6 months, then their mail server is down when we send the warning deletion mail 40 days, 14 days, 7 days AND 2 days before actual deletion? Considering how unlikely this event is, I think we can invest our time better instead of implementing a bounce detection algorithm that has to log in to our own IMAP server to retrieve all emails. It's also a lot less pain to maintain the UserCleaner without such a brittle component.
TODO
Reviewers
The best place to start the review is probably the specs file for the UserCleaner.
Caution
The code presented here might have very destructive consequences if something goes wrong. In the worst case scenario, it will delete active users that we didn't intend to delete. Unit tests should cover these cases but please be extremely vigilant with this PR and take extra steps and time to make sure the unit tests cover all edge cases and actually reflect semantically-wise what we want to happen.
Tip
If tests don't work locally, you might have to run the migrations in the test docker container first.
That is:
cd ./docker/test
,docker compose up -d
,docker compose exec mampf bash
,rake db:migrate
.Tip
In the
Files changed
tab on GitHub, you can mark files as done to get a better overview of what you've already reviewed. Every single line of code here should be looked through.Before merge
MAX_DELETIONS_PER_RUN
env variable in production/dev/experimentalPRODUCTION_NAME=${PROJECTNAME}
fordocker compose up -d
in redeploy scripts for production/dev/experimental