Merge pull request #17201 from Homebrew/fix-internal-formula-json-v3-frozen-hash-bug

Fix internal formula json v3 frozen hash parsing bug
This commit is contained in:
Mike McQuaid 2024-05-02 08:39:27 +01:00 committed by GitHub
commit bd72ec812c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View File

@ -7,9 +7,10 @@ module Cachable
@cache ||= T.let({}, T.nilable(T::Hash[T.untyped, T.untyped]))
end
# NOTE: We overwrite here instead of using `Hash#clear` to handle frozen hashes.
sig { void }
def clear_cache
cache.clear
overwrite_cache!({})
end
private

View File

@ -226,7 +226,7 @@ module Formulary
end
if info&.key?("uses_from_macos")
bounds = info["uses_from_macos"] || {}
bounds = info["uses_from_macos"].dup || {}
bounds.deep_transform_keys!(&:to_sym)
bounds.deep_transform_values!(&:to_sym)

View File

@ -33,7 +33,7 @@ RSpec.describe "Internal Tap JSON -- Formula", type: :system do
allow(Homebrew::API).to receive(:fetch_json_api_file)
.with("internal/v3/homebrew-core.jws.json")
.and_return([JSON.parse(internal_tap_json), false])
.and_return([JSON.parse(internal_tap_json, freeze: true), false])
# `Tap.tap_migration_oldnames` looks for renames in every
# tap so `CoreCaskTap.tap_migrations` gets called and tries to