Skip to content

[8.3-stable] fix(RelatableResource): Invalidate element caches on resource update#4013

Merged
tvdeyen merged 3 commits into
8.3-stablefrom
backport/8.3-stable/pr-4012
Jun 29, 2026
Merged

[8.3-stable] fix(RelatableResource): Invalidate element caches on resource update#4013
tvdeyen merged 3 commits into
8.3-stablefrom
backport/8.3-stable/pr-4012

Conversation

@alchemycms-bot

Copy link
Copy Markdown

Backport

This will backport the following commits from main to 8.3-stable:

Questions ?

Please refer to the Backport tool documentation

tvdeyen added 3 commits June 29, 2026 09:42
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)
@tvdeyen tvdeyen enabled auto-merge June 29, 2026 09:44
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.13%. Comparing base (4200442) to head (22c2f8e).
⚠️ Report is 1 commits behind head on 8.3-stable.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tvdeyen tvdeyen merged commit f61b90e into 8.3-stable Jun 29, 2026
24 checks passed
@tvdeyen tvdeyen deleted the backport/8.3-stable/pr-4012 branch June 29, 2026 09:49
@alchemycms-bot alchemycms-bot Bot mentioned this pull request Jun 29, 2026
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.

1 participant