Skip to content

feat(fetcher): add deal_* family for gaming deal aggregators - #240

Merged
unhappychoice merged 1 commit into
mainfrom
feat/fetcher-deal-family
May 15, 2026
Merged

unhappychoice merged 1 commit into
mainfrom
feat/fetcher-deal-family

Conversation

@unhappychoice

@unhappychoice unhappychoice commented May 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

New deal_* fetcher family — three siblings sharing a DealRow model and shape pipeline so renderers swapping between them see consistent [Store] Title $price (X% off) output regardless of source. All three are Safety::Safe (every host hardcoded; config picks closed enums only).

Fetcher Upstream Setup Coverage
deal_free_games feed.eikowagenknecht.com (LootScraper) zero-config Epic / Steam / Amazon Prime Gaming / GOG / Humble / itch.io / Apple App Store / Google Play giveaways. platform filter; kind = "loot" for Twitch-drops / in-game-items (Amazon & Steam only).
deal_steam_daily store.steampowered.com/feeds/daily_deals.xml (official) zero-config Steam Daily / Weekend / Midweek Madness / Weeklong / Special Promotion deals. Discount % parsed from "Daily Deal - <Title>, X% Off" titles.
deal_games cheapshark.com/api/1.0/deals zero-config Cross-store top deals sorted by savings. min_discount floor, 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 image crate features to include webp + gif so Amazon Prime Gaming cover art (served as WebP from m.media-amazon.com) decodes 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.

Shape contract (shared across the three)

Shape Behaviour
linked_text_block (default) Clickable [Store] Title $price (X% off from $orig) rows
text_block Same rows, non-linked
markdown_text_block - [<row>](<url>) bullet list
text Single headline — picks the largest discount in the set
entries title → "$price (X% off)", Status colored by discount tier
bars Sorted desc by discount percent
image_linked_list Cards with thumbnail + Store · $price · N% off subtitle
badge 100% → "free this week" / ≥50% → "N% off" Ok / <50% → "N% off" Warn / empty → "no deals"
timeline Publish-date sorted, detail carries store + price + discount

Status color mapping is direction-neutral: discount_pct ≥ 50% → Status::Ok, otherwise Status::Warn. No long-vs-short sentiment encoding.

Rejected shapes

Ratio / NumberSeries / PointSeries / Image / Calendar / Heatmap — no natural fit. sample_body() returns None for each so the catalog doesn't suggest broken pairings.

Compatible renderers

All three fetchers expose the same shape table, so:

Plus 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 under fetcher::deal::*)
  • cargo run --bin splashboard -- catalog fetcher deal_free_games | deal_steam_daily | deal_games — verified registration, option schemas, compatible renderers
  • Smoke-tested with a project-local .splashboard/dashboard.toml covering every shape against live upstreams. WebP cover images from Amazon Prime Gaming now render correctly in list_cards (this was the trigger for the image crate feature bump).

Catalog (post-merge)

  • meta: fetcher roadmap - Life & Ambient #68 Gaming — tick epic_free_games (shipped as deal_free_games covering 8 platforms via LootScraper rather than Epic-only).
  • meta: fetcher roadmap - Life & Ambient #68 Shopping/deals — tick game_deals (shipped as deal_games).
  • meta: fetcher roadmap - Life & Ambient #68 Gaming — add a "shipped" note for deal_steam_daily (new, not in roadmap).
  • The planned 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.
  • The planned 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

  • Three new deal aggregation sources integrated: free games and loot offers tracker across multiple storefronts, Steam daily/weekend/midweek deals feed, and CheapShark cross-store game deals with customizable discount thresholds and store filtering
  • Expanded image format support to include WebP and GIF alongside existing PNG and JPEG

Review Change Stack

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]>
@coderabbitai

coderabbitai Bot commented May 15, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The 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.

Changes

Deal Fetchers and Rendering

