Skip to content

fix(image): content-address the SVG→PDF cache (stale logo fix)#11

Merged
frederikbeimgraben merged 1 commit into
mainfrom
fix/image-cache-content-hash
Jun 3, 2026
Merged

fix(image): content-address the SVG→PDF cache (stale logo fix)#11
frederikbeimgraben merged 1 commit into
mainfrom
fix/image-cache-content-hash

Conversation

@frederikbeimgraben
Copy link
Copy Markdown
Owner

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-existing build/<stem>-<pathdigest>.pdf stayed valid: ensure_converted saw 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

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>
@frederikbeimgraben frederikbeimgraben merged commit b453023 into main Jun 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant