fix(image): content-address the SVG→PDF cache (stale logo fix)#11
Merged
Conversation
The build/ cache filename hashed the SVG's path, not its bytes, so editing a vendored SVG (e.g. swapping the MAKERS title-page logo for the left-aligned artwork) left a stale converted PDF at the same path-derived name: `ensure_converted` saw it already existed and skipped reconversion, so old builds kept rendering the previous logo. Hash the file content instead, so changed sources reconvert and an unchanged source still hits the cache. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
The
build/cache filename for a converted SVG hashed the source path, not its bytes. So when a vendored SVG's artwork changed (e.g. PR #4 swapping the MAKERS title-page logo to the left-aligned version), any pre-existingbuild/<stem>-<pathdigest>.pdfstayed valid:ensure_convertedsaw it exists and skipped reconversion. Result: old build trees keep rendering the previous logo — the reported "MAKERS title logo is still right-aligned".Fix
Hash the SVG content for the cache filename. Changed source → new name → reconvert; unchanged source still hits the cache (and identical content now dedups).
Verification
733 tests pass; ruff + mypy --strict clean. New test asserts editing an SVG's content changes the resolved cache path.
Workaround for existing trees without this fix: delete the stale
build/dir before rebuilding.🤖 Generated with Claude Code