A small service builds cache keys for document search. In some calls, identical parameters must produce the same key, and temporary files must be closed and deleted after reading.
CacheKeyBuilder#build accepts keyword arguments query:, filters: and optional source: nil.filters does not affect the result.source is not specified, it must be absent from the final key.ReportReader#load opens a file, reads it completely, and always closes the file descriptor.CacheKeyBuilder#build with the same query and filters values, but with a different order of keys in filters.ReportReader#load with a file that causes a read error after opening.filters.source does not add extra parts to the key.ruby lib/cache_key_builder.rb for manual verification, tests via ruby without additional gemsThread#report_on_exception = falseUse line comments to explain the problem, its impact, the fix and how to test it.