Skip to content

LG-16204 Create Job to Track Deletion Workflow Drop-offs and Notify Users#12187

Merged
kevinsmaster5 merged 6 commits intomainfrom
kmas-lg-16204-create-expire-account-reset-request-job
May 21, 2025
Merged

LG-16204 Create Job to Track Deletion Workflow Drop-offs and Notify Users#12187
kevinsmaster5 merged 6 commits intomainfrom
kmas-lg-16204-create-expire-account-reset-request-job

Conversation

@kevinsmaster5
Copy link
Contributor

@kevinsmaster5 kevinsmaster5 commented May 16, 2025

🎫 Ticket

Link to the relevant ticket:
LG-16204

🛠 Summary of changes

Created a new worker job that looks for unexpired account deletion requests that have been created older than the account_reset_token_valid_for_days window and expires them logging the event.

📜 Testing Plan

Provide a checklist of steps to confirm the changes.

  • Create an account and at the MFA screen proceed to "select another method" then continue through the deletion process
  • In the rails console find the relevant AccountResetRequest entry and update its cancelled_at date so that it is older than the expected window for account_reset_token_valid_for_days configuration
  • Look at the watch_events and see that :account_reset_request_expired gets logged.
  • Review the AccountResetRequest entry and see that the request token and granted tokens are now nil

@kevinsmaster5 kevinsmaster5 marked this pull request as ready for review May 19, 2025 14:10
@Mawar2 Mawar2 self-requested a review May 19, 2025 19:57
@kevinsmaster5 kevinsmaster5 requested a review from a team May 19, 2025 20:52
Copy link
Contributor

@Mawar2 Mawar2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after testing. I created an account, went through the MFA setup, then started the account reset flow. I verified the job correctly expires reset requests by setting the cancelled_at timestamp and clearing both tokens. The analytics event is also being logged properly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the first few runs of this will be super expensive / lots of items. should we set up a limit to the query initially so that we dont have an issue with this job failing if the amount is too large. maybe limit to 1000 for now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a limit to that query

@kevinsmaster5 kevinsmaster5 force-pushed the kmas-lg-16204-create-expire-account-reset-request-job branch from d9a1063 to f799266 Compare May 21, 2025 13:38
@kevinsmaster5 kevinsmaster5 requested a review from mdiarra3 May 21, 2025 14:51
@kevinsmaster5 kevinsmaster5 merged commit cdd51a7 into main May 21, 2025
1 check passed
@kevinsmaster5 kevinsmaster5 deleted the kmas-lg-16204-create-expire-account-reset-request-job branch May 21, 2025 17:39
vrajmohan added a commit that referenced this pull request May 31, 2025
…Notify Users (#12187)"

This reverts commit cdd51a7.

changelog: Bug Fixes, Account Deletion, Revert job that expires AccountResetRequests

Requests were being cancelled a few minutes after
AccountResetRequest.granted_at instead of after at least 1 day.
See https://gsa-tts.slack.com/archives/C20J64X6V/p1748681101414939.
vrajmohan added a commit that referenced this pull request Jun 2, 2025
…Notify Users (#12187)" (#12224)

This reverts commit cdd51a7.

changelog: Bug Fixes, Account Deletion, Revert job that expires AccountResetRequests

Requests were being cancelled a few minutes after
AccountResetRequest.granted_at instead of after at least 1 day.
See https://gsa-tts.slack.com/archives/C20J64X6V/p1748681101414939.
solipet pushed a commit that referenced this pull request Jun 2, 2025
…Notify Users (#12187)" (#12224)

This reverts commit cdd51a7.

changelog: Bug Fixes, Account Deletion, Revert job that expires AccountResetRequests

Requests were being cancelled a few minutes after
AccountResetRequest.granted_at instead of after at least 1 day.
See https://gsa-tts.slack.com/archives/C20J64X6V/p1748681101414939.
solipet added a commit that referenced this pull request Jun 2, 2025
…Notify Users (#12187)" (#12224) (#12227)

This reverts commit cdd51a7.

changelog: Bug Fixes, Account Deletion, Revert job that expires AccountResetRequests

Requests were being cancelled a few minutes after
AccountResetRequest.granted_at instead of after at least 1 day.
See https://gsa-tts.slack.com/archives/C20J64X6V/p1748681101414939.

Co-authored-by: Vraj Mohan <vraj.mohan@gsa.gov>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants