Add external Bootsnap cache inputs - #6
Merged
Conversation
Require Hooks source transforms can depend on external libraries or
configuration. The existing version_hash= API sets one complete, static key
and replaces the automatic hook key. For example:
RequireHooks::Bootsnap.version_hash = Parser::VERSION
RequireHooks.source_transform do |_path, source|
source.gsub("...", options_digest)
end
If options_digest changes while Parser::VERSION stays the same, Bootsnap
reuses the old transformed entry because version_hash= does not include the
transform option. A second version_hash= assignment would instead discard the
first dependency.
Applications can register both inputs with:
RequireHooks::Bootsnap.add_version_hash do
"parser-#{Parser::VERSION}-#{options_digest}"
end
Require Hooks evaluates each callable when it computes the key, hashes each
contribution, and combines all contributions with the hook configuration. It
then isolates transformed entries with Bootsnap compiler namespaces on modern
Bootsnap and versioned cache directories on older versions.
rafaelfranca
force-pushed
the
rm-custom_hash
branch
from
August 26, 2026 18:17
5877f7b to
308df2c
Compare
palkan
reviewed
Aug 26, 2026
Contributor
|
@rafaelfranca Please, let me know if you want me to publish a new release or there is more Bootsnap-related expected |
Contributor
Author
|
This is the last one. Feel free to make a release. 0.5.0 is already good enough for us, but this will make sure our caches aren't reused when our transformation library changes |
Contributor
|
Great! v0.5.1 is on its way. |
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.
Require Hooks source transforms can depend on external libraries or configuration. The existing
version_hash=API sets one complete, static key and replaces the automatic hook key. For example:If
options_digestchanges whileParser::VERSIONstays the same, Bootsnap reuses the old transformed entry becauseversion_hash=does not include the transform option. A secondversion_hash=assignment would instead discard the first dependency.Applications can register both inputs with:
Require Hooks evaluates each callable when it computes the key, hashes each contribution, and combines all contributions with the hook configuration. It then isolates transformed entries with Bootsnap compiler namespaces on modern Bootsnap and versioned cache directories on older versions.
Checklist