Migrate all IPC call sites to typed tauri-specta commands.*
🏗️ Build and Test JellyTau / Run Tests (pull_request) Successful in 4m39s
Traceability Validation / Check Requirement Traces (pull_request) Failing after 36s
🏗️ Build and Test JellyTau / Build Android APK (pull_request) Failing after 1m57s

Replace the remaining ~155 untyped invoke() calls across stores, services,
components, and routes with the generated commands.* wrappers from
$lib/api/bindings, so every IPC call is compile-time-checked against the
command signatures.

- Register repository_get_subtitle_url and repository_get_video_download_url
  in specta_builder() and the invoke_handler; regenerate bindings.ts.
- Source duplicated wire types (AutoplaySettings, CacheConfig, Session,
  ConnectivityStatus, audio/video settings, etc.) from bindings.
- Fix two bugs surfaced by the typed wrappers:
  - VideoDownloadButton passed an un-awaited Promise as the stream URL.
  - setAutoplaySettings omitted the required userId argument.
- Update unit tests asserting the old invoke(name, args) shape.
- Remove the five param-naming guard tests; the compiler and codegen now
  enforce what they checked.

svelte-check: 0 errors. vitest: green. cargo test --lib: green.
This commit is contained in:
2026-06-21 08:47:04 +02:00
parent 14e9d7e03a
commit d01c2aab9f
47 changed files with 456 additions and 2119 deletions
+10 -17
View File
@@ -6,8 +6,8 @@
import { writable, derived } from "svelte/store";
import { browser } from "$app/environment";
import { invoke } from "@tauri-apps/api/core";
import { listen } from "@tauri-apps/api/event";
import { commands } from "$lib/api/bindings";
export interface ConnectivityState {
/** Browser's navigator.onLine status */
@@ -29,13 +29,6 @@ export interface ConnectivityEvents {
onServerReconnected?: () => void;
}
interface RustConnectivityStatus {
isServerReachable: boolean;
lastChecked: string | null;
connectionError: string | null;
isChecking: boolean;
}
function createConnectivityStore() {
const initialState: ConnectivityState = {
isOnline: browser ? navigator.onLine : true,
@@ -115,10 +108,10 @@ function createConnectivityStore() {
*/
async function checkServerReachable(): Promise<boolean> {
try {
const isReachable = await invoke<boolean>("connectivity_check_server");
const isReachable = await commands.connectivityCheckServer();
// Fetch updated status from Rust
const status = await invoke<RustConnectivityStatus>("connectivity_get_status");
const status = await commands.connectivityGetStatus();
update((s) => ({
...s,
isServerReachable: status.isServerReachable,
@@ -145,13 +138,13 @@ function createConnectivityStore() {
console.log("[ConnectivityStore] Starting monitoring for:", url);
// Set the server URL
await invoke("connectivity_set_server_url", { url });
await commands.connectivitySetServerUrl(url);
// Start the Rust monitoring task (performs immediate check)
await invoke("connectivity_start_monitoring");
await commands.connectivityStartMonitoring();
// Get the initial status immediately after starting
const status = await invoke<RustConnectivityStatus>("connectivity_get_status");
const status = await commands.connectivityGetStatus();
update((s) => ({
...s,
isServerReachable: status.isServerReachable,
@@ -179,7 +172,7 @@ function createConnectivityStore() {
if (!isMonitoring) return;
try {
await invoke("connectivity_stop_monitoring");
await commands.connectivityStopMonitoring();
isMonitoring = false;
eventHandlers = {};
console.log("[ConnectivityStore] Stopped monitoring");
@@ -193,7 +186,7 @@ function createConnectivityStore() {
*/
async function setServerUrl(url: string): Promise<void> {
try {
await invoke("connectivity_set_server_url", { url });
await commands.connectivitySetServerUrl(url);
} catch (error) {
console.error("[ConnectivityStore] Failed to set server URL:", error);
}
@@ -211,7 +204,7 @@ function createConnectivityStore() {
*/
async function markReachable(): Promise<void> {
try {
await invoke("connectivity_mark_reachable");
await commands.connectivityMarkReachable();
// Update local state
update((s) => ({
@@ -230,7 +223,7 @@ function createConnectivityStore() {
*/
async function markUnreachable(error?: string): Promise<void> {
try {
await invoke("connectivity_mark_unreachable", { error: error ?? null });
await commands.connectivityMarkUnreachable(error ?? null);
// Update local state
update((s) => ({