Repository navigation
feat(devise): Add types for controller helpers - #1079
Merged
Merged
Conversation
Devise includes Devise::Controllers::Helpers (with SignInOut and StoreLocation) into every controller via ActiveSupport.on_load(:action_controller), but the collection declared none of it, so sign_in, sign_out, store-location helpers, after_sign_in_path_for, devise_parameter_sanitizer and devise_group were unknown on ActionController::Base and ActionController::API. Declare the three modules, Helpers::ClassMethods, ParameterSanitizer and MissingWarden, and include/extend them into ActionController::Base and ActionController::API. Per-mapping generated helpers (current_user, authenticate_user!, ...) and the UrlHelpers proxies are not covered. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhUSLUimEYJyCZv8NdQGKb
apiology
marked this pull request as ready for review
October 9, 2026 14:12
|
@apiology Thanks for your contribution! Please follow the instructions below for each change. Available commandsYou can use the following commands by commenting on this PR.
|
Contributor
Author
|
/merge |
apiology
added a commit
to iftheshoefritz/solargraph-rails
that referenced
this pull request
Oct 9, 2026
* Bump gem_rbs_collection to c78df6c for devise helpers ruby/gem_rbs_collection#1079 added devise's controller helpers (sign_in, sign_out, signed_in?, after_sign_in_path_for, ...), so the 19 devise entries in actioncontroller.yml now resolve to typed returns on Solargraph 0.57.0 and later instead of being skipped. 0.51.2 and 0.52.0 still do not see them. Other collection updates between ed61b16 and c78df6c changed 6 types: - polymorphic_path, polymorphic_url, render_to_string: String (actionpack actiondispatch.rbs, actioncontroller.rbs) - Rails::Application#configure: void (railties.rbs) - ActiveRecord::Base.create/create!: Array<self> | self, from the activerecord 7.2/8.0 array-argument overloads 0.48.0-0.52.0 do not resolve the new actionpack and railties types and are skipped. The activerecord 7.0/7.1 collection files lack the array overload, so create/create! resolved self on Rails 7.0/7.1 and Array<self> | self on 7.2/8.0 under the same Solargraph version, which version-keyed skips cannot express. Rails returns an Array from create/create! when given an Array of attribute hashes on every supported version, so annotate ActiveRecord::Base.create/create! with that return type; every cell now resolves Array<self> | self and the skips are removed. The create/create! types were hand-edited from [self] to [Array<self>, self]: FORCE_UPDATE only rewrites entries typed undefined, Object or BasicObject, and adds a skip for any other mismatch. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhUSLUimEYJyCZv8NdQGKb * Key the dot-cache on the RBS collection config Solargraph 0.57, 0.58 and 0.60.4 rebuild a gem's pins only when gems/<gem>.ser is missing. The key hashed only the Gemfile.lock files, so bumping the gem_rbs_collection revision restored pins built against the old revision and the new types were silently missing. Hashing spec/**/rbs_collection.yaml into every key tier makes each collection bump start a fresh cache without a manual prefix change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhUSLUimEYJyCZv8NdQGKb --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Claude: This PR was written by Claude Code on behalf of @apiology.
In a Rails app, Devise mixes
Devise::Controllers::Helpersinto every controller, but the devise RBS doesn't declare it, so type checkers rejectsign_in,sign_out,after_sign_in_path_for,devise_parameter_sanitizer,devise_group, etc.:This adds
Devise::Controllers::Helpers,SignInOut,StoreLocation,Helpers::ClassMethodsandDevise::ParameterSanitizer, and includes them intoActionController::BaseandActionController::API, matching devise'sActiveSupport.on_load(:action_controller)hook.Per-mapping helpers generated at runtime (
current_user,authenticate_user!, …) and theUrlHelpersroute proxies are not covered.