Skip to content

Optimize hub images: pjpg CDN renditions and stale cleanup#12

Merged
bharvey88 merged 1 commit into
mainfrom
perf/5-image-optimization
Jul 9, 2026
Merged

Optimize hub images: pjpg CDN renditions and stale cleanup#12
bharvey88 merged 1 commit into
mainfrom
perf/5-image-optimization

Conversation

@bharvey88

Copy link
Copy Markdown
Collaborator

What does this change?

Closes #5. Shrinks the hub images and stops stale files from lingering.

scripts/fetch_images.py now requests Shopify CDN sources as small
progressive-JPEG renditions (width=600&format=pjpg). I verified empirically
that the store ignores format=webp (returns the original PNG) but
honors format=pjpg (returns image/jpeg), so pjpg is the only conversion
that actually takes effect.

  • The six product PNGs drop from 700-900KB each to 60-85KB. images/ goes from
    ~5.2MB to ~840KB.
  • Renditions save as .jpg and the previous extension is deleted, so stale
    .png files no longer linger in the repo or the deploy (remove_stale).
  • Non-Shopify sources (msr-1's wiki image) are left untouched when the file
    already exists, so its manual resize from Core installer: hub, device wizard, registry, CI #1 is not clobbered by a full-size
    re-download.
  • New scripts/test_fetch_images.py (stdlib unittest, no deps) covers the
    rendition URL building and stale cleanup, wired into the registry CI job.
  • Regenerated the ten hub images (all valid 600px-wide JPEGs; cast-1 is 600x450).

Heads up: this PR includes the regenerated image binaries, so it is worth a
quick eyeball on image quality before merging.

Checklist

  • Playwright tests pass locally (cd tests && npx playwright test) (11 passed)
  • Any new runtime file/dir is added to the cp list in .github/workflows/pages.yml (n/a: images/ is already copied; the new files are scripts/tests, not shipped)
  • No new build step, framework, or runtime CDN dependency (stdlib only)
  • If devices.json changed: python scripts/validate_registry.py passes (only image fields changed; validator ran green)

🤖 Generated with Claude Code

Closes #5.

fetch_images.py now requests Shopify CDN sources as small progressive-JPEG
renditions (width=600&format=pjpg). The store ignores format=webp (it returns
the original PNG), so pjpg is the only conversion that takes effect. This drops
the six product PNGs from 700-900KB each to 60-85KB, cutting images/ from
~5.2MB to ~840KB.

- Save Shopify renditions as .jpg and delete the previous extension so stale
  .png files do not linger in the repo or the deploy (remove_stale).
- Leave non-Shopify sources (msr-1's wiki image) untouched when the file
  already exists, so its manual resize from #1 is not clobbered by a full-size
  re-download.
- New scripts/test_fetch_images.py (stdlib unittest, no deps) covers the
  rendition URL building and stale cleanup; wired into the registry CI job.
- Regenerated the ten hub images.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@bharvey88, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 42 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 77e2b871-df38-44c0-98fc-b83501776bf8

📥 Commits

Reviewing files that changed from the base of the PR and between b45fe28 and 49c8cbb.

⛔ Files ignored due to path filters (15)
  • images/air-1.jpg is excluded by !**/*.jpg
  • images/air-1.png is excluded by !**/*.png
  • images/btn-1.jpg is excluded by !**/*.jpg
  • images/cast-1.jpg is excluded by !**/*.jpg
  • images/msr-2.jpg is excluded by !**/*.jpg
  • images/msr-2.png is excluded by !**/*.png
  • images/mtr-1.jpg is excluded by !**/*.jpg
  • images/mtr-1.png is excluded by !**/*.png
  • images/plt-1.jpg is excluded by !**/*.jpg
  • images/plt-1.png is excluded by !**/*.png
  • images/pump-1.jpg is excluded by !**/*.jpg
  • images/r-pro-1.jpg is excluded by !**/*.jpg
  • images/r-pro-1.png is excluded by !**/*.png
  • images/temp-1.jpg is excluded by !**/*.jpg
  • images/temp-1.png is excluded by !**/*.png
📒 Files selected for processing (4)
  • .github/workflows/validate.yml
  • devices.json
  • scripts/fetch_images.py
  • scripts/test_fetch_images.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf/5-image-optimization

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@bharvey88 bharvey88 merged commit 75d10f6 into main Jul 9, 2026
3 checks 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.

Image optimization: smaller CDN renditions, stale-file cleanup

1 participant