Skip to content

Add compatibility with strict_loading_by_default#375

Merged
rosa merged 1 commit into
rails:mainfrom
JoeDupuis:strict-loading-by-default-compatibility
Jul 22, 2026
Merged

Add compatibility with strict_loading_by_default#375
rosa merged 1 commit into
rails:mainfrom
JoeDupuis:strict-loading-by-default-compatibility

Conversation

@JoeDupuis

@JoeDupuis JoeDupuis commented Oct 7, 2024

Copy link
Copy Markdown
Contributor

Fixes #122

Allows the app to run in strict_loading_by_default mode by explicitly turning off strict loading on all Solid Queue models.

Also enables strict_loading_by_default on the dummy app to prevent strict loading issues from being introduced.

Alternative / strict_loading enabled

I tried to support strict_loading instead of turning it off, but after spending time on it, I don't think it's worth it. It is a little bit faster, but bring a bunch of complexity.
I opened a draft PR on my fork to demonstrate what it would look like: JoeDupuis#1
Even if we decide to go down the road of enabling strict_loading in Solid Queue, we should merge this PR first to unblock strict_loading apps while working on the fix.

@JoeDupuis JoeDupuis changed the title Add strict_loading_by_default by default compatibility Add compatibility with strict_loading_by_default by default Oct 8, 2024
@JoeDupuis JoeDupuis changed the title Add compatibility with strict_loading_by_default by default Add compatibility with strict_loading_by_default Oct 16, 2024
Apps that set `config.active_record.strict_loading_by_default = true` hit
StrictLoadingViolationError when Solid Queue accesses its own associations
internally. Turn strict loading off for Solid Queue's models by setting it on
the shared SolidQueue::Record base class, so every model — and any future
association — is covered in one place.

Enable strict_loading_by_default in the dummy app so the suite guards against
regressions.
@rosa
rosa force-pushed the strict-loading-by-default-compatibility branch from eec6c23 to 508ee59 Compare July 22, 2026 12:27
@rosa
rosa merged commit 23100e0 into rails:main Jul 22, 2026
62 of 64 checks passed
@rosa

rosa commented Jul 22, 2026

Copy link
Copy Markdown
Member

Sorry for taking so long to merge this one! I wasn't sure about it but I just tweaked it a bit and I think this is fine. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not compatible with strict loading by default

2 participants