[8.3-stable] fix(RelatableResource): Invalidate element caches on resource update#4013
Merged
Conversation
InvalidateElementsCacheJob was only enqueued from an after_touch callback, so editing a Picture or Attachment directly (re-upload, crop, rename) left the caches of every element referencing it stale until the record happened to be touched. Switching to after_commit on: :update covers both updates and touches, since a touch flags the update callback, and deferring to commit avoids enqueuing on rollback while coalescing repeated touches within a transaction into a single job. (cherry picked from commit 296e8ce)
…ples The "a relatable resource" shared example derived its factory names from resource_name/ingredient_type via string interpolation, which only works for resources whose factories follow the alchemy_<name> convention. Accepting optional resource_factory_name/ingredient_factory_name args (falling back to the derived names) lets resources with differently named factories reuse the shared example. (cherry picked from commit f2bc7a2)
…ecifics The shared example hardcoded a :name update and asserted the exact deletable result set, which only fits resources that have a name attribute and live in isolation. Adding an optional update_attribute arg (defaulting to :name) and relaxing the deletable check to include/exclude matchers lets resources without a name column, or sharing the table with unrelated records, reuse the example. (cherry picked from commit 0f3553f)
3 tasks
tvdeyen
approved these changes
Jun 29, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.3-stable #4013 +/- ##
===========================================
Coverage 98.12% 98.13%
===========================================
Files 346 346
Lines 8974 8988 +14
===========================================
+ Hits 8806 8820 +14
Misses 168 168 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Backport
This will backport the following commits from
mainto8.3-stable:Questions ?
Please refer to the Backport tool documentation