Skip to content

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

Merged
hellopablo merged 3 commits into
feature/pre-new-adminfrom
feat/pre-new-admin-housekeeping-routines
Sep 16, 2026
Merged

hellopablo merged 3 commits into
feature/pre-new-adminfrom
feat/pre-new-admin-housekeeping-routines

Conversation

@hellopablo

Copy link
Copy Markdown
Member

Summary

  • Cherry-pick of feat: Move user-import, token, and event cleanup to housekeeping #544 onto feature/pre-new-admin.
  • 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-feature/pre-new-admin.

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

Made with Cursor

hellopablo and others added 3 commits September 15, 2026 17:13
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>
(cherry picked from commit 33b1e2c)
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>
(cherry picked from commit 948da26)
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>
(cherry picked from commit b6b4ead)
@hellopablo
hellopablo merged commit c544747 into feature/pre-new-admin Sep 16, 2026
5 checks passed
@hellopablo
hellopablo deleted the feat/pre-new-admin-housekeeping-routines branch September 16, 2026 08:09
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