Replace omniauth_path_prefix_configured? with an adopt method - #24
Merged
Merged
Conversation
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
Merged
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #21, before the 3.0.0 release.
omniauth_path_prefix_configured?was public, and the engine called it right before assigningomniauth_path_prefix. After boot it returnedtruefor every host, including hosts that never set the prefix. This PR replaces it withadopt_devise_omniauth_path_prefix(prefix), which does the check and the assignment in one place. An explicitc.omniauth_path_prefixstill 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:isolatedandspec:rooton the root Gemfile (Rails 7.2), andspeconactiveadmin_4.0(Rails 8.1). All pass.