Skip to content

v2.1.0: configurable base controller + chart timezone#39

Merged
vishaltps merged 1 commit into
mainfrom
feature/v2.1-auth-and-tz
May 14, 2026
Merged

v2.1.0: configurable base controller + chart timezone#39
vishaltps merged 1 commit into
mainfrom
feature/v2.1-auth-and-tz

Conversation

@vishaltps
Copy link
Copy Markdown
Owner

Summary

  • New SolidQueueMonitor.base_controller_class config lets host apps plug the dashboard into their existing auth chain (Devise, Pundit, OmniAuth, custom sessions) instead of being stuck on HTTP Basic.
  • Engine helpers (render_chart, etc.) wired explicitly via helper Engine.helpers so they keep working when the parent is not ActionController::Base.
  • Chart timezone behaviour (already correct via Time.current since v2.0) now pinned by specs running in America/Los_Angeles.

Problem

Single biggest adoption blocker reported after v2.0.0: the engine's ApplicationController hardcoded ActionController::Base, so teams with Devise/Pundit/etc. had no clean integration point. Their workaround was monkey-patching SolidQueueMonitor::ApplicationController via to_prepare — fragile and breaks on gem upgrade.

Solution

  • lib/solid_queue_monitor.rb: top-level base_controller_class accessor (default "ActionController::Base"). Top-level rather than inside setup do |config| because it's a class-loading concern, not a runtime preference — same pattern as Mission Control: Jobs.
  • app/controllers/solid_queue_monitor/application_controller.rb: inherits via SolidQueueMonitor.base_controller_class.safe_constantize || ActionController::Base. safe_constantize keeps boot resilient against typos / dev-mode autoload edge cases.
  • Same controller now does helper SolidQueueMonitor::Engine.helpers so view methods like render_chart keep resolving regardless of parent class.

Changes

  • lib/solid_queue_monitor.rb — add base_controller_class accessor + DEFAULT_BASE_CONTROLLER_CLASS constant.
  • app/controllers/solid_queue_monitor/application_controller.rb — dynamic parent + explicit engine-helper inclusion.
  • spec/lib/solid_queue_monitor_spec.rb (new) — accessor coverage, parent-class resolution, and a regression guard that asserts engine helpers stay wired.
  • spec/services/solid_queue_monitor/chart_data_service_spec.rb — new context running in America/Los_Angeles with a frozen UTC time, asserting labels render in PT not UTC.
  • README.md — new "Custom Authentication" subsection (minimal + role-gated examples), commented base_controller_class line in the main config block.
  • CHANGELOG.md[2.1.0] - 2026-05-13 entry.
  • lib/solid_queue_monitor/version.rb2.0.02.1.0.

Testing

  • bundle exec rspec — 326 examples, 0 failures (was 315 in v2.0.0; +11 new).
  • bundle exec rubocop — 73 files, no offenses.
  • Manual test in solid_queue_test host app:
    • default behaviour (HTTP Basic) unchanged
    • custom AdminController with before_action correctly gates the dashboard
    • engine helpers (render_chart, etc.) resolve under the custom parent

Checklist

  • Default behaviour byte-identical to v2.0.0 — both features opt-in / non-breaking
  • CSP compatibility preserved (no new inline handlers or style= attrs)
  • CHANGELOG entry under [2.1.0]
  • Version bumped
  • Self-review completed

Add SolidQueueMonitor.base_controller_class so host apps can plug the
dashboard into their existing auth chain (Devise, Pundit, OmniAuth,
custom sessions, etc.) instead of being limited to HTTP Basic. Default
is "ActionController::Base", so existing setups behave identically.

Engine helpers are wired explicitly via `helper Engine.helpers` so view
methods like render_chart keep working when the parent is not
ActionController::Base.

Chart timezone behavior (already correct via Time.current end-to-end
since v2.0) is now pinned by specs running in America/Los_Angeles.

Bumps version to 2.1.0.
@vishaltps vishaltps merged commit bba4d63 into main May 14, 2026
3 checks passed
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