Skip to content

feat: admin audit log#78

Merged
eclectic-coding merged 8 commits into
mainfrom
feat/admin-audit-log
May 28, 2026
Merged

feat: admin audit log#78
eclectic-coding merged 8 commits into
mainfrom
feat/admin-audit-log

Conversation

@eclectic-coding
Copy link
Copy Markdown
Owner

Summary

  • Adds solid_queue_web_audit_events table via opt-in install generator (rails generate solid_queue_web:install:migrations)
  • Records every discard, retry, queue pause, and resume with action, actor, job class, queue name, and item count
  • Actor identity captured via the optional SolidQueueWeb.current_actor config block (evaluated in controller context)
  • GET /jobs/audit — paginated audit log with action/actor/queue filters, clickable actor/queue links, and CSV export
  • "Audit" link added to the main nav
  • Audit events seeded in the dummy app dev database

Audited actions

Action Trigger
job_discarded Single job discarded from the jobs list
jobs_discarded Bulk or selection discard
failed_job_retried Single failed job retried
failed_jobs_retried Bulk or selection retry
failed_job_discarded Single failed job discarded
failed_jobs_discarded Bulk or selection discard of failed jobs
queue_paused Queue paused
queue_resumed Queue resumed

Test plan

  • 15 request specs for AuditController (empty state, row rendering, action/actor/queue filters, clear link, invalid filter ignored, CSV, auth)
  • 12 request specs for audit recording across all action controllers (single vs. bulk, correct action names, actor stored from current_actor block, nil actor when unconfigured)
  • Full suite green: 382 examples, 0 failures

Closes #63

🤖 Generated with Claude Code

eclectic-coding and others added 8 commits May 28, 2026 06:47
- Add engine migration and install generator (rails solid_queue_web:install:migrations)
- Add SolidQueueWeb::AuditEvent model with validations
- Add SolidQueueWeb.current_actor config block for identity resolution
- Add record_audit/resolve_current_actor helpers to ApplicationController
- Add solid_queue_web_audit_events table to dummy app schema

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Log audit events after successful: job_discarded, jobs_discarded,
failed_job_retried, failed_jobs_retried, failed_job_discarded,
failed_jobs_discarded, queue_paused, queue_resumed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- GET /jobs/audit — paginated audit log with action/actor/queue filters
- CSV export via audit.csv
- "Audit" link added to main nav
- Clicking actor or queue name filters the log

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- 25 request specs for AuditController (filters, CSV, auth)
- 12 request specs for audit recording across all action controllers
- Fix single vs. bulk action name to key off params[:id] presence

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Clear and reseed solid_queue_web_audit_events with 12 realistic entries
spanning all action types, multiple actors, queues, and bulk counts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Follows the same before_action + private scope method pattern as JobsController.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@eclectic-coding eclectic-coding merged commit 93dc17b into main May 28, 2026
5 checks passed
@eclectic-coding eclectic-coding deleted the feat/admin-audit-log branch May 28, 2026 11:04
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

❌ Patch coverage is 69.33333% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.22%. Comparing base (309aaf2) to head (f6a6376).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...rs/solid_queue_web/install/migrations_generator.rb 0.00% 20 Missing ⚠️
...trollers/solid_queue_web/application_controller.rb 62.50% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##              main      #78      +/-   ##
===========================================
- Coverage   100.00%   97.22%   -2.78%     
===========================================
  Files           34       37       +3     
  Lines          755      830      +75     
===========================================
+ Hits           755      807      +52     
- Misses           0       23      +23     
Files with missing lines Coverage Δ
...pp/controllers/solid_queue_web/audit_controller.rb 100.00% <100.00%> (ø)
...lid_queue_web/failed_jobs/selections_controller.rb 100.00% <100.00%> (ø)
...trollers/solid_queue_web/failed_jobs_controller.rb 100.00% <100.00%> (ø)
...lers/solid_queue_web/jobs/selections_controller.rb 100.00% <100.00%> (ø)
app/controllers/solid_queue_web/jobs_controller.rb 100.00% <100.00%> (ø)
...ollers/solid_queue_web/queues/pauses_controller.rb 100.00% <100.00%> (ø)
...rs/solid_queue_web/retry_failed_jobs_controller.rb 100.00% <100.00%> (ø)
app/models/solid_queue_web/audit_event.rb 100.00% <100.00%> (ø)
lib/solid_queue_web.rb 100.00% <100.00%> (ø)
...trollers/solid_queue_web/application_controller.rb 90.32% <62.50%> (-9.68%) ⬇️
... and 1 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

feat: admin audit log

1 participant