Invalidate asset URLs when prefix or digest settings change - #558
Closed
OskarEichler wants to merge 1 commit into
Closed
OskarEichler wants to merge 1 commit into
OskarEichler wants to merge 1 commit into
Conversation
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.
Summary
Include the asset prefix and digest setting in the existing asset-URL cache dependency. Reusing a Sprockets cache after either setting changes must not retain old URLs in compiled CSS.
Reproduction
Use
require "sprockets/railtie";envin the focused examples is a Sprockets environment with Rails::Context included, digest assets enabled and prefix/assets.Verification
rake test: 151 tests / 796 assertions, zero failures/errors/skips on Ruby 4.0.6 + Rails 8.1.3.1 + Sprockets 4.4.1; Ruby 3.2.11 with the same dependencies; and Ruby 3.2.11 + Rails 7.2.3.1 + Sprockets 3.7.5. Baselines pass too.MT_CPU=1serializes Rails isolation tests that share fixture directories. External verification Gemfiles pin these combinations because the repository root Gemfile combines current Rails with Rack 2 and Sprockets 3.Compatibility and limitations
No public API signature or dependency changes. Breaking changes: none intended; the incorrect behavior described above changes. Older supported Ruby versions and Linux CI have not been run locally. No test files were added or edited under the consumer repository's no-test-edit constraint; regression evidence is supplied here and through external focused checks. Prepared with AI assistance and verified with the commands above.