Problem/Motivation

When a Drupal user is deleted, their AI usage history stays behind. There is no hook_user_cancel or hook_user_delete, so rows keyed by uid in ai_metering_usage and ai_metering_quota are orphaned and retained indefinitely - a GDPR right-to-erasure gap for a module aimed at enterprise governance.

Proposed Resolution

Implement hook_user_cancel and hook_ENTITY_TYPE_delete() for users to delete that user's rows from both tables. Add a kernel test asserting the rows are gone after the user is removed.

AI Assistance

Yes, AI was used to explore the issue.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

marcus_johansson created an issue. See original summary.

codeitwisely made their first commit to this issue’s fork.

  • 6ec554dc committed on 1.0.x
    Issue #3608700 by codeitwisely, marcus_johansson: Purge usage data on...
codeitwisely’s picture

Assigned: Unassigned » codeitwisely
Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.