Skip to content

feat: Move user-import, token, and event cleanup to housekeeping - #544

Merged
hellopablo merged 3 commits into
developfrom
feat/housekeeping-routines
Sep 15, 2026
Merged

hellopablo merged 3 commits into
developfrom
feat/housekeeping-routines

Conversation

@hellopablo

@hellopablo hellopablo commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Nails\Auth\Housekeeping\UserImports keeps the three-step import cleaner (release stale claims, reap drafts, rotate finished jobs) with item-level audit logs and dry-run. auth:user:import:process is untouched.
  • Nails\Auth\Housekeeping\AccessTokens deletes expired API access tokens (@daily). Logs id, user_id, expires — not the token secret.
  • Nails\Auth\Housekeeping\TwoFactorTokens deletes expired legacy 2FA rows from user_auth_two_factor_token (*/15 * * * *). Logs id, user_id, expires — not token / salt.
  • Nails\Auth\Housekeeping\UserEvents deletes user_event rows older than AUTH_USER_EVENT_RETENTION_DAYS. Unset or 0 disables deletion (no module default). Runs @daily.
  • Access tokens, legacy 2FA tokens, and user events had no scheduled cleaner before.
  • Removes auth:user:import:clean (cron task and console command). Run on demand with housekeeping:run --routine=….
  • Requires nails/module-housekeeping: dev-develop.

Test plan

  • composer analyse / composer test
  • nails housekeeping:list shows UserImports, AccessTokens, TwoFactorTokens, UserEvents
  • Dry-run UserImports: RELEASE / DELETE lines, no writes
  • Dry-run the new reapers; confirm token secrets are not logged
  • With no AUTH_USER_EVENT_RETENTION_DAYS, UserEvents logs DISABLED and processes 0
  • nails auth:user:import:clean is gone

hellopablo and others added 3 commits September 15, 2026 16:06
Preserve import reap semantics with item-level logs, add reapers for expired access and legacy 2FA tokens, and rotate user events after 730 days (0 disables it).

Co-authored-by: Cursor <cursoragent@cursor.com>
Cron was the only caller, and that task is already gone. Run Nails\Auth\Housekeeping\UserImports through housekeeping:run.

Co-authored-by: Cursor <cursoragent@cursor.com>
AUTH_USER_EVENT_RETENTION_DAYS is off unless the app sets it. A two-year window is an app policy, not a module default.

Co-authored-by: Cursor <cursoragent@cursor.com>
@hellopablo
hellopablo merged commit d637078 into develop Sep 15, 2026
5 checks passed
@hellopablo
hellopablo deleted the feat/housekeeping-routines branch September 15, 2026 15:51
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.

1 participant