[Frontend] Update#33
Merged
Merged
Conversation
All 12 HTTP call sites now go through shared _get/_post wrappers: - A RateLimiter (30 requests/60s by default, same sliding-window implementation the Steam client already used) paces every request. - GETs retry transient failures up to max_retries with exponential backoff: transport errors, 5xx responses, and 429 (honoring a numeric Retry-After header). Persistent transport failures surface as SteamGiftsError; persistent HTTP errors return the last response so existing status handling in each method still applies. - POSTs (enter/hide/comment - state-mutating) are retried only on connect errors, where the request never reached the server. Tests: 757 passed, 2 skipped.
GiveawayService (1027 lines) is now an 81-line facade composing three focused modules, with every method preserved verbatim and the public class path unchanged (services.giveaway_service.GiveawayService): - services/giveaway_sync.py - scrape->cache sync steps (5 methods) - services/giveaway_entry.py - entering, safety, hide, comments (6) - services/giveaway_query.py - listings, stats, eligibility (17) Also fixes a TOML footgun introduced with the APScheduler override: keys placed after a [[tool.mypy.overrides]] table belong to that table, so warn_return_any / warn_unused_configs / disallow_untyped_defs had silently stopped applying globally. With them restored, 40 hidden errors surfaced; all are now fixed (annotations on **kwargs, dunders, pydantic validators, lifespan/endpoints; typed intermediates for response.json() returns; BeautifulSoup attribute coercions in _refresh_xsrf_token). Tests: 757 passed, 2 skipped; ruff and mypy clean.
The two route-registration tests in test_api_main.py were skipped because the settings route raises without a database and TestClient re-raises handler exceptions by default. Running them with raise_server_exceptions=False makes them exact "route exists" checks (200/500, never 404) with no DB required. Backend suite: 759 passed, 0 skipped. TOFIX.md updated (the scheduler e2e file was already re-enabled by the automation consolidation).
Refactor the two components that needed the rule disabled:
- Settings.tsx: the form is now an inner SettingsForm component that
initializes its state directly from the loaded settings (useState
initializer) and is remounted via key={settings.updated_at} when a
save/refetch delivers new server state - no effect-driven setState.
- Dashboard.tsx: JobCountdown derives the countdown string during
render from job.next_run; the effect only owns a 1s tick interval.
eslint passes with zero warnings; 170 frontend tests pass; tsc clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two-stage frontend dependency refresh: