luckyframework / luckyframework/avram
Preloads fail silently when given incorrect query
- Dominant language
- Crystal
- Stars
- 183
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
I gave a preload an incorrect query, in an ill-considered attempt to optimize:
```crystal
preload_locations(LocationQuery.new.preload_url_path(URLPathQuery.new.limit(1))
```
The `limit(1)` is incorrect, `preload_locations` will retrieve more than one object. The result was an object with `@_url_path_preloaded=true`, and `@_preloaded_url_path=nil`, and no complaint from the preload code.
Contributor guide
Research direction
Start by tracing preload_locations and how it handles a query with limit(1), using the example in this issue to reproduce the silent failure. Done means an incorrect preload query reports a complaint instead of producing a preloaded flag with a nil value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- crystal
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100