Add annotation for pagy - #420
Merged
Merged
Conversation
`Pagy::Method#pagy` is built with `define_method` inside an anonymous module, so tapioca emits it without a signature. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
mokevnin
force-pushed
the
add-pagy-annotation
branch
from
September 6, 2026 16:53
b38468c to
7f8f0aa
Compare
KaanOzkan
approved these changes
Sep 9, 2026
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.
Type of Change
Changes
Annotates a single method,
Pagy::Method#pagy— the entry point usersincludeintotheir controllers/views.
It is defined with
define_methodinside an anonymousModule.new, so tapioca's runtimereflection picks up its arity and
protectedvisibility but emits no signature.paginatorisSymbol: it is used only as a key into the frozen paginator lookup hashin
method.rb, so anything else raises.collectionandoptionsareT.untyped: they are forwarded verbatim to whicheverpaginator is selected, and each accepts a different kind of collection (AR relation,
Array,
Pagy::Search::Arguments, …).T.untypedrather than a tuple, because it varies bypaginator:
[Pagy, records]for the offset/countless/countish/keyset family,[Pagy::Calendar, Pagy, records]for:calendar, and a barePagyobject for thesearch paginators in passive mode. A tuple type would be wrong for those callers, and
Sorbet cannot discriminate on the symbol literal to overload them apart. The comment
above the sig documents the three shapes instead.
bundle exec repo check --gem --ref origin/mainpasses locally (index, rubocop, rubygems,runtime, static).