Repository navigation
Refactoring review fixes: DB off the async runtime, typed kinds, module splits - #12
Merged
Merged
Conversation
…le splits
Backend
- Async commands reach SQLite through read_blocking/write_blocking
(state.rs): the database locks are plain mutexes and the writer is held
for a whole catalog sync, so locking on the runtime stalled its workers.
- kind.rs: ItemKind/WorkKind/PlayKind replace the "live"/"movie"/
"series"/"episode" strings (and tmdb::Kind); Tauri rejects unknown
kinds at the IPC boundary.
- Split catalog.rs into catalog/{categories,channels,works,details,guide,
search}; sources/, works/ and cast/ get leaf modules for commands,
sync, store, grouping, channels, discovery and session. Shared
movie/series detail prelude (work_context).
- probe.rs statics become a managed Probe; playback::resolve uses a named
ItemRow and gets unit tests; XtreamLists has named fields.
- Error::TmdbRejected instead of matching the error message; write_m3u
propagates a failed category insert.
- SAFETY comments on every unsafe block; linux/macos share
player/render.rs; explicit mpv_sys imports; player commands return the
crate Result; no unchecked Instant subtraction; named timeouts; expect()
with the invariant instead of bare unwrap().
- Cast TLS verifier documents why it accepts any certificate; fixed two
spliced comment pairs (lib.rs, works/mod.rs).
- check.sh runs cargo fmt --check and denies undocumented unsafe blocks.
Frontend
- vitest only runs src/ (it also picked up stale copies under .deps/).
- Player page split into pages/player/ hooks and a key-binding table;
pure zap/next-episode logic with tests.
- One useChannelEpg hook (Player and Live shared a cache key with
different windows); playerWrite instead of swallowed errors;
writeSetting with rollback; typed Settings; MAX_VOLUME constants.
- Shared storage/item/routes helpers; dead exports removed; app version
from package.json; store reset between tests.
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.
Fixes every finding from the whole-repo refactoring review (31 smells across backend, frontend, build and tests).
Backend
parking_lotdatabase locks directly on tokio workers, and the writer is held for a whole catalog sync, so e.g. a favorite toggle during a sync blocked a runtime worker. They now go throughread_blocking/write_blocking(state.rs), which also replaces seven copy-pastedspawn_blocking(...).map_err(...)tails. This coverstmdb.rs,secrets.rsandsources, which held locks across.await.kind.rsaddsItemKind/WorkKind/PlayKind(serde lowercase,ToSql/FromSql). They replace about 87 string literals andtmdb::Kind. Unknown kinds are now rejected at the IPC boundary (unknown variant 'bogus') instead of silently picking the wrong table.catalog.rs(2,820 lines) is nowcatalog/{categories,channels,works,details,guide,search}.sources/,works/andcast/move their code into leaf modules.work_contextsetup.probe.rsstatics become a managedProbe.playback::resolveuses a namedItemRowand has unit tests.XtreamListshas named fields.Error::TmdbRejectedreplaces matching on the error message.write_m3upropagates a failed category insert instead of dropping it.unsafe/ FFI.unsafeblock has a// SAFETY:comment, andMpv'sSyncis documented separately.player/render.rs, and thempv_sysimports are explicit.Resultwith the same message strings.Instantsubtraction; named timeouts;expect()with the invariant instead of bareunwrap().check.shnow runscargo fmt --checkand deniesclippy::undocumented_unsafe_blocks.Frontend
src/. It had also been running stale suite copies under.deps/, reporting 209 tests when only 46 were real.pages/player/with a key-binding table; I checked it key for key against the old if/else chain. The zap and next-episode logic is now pure functions with tests.useChannelEpghook. Player and Live used the same cache key for different time windows (+6 h vs +12 h).playerWritereplaces the.catch(() => {})calls and covers player writes that had no catch at all.writeSettingrolls back on failure; settings are typed;MAX_VOLUME_*constants.package.json; the zustand store is reset between tests.Behavior changes
volume-max; it stopped at 130 before.Testing
scripts/check.shpasses: fmt, clippy-D warningsplus the unsafe lint, 92 Rust tests (2 ignored), tsc, 65 vitest tests, third-party notices.scripts/headless.sh) with a local M3U playlist:playresolves and starts mpv, and the version check fails cleanly on a dead URL.player_loadURLs are rejected.scripts/smoke.shagainst the real provider did not run, because.env.localwith the test-account credentials was missing.