Repository navigation
feat(fetcher): add random_dog — random dog photo from dog.ceo - #192
Conversation
Image-only fetcher mirroring `random_cat`. Two-step flow: GET dog.ceo JSON
endpoint, extract image URL, then GET image bytes. Host of the returned
URL is re-validated against an allowlist (`images.dog.ceo` / `dog.ceo`) so
a future API change can't redirect us to an attacker-controlled origin.
Safety::Safe — both API and CDN hosts are hardcoded; no auth. Magic-byte
format detection (PNG / JPEG / GIF / WebP), stale-extension cleanup, 5 MB
body cap, all matching `random_cat`.
Options:
- `breed` — narrow to a dog.ceo breed slug (e.g. `shiba`, `husky`).
- `sub_breed` — sub-breed under `breed` (e.g. `cocker` under `spaniel`).
Validation rejects `sub_breed` without `breed`.
Adds the catalog row to #67 Novelty image feeds (no prior checkbox; new
entry alongside `random_cat`).
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Review rate limit: 0/1 reviews remaining, refill in 39 minutes.Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #192 +/- ##
==========================================
- Coverage 81.72% 81.62% -0.10%
==========================================
Files 140 141 +1
Lines 29690 29982 +292
==========================================
+ Hits 24264 24473 +209
- Misses 5426 5509 +83
🚀 New features to boost your workflow:
|
Summary
dog.ceoeach refresh cycle and exposes it asBody::Image. Caches to$SPLASHBOARD_HOME/cache/dogs/<key>.<ext>.Safety::Safe: both the API host (dog.ceo) and the CDN host (images.dog.ceo) are hardcoded; no auth, no token to leak. Mirrorsrandom_cat's fixed-host stance fromproject_trust_model.md.breed/sub_breedfilters. Validation rejectssub_breedwithoutbreed.random_dogrow to meta: fetcher roadmap - Social & Media #67 Novelty image feeds (new entry — was not previously catalogued).Reference
imageOptions
breedshiba,husky,golden). Omit for any breed.sub_breedcockerunderbreed = "spaniel"). Requiresbreed.Compatible renderers
imageanimated_boot,animated_postfx,animated_scanlines,animated_splitflap,animated_wave,media_imageImplementation notes
dog.ceoAPI returns{"message": "<image url>", "status": "success"}. Image URLs are hosted onimages.dog.ceo. The two-call structure differs fromrandom_cat's single-call cataas redirect, but the fetcher surface stays identical (Image-only, magic-byte detection, stale-extension cleanup, 5 MB cap).images.dog.ceo/dog.ceo) is enforced even though dog.ceo currently only points there — defensive against an upstream pivot.sub_breedrequiresbreedbefore issuing the request, so the user gets a clear error rather than a 404 from a/breed//cocker/...URL.Test plan
cargo fmt --all -- --checkcargo clippy --all-targets -- -D warningscargo test(1247 green; +20 new unit tests for random_dog)cargo xtaskregeneratesdocs-site/src/content/docs/reference/fetchers/random/random_dog.mdcleanlymedia_image(default /breed = shiba/breed = spaniel+sub_breed = cocker) — three dogs render side by sidecargo test -- --ignored fetcher::random_dog::tests::live --nocapture🤖 Generated with Claude Code