Skip to content

Replace omniauth_path_prefix_configured? with an adopt method - #24

Merged
senid231 merged 1 commit into
mainfrom
refactor/adopt-devise-omniauth-prefix
Oct 1, 2026
Merged

senid231 merged 1 commit into
mainfrom
refactor/adopt-devise-omniauth-prefix

Conversation

@senid231

@senid231 senid231 commented Oct 1, 2026

Copy link
Copy Markdown
Member

Follow-up to #21, before the 3.0.0 release.

omniauth_path_prefix_configured? was public, and the engine called it right before assigning omniauth_path_prefix. After boot it returned true for every host, including hosts that never set the prefix. This PR replaces it with adopt_devise_omniauth_path_prefix(prefix), which does the check and the assignment in one place. An explicit c.omniauth_path_prefix still wins.

Removing the predicate now is free, since it never shipped in a release. After 3.0.0, removing it would need another major version.

Verified with spec, spec:engine, spec:isolated and spec:root on the root Gemfile (Rails 7.2), and spec on activeadmin_4.0 (Rails 8.1). All pass.

The engine asked the predicate and then assigned the prefix, so the
predicate answered true for every host after boot. One method that
checks and assigns keeps the decision in Configuration and drops a
public method before 3.0.0 makes it permanent.

Co-Authored-By: Clanker
@senid231 senid231 mentioned this pull request Oct 1, 2026
@senid231
senid231 requested a balanced review from Copilot October 1, 2026 15:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The refactor preserves intended precedence while preventing the public predicate from exposing misleading post-boot state.

Review effort: Balanced
Findings: None

What changed in this PR

Replaces the misleading configuration predicate with an atomic method that adopts Devise’s host-defined OmniAuth prefix without overriding explicit configuration.

Changes:

  • Adds adopt_devise_omniauth_path_prefix.
  • Updates engine initialization to use the new method.
  • Tests adoption, explicit overrides, and absent Devise prefixes.
File Description
lib/​activeadmin/​oidc/​configuration.rb Implements prefix adoption.
lib/​activeadmin/​oidc/​engine.rb Delegates prefix synchronization to configuration.
spec/​unit/​configuration_spec.rb Covers the new behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@senid231
senid231 merged commit fbf7fe0 into main Oct 1, 2026
7 checks passed
@senid231
senid231 deleted the refactor/adopt-devise-omniauth-prefix branch October 1, 2026 15:23
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.

2 participants