PR #326 pointed out inconsistencies in the style of output for different layers and asked for additional tests. This refactor makes that request easier by introducing shared logic for invalid metadata and cache invalidation.
It's a ducktyping approach based on two traits:
magic_migrate::TryMigrate provides an interface to (possibly) migrate invalid metadata or display errors
MetadataDiff provides an interface to allow standardize cache invalidation and restoration logic
These allow me to remove the bulk of cache invalidation logic into a central shared location. They also expose a clean interface for unit testing cache invalidation logic, which can then be used on other layers.
PR #326 pointed out inconsistencies in the style of output for different layers and asked for additional tests. This refactor makes that request easier by introducing shared logic for invalid metadata and cache invalidation.
It's a ducktyping approach based on two traits:
magic_migrate::TryMigrate
provides an interface to (possibly) migrate invalid metadata or display errorsMetadataDiff
provides an interface to allow standardize cache invalidation and restoration logicThese allow me to remove the bulk of cache invalidation logic into a central shared location. They also expose a clean interface for unit testing cache invalidation logic, which can then be used on other layers.
I described some of the background desires in #325, comment: https://github.com/heroku/buildpacks-ruby/pull/325#discussion_r1773558240.