Repository navigation
feat(fetcher): add deal_* family for gaming deal aggregators - #240
Conversation
Three fetchers under a new `deal_*` family share a common `DealRow` model and shape pipeline so renderers swapping between siblings see consistent `[Store] Title $price (X% off)` output regardless of source. - `deal_free_games` — LootScraper aggregator (`feed.eikowagenknecht.com`). One fetcher covers Epic Games / Steam / Amazon Prime Gaming / GOG / Humble / itch.io / Apple App Store / Google Play giveaways via `platform` filter, with `kind = "loot"` toggling Twitch-drops / in-game-items (Amazon and Steam only). Replaces the planned per-platform free-games fetcher sprawl. - `deal_steam_daily` — Steam's official `/feeds/daily_deals.xml`. Pulls the Daily Deal / Weekend Deal / Midweek Madness / Weeklong Deal entries and parses the discount percent out of the `"Daily Deal - <Title>, X% Off"` marketing-prefix titles. - `deal_games` — CheapShark `/api/1.0/deals`. Cross-store top deals sorted by savings; `min_discount` floor, `limit`, and `stores` (CheapShark store-ID allowlist: 1=Steam, 7=GOG, 25=Epic, …) options. All three are `Safety::Safe` — every host is hardcoded; config picks among closed enums (platform / kind / store IDs) and can't redirect requests off-host. The third-party LootScraper instance is the one non-vendor host but it has shipped continuously since 2019 and absorbs per-platform scraping complexity (Epic GraphQL, Amazon Luna OAuth, Steam giveaway events) that would otherwise sprawl into eight separate fetchers. Shape table (9 shapes, shared across the three): `linked_text_block` (default) / `text_block` / `markdown_text_block` / `text` (top headline) / `entries` / `bars` (sorted desc by discount) / `image_linked_list` (thumbnails via shared cache) / `badge` (100% → "free this week" / ≥50% → "N% off" Ok / <50% → "N% off" Warn / empty → "no deals") / `timeline` (publish-date sorted). Status color mapping is direction-neutral: `discount_pct ≥ 50%` → Ok, otherwise Warn. No long-vs-short sentiment encoding. Also bumps the `image` crate features to include `webp` and `gif` so Amazon Prime Gaming covers (served as WebP from `m.media-amazon.com`) decode in `list_cards` instead of falling through to empty cells. Same gap would have hit any fetcher returning a WebP / GIF response — this unblocks them all. Catalog (#41 / #68): - `epic_free_games` (Gaming) shipped as part of `deal_free_games` via LootScraper; the per-platform sprawl this would have caused folds into one fetcher with a `platform` filter. - `game_deals` (Shopping/deals) shipped as `deal_games`. - `deal_steam_daily` is a new addition not previously in the roadmap. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
📝 WalkthroughWalkthroughThe PR adds a complete deal-fetching family to the splashboard fetcher registry. It expands image format support, introduces a unified DealRow model with multi-shape rendering logic, and implements three distinct Fetchers (free games via LootScraper, game discounts via CheapShark, Steam daily deals via RSS), then integrates them into the runtime registry. ChangesDeal Fetchers and Rendering
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #240 +/- ##
==========================================
- Coverage 94.02% 93.80% -0.23%
==========================================
Files 202 207 +5
Lines 52327 53285 +958
==========================================
+ Hits 49202 49983 +781
- Misses 3125 3302 +177
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/fetcher/deal/common.rs`:
- Around line 18-21: The MAX_ROWS cap is not being applied early so large
upstream slices still flow into body construction and thumbnail downloads; at
the start of the routines that accept the entries slice (e.g., the functions
that build the multi-row body and that kick off thumbnail fetching—look for
names like build_multi_row_body / build_body / process_widget_entries /
download_thumbnails_for_entries) trim the input slice to entries =
&entries[..entries.len().min(MAX_ROWS)] (use MAX_ROWS constant) before any
further processing or spawning of downloads, and ensure any downstream helpers
consume this trimmed slice so thumbnail fetches and row-building never see more
than MAX_ROWS entries.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b9d32c84-c5bb-4c4d-b517-6f41fc17e7ac
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (7)
Cargo.tomlsrc/fetcher/deal/common.rssrc/fetcher/deal/free_games.rssrc/fetcher/deal/games.rssrc/fetcher/deal/mod.rssrc/fetcher/deal/steam_daily.rssrc/fetcher/mod.rs
| /// Cap multi-row shapes so a runaway upstream can't swamp a single widget slot. | ||
| pub(super) const MAX_ROWS: usize = 20; | ||
| /// Bars / entries labels longer than this get an ellipsis. Picked to fit a typical sidebar. | ||
| const LABEL_MAX_CHARS: usize = 40; |
There was a problem hiding this comment.
Enforce MAX_ROWS before body building and thumbnail downloads.
MAX_ROWS is documented as a safety cap, but these entry points currently process the full slice. A large upstream response can flood multi-row shapes and trigger excessive thumbnail fetches.
Proposed fix
pub(super) fn body_for_shape(rows: &[DealRow], shape: Shape) -> Option<Body> {
+ let rows = &rows[..rows.len().min(MAX_ROWS)];
Some(match shape {
Shape::LinkedTextBlock => linked_text_block_body(rows),
Shape::TextBlock => text_block_body(rows),
Shape::MarkdownTextBlock => markdown_body(rows),
Shape::Text => text_body(rows),
Shape::Entries => entries_body(rows),
Shape::Bars => bars_body(rows),
Shape::Badge => badge_body(rows),
Shape::Timeline => timeline_body(rows),
_ => return None,
})
}
@@
pub(super) async fn image_linked_body(rows: &[DealRow]) -> Body {
+ let rows = &rows[..rows.len().min(MAX_ROWS)];
let urls: Vec<Option<String>> = rows.iter().map(|r| r.image_url.clone()).collect();
let paths = thumbnails::download_many(&urls).await;
Body::ImageLinkedList(ImageLinkedListData {
items: rowsAlso applies to: 75-87, 176-191
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/fetcher/deal/common.rs` around lines 18 - 21, The MAX_ROWS cap is not
being applied early so large upstream slices still flow into body construction
and thumbnail downloads; at the start of the routines that accept the entries
slice (e.g., the functions that build the multi-row body and that kick off
thumbnail fetching—look for names like build_multi_row_body / build_body /
process_widget_entries / download_thumbnails_for_entries) trim the input slice
to entries = &entries[..entries.len().min(MAX_ROWS)] (use MAX_ROWS constant)
before any further processing or spawning of downloads, and ensure any
downstream helpers consume this trimmed slice so thumbnail fetches and
row-building never see more than MAX_ROWS entries.
Summary
New
deal_*fetcher family — three siblings sharing aDealRowmodel and shape pipeline so renderers swapping between them see consistent[Store] Title $price (X% off)output regardless of source. All three areSafety::Safe(every host hardcoded; config picks closed enums only).deal_free_gamesfeed.eikowagenknecht.com(LootScraper)platformfilter;kind = "loot"for Twitch-drops / in-game-items (Amazon & Steam only).deal_steam_dailystore.steampowered.com/feeds/daily_deals.xml(official)"Daily Deal - <Title>, X% Off"titles.deal_gamescheapshark.com/api/1.0/dealsmin_discountfloor,limit,stores(CheapShark IDs: 1=Steam, 7=GOG, 25=Epic, 11=Humble, 15=Fanatical, …).The third-party LootScraper instance is the one non-vendor host, but it has shipped continuously since 2019 (≈2M monthly RSS hits) and absorbs the per-platform scraping complexity (Epic GraphQL, Amazon Luna OAuth, Steam giveaway events) that would otherwise sprawl into eight separate fetchers.
Also bumps the
imagecrate features to includewebp+gifso Amazon Prime Gaming cover art (served as WebP fromm.media-amazon.com) decodes inlist_cardsinstead of falling through to empty cells. Same gap would have hit any fetcher returning a WebP / GIF response — this unblocks them all.Shape contract (shared across the three)
linked_text_block(default)[Store] Title $price (X% off from $orig)rowstext_blockmarkdown_text_block- [<row>](<url>)bullet listtextentriestitle → "$price (X% off)",Statuscolored by discount tierbarsimage_linked_listStore · $price · N% offsubtitlebadge100% → "free this week"/≥50% → "N% off"Ok /<50% → "N% off"Warn / empty →"no deals"timelineStatus color mapping is direction-neutral:
discount_pct ≥ 50%→Status::Ok, otherwiseStatus::Warn. No long-vs-short sentiment encoding.Rejected shapes
Ratio/NumberSeries/PointSeries/Image/Calendar/Heatmap— no natural fit.sample_body()returnsNonefor each so the catalog doesn't suggest broken pairings.Compatible renderers
All three fetchers expose the same shape table, so:
linked_text_block→list_linkstext_block→list_plain(plus everyanimated_*wrapper)markdown_text_block→text_markdowntext→text_plain/text_ascii/animated_typewriter/animated_figlet_morphentries→grid_tablebars→chart_bar/chart_pie/list_rankingimage_linked_list→list_cardsbadge→status_badgetimeline→list_timelinePlus the post-process animation wrappers (
animated_postfx/animated_boot/animated_scanlines/animated_splitflap/animated_wave) on every shape.Test plan
cargo fmt --all -- --check✅cargo clippy --all-targets -- -D warnings✅cargo test --lib✅ (2333 passed / 0 failed / 17 ignored — 49 new tests added underfetcher::deal::*)cargo run --bin splashboard -- catalog fetcher deal_free_games | deal_steam_daily | deal_games— verified registration, option schemas, compatible renderers.splashboard/dashboard.tomlcovering every shape against live upstreams. WebP cover images from Amazon Prime Gaming now render correctly inlist_cards(this was the trigger for theimagecrate feature bump).Catalog (post-merge)
epic_free_games(shipped asdeal_free_gamescovering 8 platforms via LootScraper rather than Epic-only).game_deals(shipped asdeal_games).deal_steam_daily(new, not in roadmap).sale_events(calendar of upcoming Prime Day / Steam Summer Sale / etc.) stays open — no free public feed publishes vendor-specific sale dates; deferred until a reliable upstream exists.steam_wishlist_sales(personal Steam wishlist deals) stays open — scoped out of this batch as personal-account data.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features