IdentityCache compiler generates wrong return types for `fetch_multi_n_by_m` fields
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 873
- Forks
- 164
- Avg merge
- 4d 27m
- Merged PRs (30d)
- 9
Description
Description
After implementing the missing fetch_multi_n_by_m methods in https://github.com/Shopify/tapioca/pull/1758 I have found out that the method signature isn't always correct as shown in this example from cache_attribute: https://github.com/Shopify/identity_cache/blob/main/lib/identity_cache/cached/attribute.rb#L82-L101
The result of methods that include by in the name is a hash where:
- Key: type
m(be it a single value or an array of multiple) - Value: type
norT::Array[n]depending on things like ifuniquehas been passed tocache_attribute.
So at present when the return type is T::Array[n], it would be expected that it is actually T::Hash[T.untyped, n] or T::Hash[T.untyped, T::Array[n]] based on how it was created.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect the linked IdentityCache entry point, lib/identity_cache/cached/attribute.rb around lines 82-101, and the fetch_multi_n_by_m method generation from PR #1758. Compare generated signatures with the cache_attribute unique behavior; done means the return type uses the appropriate hash key type and n or T::Array[n] value type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100