Skip to content

Feat/backend improve - #4

Merged
choompuy merged 24 commits into
mainfrom
feat/backend-improve
Oct 21, 2026
Merged

choompuy merged 24 commits into
mainfrom
feat/backend-improve

Conversation

@choompuy

Copy link
Copy Markdown
Owner

No description provided.

Quota management:
- track quota exhaustion until YouTube's daily reset in Pacific time
- extend the search cache TTL

Search normalization:
- normalize search cache keys consistently
- preserve combining marks in search queries

URL parsing:
- improve handling of scheme-less YouTube links
- support additional valid playlist ID formats
Error handling:
- normalize Twitch API and network errors
- retry user-info lookups during authorization

Token persistence:
- persist refreshed tokens immediately
- prevent cancelled authorization and stale token refreshes from overwriting newer login state
Localization:
- return translation keys when translations are missing

Chat messages:
- pass locale and player state explicitly to shared message builders
- wait for Twitch chat reconnection before sending replies
- surface failed sends caused by disconnections as errors
Error handling:
- localize API errors by code
- surface Twitch authorization failures in the control panel

Twitch:
- improve retry, reconnect, and token rollback handling
- serialize immediate persistence saves to prevent race conditions

YouTube:
- preserve raw search results so cached data can be re-filtered
- block all YouTube API requests while quota exhaustion is active
Persistence:
- retry transient file-write failures
- centralize save-error reporting
- validate top-level data when loading persisted files
- check data-directory writability at startup
- move queue state into the data directory

Settings:
- skip file writes and state-update events when settings remain unchanged
Error handling:
- unify route and request failures around `AppError`
- centralize HTTP status mapping
- introduce shared input validators

Request flows:
- propagate structured errors through queue and Twitch redemption handlers

Testing:
- add tests for error handling, validation, and request failure behavior
Persistence:
- fix fallback state reconciliation
- preserve malformed persisted data
- make save retry policies configurable per store
- log server-side application errors

Twitch:
- improve error classification
- prevent late token refresh responses from overwriting disconnected account state

YouTube:
- fix search query normalization and playlist URL handling
Error handling:
- make HTTP error codes exhaustive for status mapping and localized messages
- centralize ID validation
- return HTTP 429 when SSE connection limits are exceeded

Queue and redemptions:
- store track failure reasons as plain data
- prevent refunds for Channel Point redemptions that fail after entering the queue
State management:
- add a shared store helper to detect meaningful changes, persist updates, and emit topic notifications consistently
- use config changes to trigger fallback playlist loading, reordering, and rollback

Real-time updates:
- identify SSE events by topic without sequence counters
Playback:
- assign unique play IDs to prevent stale player reports from affecting later plays of the same track
- ensure repeated tracks reload correctly

State management:
- move persistence into the stores responsible for playback and fallback state
- fix fallback playlist reactions and rollback handling
- publish Twitch and config changes through state topics

Logging:
- refine application error logging

Testing:
- expand backend and frontend coverage for playback, persistence, fallback handling, and state updates
Track lifecycle:
- route failures, rejections, and skips through `finishItem` for consistent activity logging
- preserve existing Channel Points behavior

Queue:
- make queue advancement atomic
- exclude blocked tracks from per-user request limits and chat listings

Fallback playlists:
- mark playlist tracks as fallback entries
- use a localized requester name for fallback tracks
Playlists:
- load up to 250 tracks using playability guard filters
- preserve the playlist's declared track count for the control panel
- recognize YouTube Shorts up to three minutes

Persistence:
- consolidate file-backed list update logic

Error handling:
- preserve error causes in logs and API responses
Fallback tracks:
- store a stable marker for fallback tracks
- display the localized playlist name consistently across the player, queue, overlay, chat replies, and activity journal

Refactoring:
- extract song-request handling from the queue module
- centralize player track completion
TypeScript:
- add a dedicated TypeScript configuration for tests
- include test type-checking in the main typecheck script

Tests:
- add explicit types and required arguments to satisfy strict type checking
Networking:
- centralize network and fetch handling
- improve Twitch socket recovery and outage reporting
- make application shutdown safer

Configuration:
- reduce config-read overhead with read-only live views
- enforce strict secret updates

YouTube:
- refine API response handling and data mapping

Validation and localization:
- share input validation limits
- add localized placeholders
Track filtering:
- remove the Shorts setting and its rejection rule
- rely on configured duration limits to determine track eligibility
- allow active broadcasts while continuing to reject unfinished uploads and scheduled streams

Testing:
- add regression tests for track playability and duration filtering
- cover fallback playlist loading
Settings:
- preserve unsaved values and status marks when settings reload
- clear stale status marks when server values change

Control panel:
- simplify section headers
- report when a playlist is paused
Remote access:
- detect remote devices and hide machine-specific settings and Twitch controls

Queue:
- treat a queue limit of `0` as unlimited

Control panel:
- clarify queue, activity, and playlist status labels
Server:
- move app construction and free-port listening into an import-safe module

Twitch:
- record outages when they exceed the threshold
- cap reward inputs

Reliability:
- throttle failed log rotations
- cancel response bodies before retrying
Integration:
- separate chat commands, device authorization, redemption handling, and shared runtime state from the integration lifecycle
- centralize retry and connection tunables

Testing:
- update tests to target the extracted modules
Twitch:
- centralize chat replies and per-initialization tunables
- stop background connections before saving state during shutdown
- validate reward updates through the shared schema
- record actual recovery durations in outage journal entries

UI:
- show localized placeholders for tracks without titles
Networking:
- centralize HTTP requests and action error reporting
- add request timeouts and prevent stale search or form responses from overwriting newer input

Playback:
- add playback-start timeouts
- improve overlay progress and playlist behavior

UI:
- improve copy feedback
@choompuy
choompuy merged commit 5571692 into main Oct 21, 2026
2 checks passed
@choompuy
choompuy deleted the feat/backend-improve branch October 21, 2026 20:01
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