Preserve gamer history and optimize recent activity reads #962
No reviewers
Labels
No labels
automated
code-quality
component: admin dashboard
component: backend
component: billing
component: content management
component: faqs
component: game genres
component: game lists
component: game reviews
component: game search
component: games
component: internal notifications
component: platforms
component: security
component: tests
component: user api
component: user badges
component: user blogs
component: user consoles
component: user favorites
component: user friends
component: user notifications
component: user profiles
component: user site notifications
component: user wishlists
component: web design
dependencies
javascript
php
priority
high
priority
low
priority
medium
security-hotspot
source: codex
source: sonarqube
status
awaiting feedback
status
backlog
status
done
status
in progress
status
in queue
status
in review
status
needs codex review
status
needs investigation
status
wontfix
type: bug
type: documentation
type: feature
type: improvement
type: regression
type: task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MyVideoGameList/myvideogamelist.com!962
Loading…
Reference in a new issue
No description provided.
Delete branch "codex/issue-3-scalable-gamer-updates"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Preserve gamer update history and make recent feed reads use a composite index with stable newest-first ordering.
The dedicated feed remains a fixed list of the 50 newest visible entries; cards remain limited to 10. Admin activity shows the latest 15 admin actions. Spatie cleanup now preserves gamer updates, including explicitly targeted cleanup. Legacy activities without a subject still render; comment visibility uses indexed primary-key checks; the index migration safely tolerates repeated up/down calls.
Producer and consumer inventory
FavoriteWishlistActivity; registration; blog publication from controllers and profile settings; game, blog, and profile comments.SampleGamerUpdatesSeederproduces development fixtures. Review-published activity is supported by the renderer, but has no current producer; future producers must use the same log and preserve the existing property contract.RecentGamerUpdatessupplies the homepage, terms/privacy pages, game search, platform page, newly-added-games page, and dedicated feed page. Existing presentation, privacy, banned/deleted-user and comment-subject filters remain shared.admin; profile blog settings check existing publication activity to avoid duplicate events. Admin user editing has no activity-history query in the current Laravel implementation. Production data synchronization continues copying the unchangedactivity_logtable.adminactivities.The visibility check uses a correlated scalar count instead of an EXISTS semi-join. On the million-row fixture, MariaDB otherwise selected the old log-name index, read 950,000 entries, and filesorted the feed before applying LIMIT. The scalar check retains the same visibility result and allows ordered index reads. Comment-subject checks also use scalar counts to avoid materializing the entire comment history; regression coverage verifies live, soft-deleted and missing game/blog/profile comments.
Storage and rollout
Keep all historical gamer updates in
activity_log. Add(log_name, created_at, id)without changing existing records or indexes. No archive/backfill, ID reset, truncation, retention deletion, pagination, or new dependencies are required. Other log types retain their existing 365-day cleanup policy.Deploy requires running the new additive migration in a planned window after verifying index-build capacity and locking behavior on the live table. Production deployment has not been performed. Migration rollback drops only the added index and preserves history; reverting the cleanup configuration would restore the previous destructive gamer-update cleanup behavior.
Verification
ANALYZE FORMAT=JSONconfirmed the composite index, primary-key comment lookups and no filesort: 10-entry feed examined 65 activity/7 comment rows in 1.52 ms; 50-entry feed examined 312 activity/33 comment rows in 4.51 ms; admin query examined 15 activity rows in 0.25 ms. These are warmed server execution timings on synthetic data; initial PHP query timings including the SSH connection and cache warming were 1,396 ms / 166 ms / 60 ms respectively.de69e0902696977b0133752543df80510f566c62(quality run, test run). CI completed migrations, asset build, browser checks and PHP tests with no failures; Pest reported 763 warnings, 56 passed and 5,407 assertions. The existing warning output is retained here rather than described as a warning-free run.Fixes #3
88c78bb824405c6d45c4