Dashboard cruft cleanup
Daily cron that prunes stale index-only dashboard rows for users inactive ≥ 1 year. Complements lazy me() eviction for active users and one-off ops scripts (prune-stale-recent-completed, purge-usergame-orphans).
Schedule
| Handler | src/functions/dashboard-cruft-cleanup.ts |
| Schedule | Daily 03:00 UTC (prod only) |
| Timeout / memory | 900 s / 1024 MB |
| Layer | No |
What it cleans
For each eligible user (live confirm after S3 dump candidate scan):
| Partition | Action |
|---|---|
RECENTCOMPLETED# |
Delete rows not dashboard-eligible (merged USERGAME# overlays) |
USERGAME# |
Delete overlays for pruned recent rows and orphan overlays not on CURRENTGAMES# ∪ eligible RECENTCOMPLETED# |
Does not touch USER.lastSeen, USERS.lastSeen, or legacy USER.games[] (retired in Phase 5).
Candidate discovery (no DynamoDB scan)
- List
abstractplay-db-dumpand pick the latestmanifest-summary.jsonexport uid (same pattern as Records pipeline). - Stream ION
USERitems from that export. - Collect
sk(user id) whenlastSeen < now - 1yandcleaned != true.
Dump may be up to ~24h stale; each candidate is re-validated with live GetItem before cleanup.
Live processing
For up to DASHBOARD_CRUFT_BATCH_SIZE candidates (default 75):
GetItemUSER— skip if active since dump, alreadycleaned, or missing.- Skip bots (
GetItemBOT). - Run
cleanupUserDashboardCruft(Query + Delete only). - If cruft was removed,
SET cleaned = trueonUSER(notUSERS).
me() in node-backend clears cleaned on login so a future long absence can be cleaned again.
Environment
| Variable | Default | Purpose |
|---|---|---|
ABSTRACT_PLAY_TABLE |
abstract-play-{stage} |
DynamoDB table |
DASHBOARD_CRUFT_BATCH_SIZE |
75 |
Max users processed per run |
ABANDONED_ACCOUNT_INACTIVE_MS |
31536000000 (365 days) |
Inactivity threshold |
Manual invoke
serverless invoke -f dashboard-cruft-cleanup --stage prod
Use prod with care — this deletes dashboard index rows for inactive users.
Related
- Live crons — other live DynamoDB mutators
- Backend database schema —
USER.cleaned - node-backend
lib/dashboardCruftCleanup.ts— shared cleanup logic (keep in sync)