From a782d17cac35bb15efa78cace31e9d76d06bb753 Mon Sep 17 00:00:00 2001 From: Anthony Veaudry Date: Thu, 22 Oct 2026 16:48:55 +0300 Subject: [PATCH 1/2] Recompile components compiled inside with_new_cache Components compiled in the block keep the settings they were compiled under, such as coverage stripping the BEGIN annotation, but the restored cache still listed them as compiled. The template annotations integration test then failed whenever it ran after the coverage compile tests. Co-Authored-By: Claude Opus 5.5 (1M context) --- test/test_helper.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/test_helper.rb b/test/test_helper.rb index 0202df54e..9d1b68e1f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -137,6 +137,9 @@ def with_new_cache yield ensure ActionView::Base.cache_template_loading = old_cache_template_loading + # Components compiled in the block were compiled under its settings, such as + # coverage or annotations, so make them compile again the next time they render. + old_cache.subtract(ViewComponent::CompileCache.cache) ViewComponent::CompileCache.cache = old_cache end From ecb933a887cceee3574341ba66c814723dcb1d3f Mon Sep 17 00:00:00 2001 From: Anthony Veaudry Date: Thu, 22 Oct 2026 16:54:29 +0300 Subject: [PATCH 2/2] Add changelog entry for the with_new_cache fix Co-Authored-By: Claude Opus 5.5 (1M context) --- docs/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f6f9eb228..09f9b6ea4 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -10,6 +10,10 @@ nav_order: 6 ## main +* Fix the template annotations integration test failing when it ran after the coverage compile tests, which left components compiled without the annotation in the test cache. + + *Anthony Veaudry* + ## 4.18.0 * Enable caching support for all components by default, and rename `ViewComponent::ExperimentallyCacheable` to `ViewComponent::Cacheable`. Including the module is no longer necessary. Breaking: remove existing `include ViewComponent::ExperimentallyCacheable` lines. Caching is no longer experimental.