Layer / File(s) Summary
Image format expansion
Cargo.toml
Image dependency feature set expands to include webp and gif alongside existing png and jpeg.
Shared DealRow model and shape renderers
src/fetcher/deal/common.rs
DealRow struct consolidates deal metadata (title, pricing, discount, store, link, timestamps, image URL) and provides label construction. body_for_shape() dispatches to specialized renderers for each Shape variant: linked text blocks, plain text, markdown, text headline, entries with discount-derived status, sorted bars, badge selection, timeline events, and async image-linked lists. Includes internal helpers for formatting, discount-to-status mapping, and label truncation.
FreeGamesFetcher: LootScraper integration
src/fetcher/deal/free_games.rs
Aggregates free games and loot offers across storefronts from LootScraper RSS. Configurable by platform (all/amazon/epic/gog/steam) and kind (game/loot with loot restricted to amazon/steam). Parses options, constructs and fetches feed URL, converts RSS entries to DealRow via regex store/title extraction or raw fallback, and renders by selected Shape.
GamesFetcher: CheapShark API integration
src/fetcher/deal/games.rs
Fetches cross-store game deals from CheapShark public JSON API. Configurable by min_discount, limit, and optional store filter. Builds query URL, performs HTTP GET with pooled reqwest Client (User-Agent, 10s timeout, gzip), parses JSON, converts ApiDeal to DealRow with price formatting (0.0 → "Free"), discount clamping, store-ID mapping, and redirect links. Renders by selected Shape.
SteamDailyFetcher: Steam RSS integration
src/fetcher/deal/steam_daily.rs
Fetches Steam daily, weekend, and midweek deals from official RSS feed. Configurable by count option. Parses RSS entries to DealRow via regex title parsing for discount percentage extraction (clamped to 100%) or raw fallback, derives store attribution, and renders by selected Shape.
Module registration and fetcher discovery
src/fetcher/deal/mod.rs, src/fetcher/mod.rs
deal/mod.rs wires submodules and exposes fetchers() function returning boxed batch with naming-prefix validation. src/fetcher/mod.rs adds pub mod deal and extends Registry::with_builtins to register all deal fetchers into the default runtime registry.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • unhappychoice/splashboard#28: The PR adds deal fetchers that implement the Fetcher trait and integrate into the runtime registry for on-demand fetch and cache operations.

Poem

A trio of scrapers now graze the web's feast,
From Steam's daily deals to the LootScraper's beast,
CheapShark deals flowing through rows and through shapes,
The DealRow model gives all renders their drapes,
With WebP and GIF painting pictures anew,
Splashboard's deal hunters know just what to do. 🐰📊

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 54.70% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a new family of three deal fetchers for gaming deal aggregation. It is specific, uses a conventional commit format, and directly reflects the changeset's primary contribution.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/fetcher-deal-family

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 and usage tips.

@codecov

codecov Bot commented May 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.52401% with 177 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.80%. Comparing base (048b46c) to head (e174ceb).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/fetcher/deal/free_games.rs 82.37% 49 Missing ⚠️
src/fetcher/deal/common.rs 79.03% 48 Missing ⚠️
src/fetcher/deal/games.rs 84.67% 42 Missing ⚠️
src/fetcher/deal/steam_daily.rs 76.10% 38 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            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     
Files with missing lines Coverage Δ
src/fetcher/deal/mod.rs 100.00% <100.00%> (ø)
src/fetcher/mod.rs 98.99% <100.00%> (+<0.01%) ⬆️
src/fetcher/deal/steam_daily.rs 76.10% <76.10%> (ø)
src/fetcher/deal/games.rs 84.67% <84.67%> (ø)
src/fetcher/deal/common.rs 79.03% <79.03%> (ø)
src/fetcher/deal/free_games.rs 82.37% <82.37%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8ad5aa3 and e174ceb.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • Cargo.toml
  • src/fetcher/deal/common.rs
  • src/fetcher/deal/free_games.rs
  • src/fetcher/deal/games.rs
  • src/fetcher/deal/mod.rs
  • src/fetcher/deal/steam_daily.rs
  • src/fetcher/mod.rs

Comment on lines +18 to +21
/// 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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

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: rows

Also 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.

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