Files
Firelink/src-tauri/tests
NimBold bb618aef7d feat(queue): implement backend-driven download queue coordinator
This commit replaces the frontend-imperative download dispatcher with a centralized backend `QueueManager`. It acts as the sole concurrency gatekeeper using a single `tokio::sync::Semaphore` across all download paths (aria2 RPC, native HTTP, yt-dlp media).

Backend Changes:
- **queue**: Added `QueueManager` to manage an ordered `VecDeque` of tasks, semaphore permits, and retirement debt (CAS resize).
- **commands**: Replaced direct start commands with `enqueue_download`, `enqueue_many`, `move_in_queue`, and `remove_from_queue`.
- **ipc**: Exported `DownloadStateEvent` and `QueueDirection` to the frontend.
- **tests**: Added 11 integration tests covering idle-parking, idempotent releases, CAS underflow prevention, and gid-completion races.

Frontend Changes:
- **store**: Made `useDownloadStore` reactive to the backend via the `download-state` event.
- **store**: Removed `processQueue` and introduced `pendingOrder` to track the accurate sequence of queued items.
- **ui**: Updated `DownloadItem` with queue visuals (clock icon, position badge).
- **ui**: Added Move Up/Down controls to interact with the backend queue reordering API.
2026-06-16 17:52:20 +03:30
..

Headless Download Engine Tests

Run the full Rust suite:

cd src-tauri
cargo test --all-targets

Run only the async download integration harness with deterministic serial performance measurements and visible test output:

cd src-tauri
RUST_BACKTRACE=1 cargo test --test download_engine -- --test-threads=1 --nocapture

The harness binds an ephemeral loopback port and requires no GUI, external network access, or bundled media binaries. It validates:

  • aggregation of many streamed HTTP body chunks;
  • pause and ranged resume through DownloadCoordinator;
  • cancellation and partial-file cleanup;
  • SHA-256 integrity after resume;
  • retry recovery from transient HTTP failures;
  • terminal error reporting after the retry budget is exhausted;
  • a five-second local transfer performance budget for a 3 MiB fixture.