Skip to content

Code-review followups: restore PR #10 commit + harden inactive_message#11

Merged
Fivell merged 2 commits into
mainfrom
review-followups
Jun 2, 2026
Merged

Code-review followups: restore PR #10 commit + harden inactive_message#11
Fivell merged 2 commits into
mainfrom
review-followups

Conversation

@Fivell
Copy link
Copy Markdown
Member

@Fivell Fivell commented Jun 2, 2026

Follow-ups surfaced by a code-review pass (regression, minimalism, bug, security agents).

Depends on #12 — that PR restores the orphaned OmniAuth.config.path_prefix view fix; some of the wins here (generator templates, spec hardcoded paths) sit on top of it.

What's in here

Generator templates still hardcode /admin/auth/oidc. PR #10 fixed the live view but the install generator was shipping the broken hardcoded path to every new project. Same OmniAuth.config.path_prefix substitution applied to both sessions_new.html.erb and sessions_new_v4.html.erb templates.

InactiveError collapsed when inactive_message was blank. A host's override that legitimately returns nil on some branch produced an empty key, which then rendered an empty flash. Default to :inactive inside the error's initializer so the user always sees a reason.

Raw inactive_message symbols leaked to the public flash. If the host returned :locked_by_admin and the translation was missing, the controller's default: e.inactive_message_key.to_s fallback rendered the raw symbol name. Fall back to I18n.t("devise.failure.inactive") instead.

Disabled-user spec consolidated. Repeated ActiveAdmin::Oidc.configure and build_auth_hash blocks collapsed into let helpers (disabling_hook, auth_hash) and a post_callback helper. Hardcoded paths replaced with new_admin_user_session_path and OmniAuth.config.path_prefix. Inline references to "Code-review followup" / "HIGH #2" stripped — those belong in PR descriptions, not source.

Regression spec for the retry leg + inactive winner. The review flagged it as a potential gap; turns out Devise's after_set_user callback catches it transparently. Spec documents the expected behaviour (redirect + no Warden session) so future refactors can't quietly regress it.

Findings declined

  • email_verified == false strict mode (require_verified_email_for_adoption flag) — no evidence of real IdPs shipping "false" strings; would add config surface for a defense-in-depth nice-to-have.
  • @retried ivar restructure — discussed with the minimalism agent; concluded the ivar with single raise/set/read is more local than the proposed rescue RetryProvisioning → find_existing! form.

Test plan

Fivell added 2 commits June 2, 2026 17:03
Follow-ups to PRs #9 and #10 surfaced by the code review.

- Apply the same OmniAuth.config.path_prefix substitution to both
  install-generator templates. New installs were still shipping the
  hardcoded path PR #10 fixed in the live view.
- Default the InactiveError key to :inactive when the model's
  inactive_message returns nil/blank. The empty key used to render
  an empty flash; now the user always sees a reason.
- Stop leaking custom inactive_message symbols. If the host returns
  a symbol like :locked_by_admin with no devise.failure translation,
  the raw symbol used to land in a public flash. Fall back to
  devise.failure.inactive instead.

The disabled-user request spec is consolidated via let helpers
(auth_hash, disabling_hook, post_callback) and now uses
new_admin_user_session_path / OmniAuth.config.path_prefix instead
of hardcoded URLs. Adds a regression spec for the retry leg + an
inactive winner row, documenting the expected redirect-and-no-
warden-session behaviour.
@Fivell Fivell force-pushed the review-followups branch from 8aa5c5c to f59384f Compare June 2, 2026 15:03
@Fivell Fivell merged commit ecfbc30 into main Jun 2, 2026
6 checks passed
@Fivell Fivell deleted the review-followups branch June 2, 2026 15:06
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