Record game merge actions in the admin activity log #8

Open
opened 2024-01-14 14:16:57 -06:00 by jimmyb · 0 comments
Owner

Game de-duplication merges should create a durable admin activity log entry so staff can audit who merged which games and what related records were moved.

The current Laravel checkout already has an admin Merge Games tool, a Spatie activity_log table, admin dashboard event-log rendering, and Admin\GameController::storeMerge() currently writes an admin activity entry with event merged. This issue tracks verifying that behavior, tightening the logged metadata where needed, and adding regression coverage so future changes do not silently drop merge audit logs.

Scope

  • Admin Merge Games form and POST /admin/games/merge flow.
  • Spatie activity log entries with log_name = admin.
  • Merge metadata for source game, target game, actor, event type, and updated reference counts.
  • Admin dashboard event-log rendering for merge activity.
  • Validation and failure paths where no merge should be logged.

Acceptance Criteria

  • A successful game merge writes exactly one admin activity log entry.
  • The log entry is caused by the signed-in admin who performed the merge.
  • The log entry is performed on the canonical target game.
  • The log entry uses a clear merge event such as merged.
  • The log entry description identifies the source and target games in a human-readable way.
  • The log entry properties include source game ID, target game ID, and updated reference counts.
  • The admin dashboard event log can display the merge activity without errors.
  • Invalid merge attempts do not create misleading admin log entries.
  • Failed transactions do not leave behind successful-looking admin log entries.
  • Existing merge behavior still moves references and soft-deletes the duplicate source game as expected.

Test Coverage Required

  • Feature test confirming an authorized admin can merge games and an admin activity log entry is created.
  • Test confirming the activity log entry has the expected actor, subject, event, description, source/target IDs, and updated-count properties.
  • Regression test confirming the merge entry appears on the admin dashboard event log.
  • Validation tests confirming same-game, missing-game, and older/newer ID rule failures do not create admin merge logs.
  • Authorization tests confirming guests and unauthorized users cannot invoke the merge route or create merge logs.
  • Regression tests confirming reference tables are still moved to the target game and the source game is soft-deleted.
  • Tests should use Pest and focused feature coverage.
  • Run the focused affected tests, then run vendor/bin/pint --dirty before closing the issue.

Progress Checklist

  • Admin activity log table exists
  • Admin dashboard renders recent activity log entries
  • Admin Merge Games route and form exist
  • Merge flow moves related game references
  • Merge flow soft-deletes the duplicate source game
  • Merge flow currently writes an admin activity entry with event merged
  • Confirm merge log metadata is complete and stable
  • Confirm failed or invalid merge attempts do not create admin logs
  • Add tests for merge log creation and metadata
  • Add tests for merge log dashboard rendering
  • Add tests for merge authorization and validation failure paths
  • Confirm merge audit logging remains consistent with other admin game actions
Game de-duplication merges should create a durable admin activity log entry so staff can audit who merged which games and what related records were moved. The current Laravel checkout already has an admin Merge Games tool, a Spatie `activity_log` table, admin dashboard event-log rendering, and `Admin\GameController::storeMerge()` currently writes an `admin` activity entry with event `merged`. This issue tracks verifying that behavior, tightening the logged metadata where needed, and adding regression coverage so future changes do not silently drop merge audit logs. ## Scope - Admin Merge Games form and `POST /admin/games/merge` flow. - Spatie activity log entries with `log_name = admin`. - Merge metadata for source game, target game, actor, event type, and updated reference counts. - Admin dashboard event-log rendering for merge activity. - Validation and failure paths where no merge should be logged. ## Acceptance Criteria - A successful game merge writes exactly one admin activity log entry. - The log entry is caused by the signed-in admin who performed the merge. - The log entry is performed on the canonical target game. - The log entry uses a clear merge event such as `merged`. - The log entry description identifies the source and target games in a human-readable way. - The log entry properties include source game ID, target game ID, and updated reference counts. - The admin dashboard event log can display the merge activity without errors. - Invalid merge attempts do not create misleading admin log entries. - Failed transactions do not leave behind successful-looking admin log entries. - Existing merge behavior still moves references and soft-deletes the duplicate source game as expected. ## Test Coverage Required - Feature test confirming an authorized admin can merge games and an `admin` activity log entry is created. - Test confirming the activity log entry has the expected actor, subject, event, description, source/target IDs, and updated-count properties. - Regression test confirming the merge entry appears on the admin dashboard event log. - Validation tests confirming same-game, missing-game, and older/newer ID rule failures do not create admin merge logs. - Authorization tests confirming guests and unauthorized users cannot invoke the merge route or create merge logs. - Regression tests confirming reference tables are still moved to the target game and the source game is soft-deleted. - Tests should use Pest and focused feature coverage. - Run the focused affected tests, then run `vendor/bin/pint --dirty` before closing the issue. ## Progress Checklist - [x] Admin activity log table exists - [x] Admin dashboard renders recent activity log entries - [x] Admin Merge Games route and form exist - [x] Merge flow moves related game references - [x] Merge flow soft-deletes the duplicate source game - [x] Merge flow currently writes an `admin` activity entry with event `merged` - [ ] Confirm merge log metadata is complete and stable - [ ] Confirm failed or invalid merge attempts do not create admin logs - [ ] Add tests for merge log creation and metadata - [ ] Add tests for merge log dashboard rendering - [ ] Add tests for merge authorization and validation failure paths - [ ] Confirm merge audit logging remains consistent with other admin game actions
Codex changed title from Add Admin Log Entry When Game is De-Duplicated to Record game merge actions in the admin activity log 2026-05-26 00:08:16 -05:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MyVideoGameList/myvideogamelist.com#8
No description provided.