Shopify / Shopify/identity_cache
Prevent cache_belongs_to from being used with a has_one association
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2k
- Forks
- 174
- Avg merge
- 13m
- Merged PRs (30d)
- 3
Description
I noticed in https://github.com/Shopify/identity_cache/pull/360#discussion_r153844042 that this can happen without an exception. There are assumptions in cache_belongs_to that I think would lead to inefficient queries and cache corruption.
Contributor guide
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
Start by reviewing the cache_belongs_to implementation and the referenced discussion in pull request #360. Trace how a has_one association is currently accepted, then verify that such use is prevented and that valid cache_belongs_to behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100