fix download logs IPC for details panel
Merged
MP
7mo ago+370+370+012345678901234567890123456789-21-21-01234567890123456789
Summary
Closes #47.
This PR fixes the download details logs panel by wiring it to a real Tauri IPC command and a backend log source scoped by download_id.
Root Cause
LogsSection was invoking a non-existent IPC command, query_download_logs, and was passing the download id as a string. As a result, the panel always fell back to No logs.
What Changed
- renamed the frontend IPC call to
download_logs - converted
downloadIdto a numericidbefore invoking Tauri - added a lightweight per-download in-memory log store in Rust
- added an event bridge that records log lines from
DomainEvents for each download - exposed a new
download_logs(id, limit)Tauri command - added regression tests for the frontend IPC contract and Rust log-store behavior
Impact
The logs section in the details panel now shows actual lines for the selected download during the current app session instead of always rendering No logs.
Validation
npm run lintnpm run typechecknpm test -- src/views/DownloadDetailsPanel/__tests__/LogsSection.test.tsxcargo fmt --check --manifest-path src-tauri/Cargo.tomlcargo test --manifest-path src-tauri/Cargo.toml download_log_- pre-push hooks:
- Rust test suite
- TypeScript typecheck
- TypeScript test suite
rtk proxy npx -y react-doctor@latest . --verbose --diff
Summary by cubic
Fixes the Download Details logs panel by wiring LogsSection to a real IPC and a per‑download in‑memory log store, so it shows logs for the selected download, auto‑refreshes, and clears when a download is removed. Addresses issue #47 by scoping log retrieval to download_id.
- Bug Fixes
- Frontend: call
download_logswith{ id: Number(downloadId), limit }, set stable query keys, addrefetchInterval, and use stable keys for duplicate lines. - Backend: add
DownloadLogStore(per‑download ring buffer) and log bridge to record lines fromDomainEvents; introduceDownloadRemovedand publish it from cancel/remove so logs purge on removal. - IPC/App: expose
download_logs(id, limit)via Tauri, includedownload_log_storeinAppState, and forwarddownload-removedevents; add tests for IPC invocation, event mapping/removal purge, and panel refetch.
- Frontend: call
Summary by CodeRabbit
- New Features
- Per-download activity logs capturing lifecycle and segment events (start, pause, resume, retry, complete, fail, etc.).
- Logs can be fetched via the app and are shown in the Download Details panel with periodic auto-refresh while open.
- Behavior
- Removing a download clears its stored logs.
- Tests
- Added tests for log entry formatting, no-ops for unrelated events, log-clearing on removal, and UI refetch behavior.