Skip to content

Conversation

@ClaudeHu
Copy link
Member

@ClaudeHu ClaudeHu commented Dec 8, 2025

For issue 213

Test after replacement

$ gtars bbcache cache-bed -i 70aee680c33c04ca9aa5def468a7182c -f /path/to/cache/folder
'70aee680c33c04ca9aa5def468a7182c' not found locally. Attempting to load from BEDbase...
Downloaded BED file 70aee680c33c04ca9aa5def468a7182c from BEDbase to path: /path/to/cache/folder/bedfiles/7/0/70aee680c33c04ca9aa5def468a7182c.bed.gz
$ gtars bbcache cache-bedset -i gse127562 -f /path/to/cache/folder
'gse127562' not found locally. Attempting to load from BEDbase...
Downloaded BED file 23f32335a31bcd80c5d2f0f6a0c75020 from BEDbase to path: /path/to/cache/folder/bedfiles/2/3/23f32335a31bcd80c5d2f0f6a0c75020.bed.gz
Downloaded BED file 7fc7f757eff600d5eb492d8b760ccefa from BEDbase to path: /path/to/cache/folder/bedfiles/7/f/7fc7f757eff600d5eb492d8b760ccefa.bed.gz
Downloaded BED file d451ecce9b462458cecb753d06564971 from BEDbase to path: /path/to/cache/folder/bedfiles/d/4/d451ecce9b462458cecb753d06564971.bed.gz
Downloaded BED file f204ae8184e3fb8924b8125c643145c7 from BEDbase to path: /path/to/cache/folder/bedfiles/f/2/f204ae8184e3fb8924b8125c643145c7.bed.gz

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces the reqwest HTTP client library with ureq to simplify dependency management and reduce the binary size. The change affects only the BEDbase API client functionality, specifically the method that downloads bedset metadata from the BEDbase API.

Key changes:

  • Replaced reqwest dependency with ureq version 3.1.4
  • Updated HTTP GET request implementation in download_bedset_data() method
  • Modified error handling to work with ureq's API

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
gtars-bbcache/Cargo.toml Replaced reqwest dependency (with blocking feature) with ureq 3.1.4
gtars-bbcache/src/client.rs Updated import statement and HTTP GET implementation to use ureq's API

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +373 to +374
.body_mut()
.read_to_string()
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .body_mut().read_to_string() pattern is incorrect for ureq. The read_to_string() method from std::io::Read requires a mutable String buffer as an argument (e.g., read_to_string(&mut buffer)), but this code doesn't provide one.

For ureq 3.x, the correct pattern is to use .into_string() which consumes the response and returns Result<String, Error>:

let response = get(&bedset_url)
    .call()
    .map_err(|e| anyhow!("Failed to GET {}: {}", bedset_url, e))?
    .into_string()
    .map_err(|e| anyhow!("Failed to read response body for {}: {}", bedset_url, e))?;

This is more idiomatic, handles errors properly, and avoids the need for the intermediate .body_mut() call.

Suggested change
.body_mut()
.read_to_string()
.into_string()

Copilot uses AI. Check for mistakes.
Copy link
Member

@khoroshevskyi khoroshevskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before approving, could you please change request also in core crate for RegionSet ?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@khoroshevskyi khoroshevskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few fixes needed, but everything looks good

@khoroshevskyi khoroshevskyi merged commit a993b2d into dev Dec 10, 2025
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.

3 participants