Conversation
The codebar OmniAuth strategy's callback_phase called fail! then bare returned, discarding the failure response omniauth builds for provider-side error redirects. The middleware returned nil, and Rack's TempfileReaper raised "undefined method '[]=' for nil" when handling the response, so any provider error redirect (invalid scope, PKCE required, state mismatch) surfaced as a 500 instead of the /auth/failure redirect. Return the fail! response from the error branch, and in the rescue path re-raise app errors after successful auth while returning on_failure's response for auth failures.
Puma's Capybara test server sets ENV['RACK_ENV'] ||= 'development' the first time a feature spec boots it in-process. Omniauth's FailureEndpoint then raises instead of redirecting for the rest of that rspec process, so specs exercising omniauth failure paths behave differently depending on whether a feature spec ran before them — the new omniauth request spec failed on CI for exactly this reason. Pin failure_raise_out_environments to empty in the test environment so omniauth failure handling stays deterministic regardless of when Puma mutates the process env.
mroderick
marked this pull request as ready for review
September 22, 2026 14:31
olleolleolle
approved these changes
Sep 22, 2026
olleolleolle
left a comment
Collaborator
There was a problem hiding this comment.
Looks like a good idea! The specs read well.
This branch has not been deployed
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.
Provider error redirects from the auth app (invalid scope, PKCE required, state mismatch) reached the planner as a 500 (
NoMethodError: undefined method '[]=' for nil, Rollbar item 714) instead of the intended redirect to/auth/failure.Change
fail!incallback_phase's error branch instead of discarding it with a barereturn. The discarded response left the OmniAuth middleware returning nil, which Rack'sTempfileReaperthen crashed on.on_failure's response for auth failures./auth/failurerather than raise.Review notes
/auth/failure→ flash + root); only the crash path is fixed.CI failure follow-up
The first CI run failed one of the new specs. Cause: Capybara's Puma test server sets
ENV['RACK_ENV'] ||= 'development'when a feature spec boots it mid-process, and omniauth'sFailureEndpointraises (instead of redirecting) wheneverRACK_ENVisdevelopment. Specs running after a feature spec therefore saw raise-out behaviour. Fixed by pinningOmniAuth.config.failure_raise_out_environments = []in the test environment, so failure handling is deterministic regardless of spec order.