Skip to content

Conversation

gaius-qi
Copy link
Member

Description

This pull request introduces improved error handling and logging throughout the codebase, making it easier to diagnose and track down issues related to invalid parameters and missing data. Additionally, it adds a new feature to optionally include piece content when handling tasks. The most important changes are grouped below:

Error Handling and Logging Improvements:

  • Added detailed error logging using the error! macro in multiple locations where invalid parameters or missing fields are detected, such as missing headers, invalid addresses, missing persistent cache fields, and missing or invalid resource pieces. This provides clearer diagnostics for debugging and operational monitoring. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]
  • Updated imports to include the error macro from tracing where needed.

Task and Piece Handling Enhancements:

  • Added a need_piece_content boolean parameter to the Task struct and related logic, allowing tasks to optionally fetch and include piece content from local storage. This is useful for scenarios where the content is required for further processing. [1] [2]
  • Implemented logic to read piece content from local storage into the piece object when need_piece_content is set, including error handling for read failures.

These changes collectively improve the robustness and observability of the code, especially in error scenarios, and add flexibility in how task pieces are managed.

Related Issue

Motivation and Context

Screenshots (if appropriate)

…nt flag

Signed-off-by: Gaius <gaius.qi@gmail.com>
@gaius-qi gaius-qi added this to the v2.4.0 milestone Aug 21, 2025
@gaius-qi gaius-qi self-assigned this Aug 21, 2025
@gaius-qi gaius-qi added the enhancement New feature or request label Aug 21, 2025
Copy link

codecov bot commented Aug 21, 2025

Codecov Report

❌ Patch coverage is 23.46939% with 75 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.64%. Comparing base (bb94a4f) to head (e5e988d).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
dragonfly-client/src/resource/task.rs 0.00% 23 Missing ⚠️
dragonfly-client/src/bin/dfget/main.rs 0.00% 13 Missing ⚠️
...onfly-client/src/resource/persistent_cache_task.rs 0.00% 9 Missing ⚠️
dragonfly-client-storage/src/cache/mod.rs 0.00% 7 Missing ⚠️
dragonfly-client/src/bin/dfcache/stat.rs 0.00% 7 Missing ⚠️
dragonfly-client/src/bin/dfcache/export.rs 0.00% 6 Missing ⚠️
dragonfly-client/src/resource/piece_downloader.rs 0.00% 4 Missing ⚠️
dragonfly-client/src/grpc/dfdaemon_upload.rs 0.00% 2 Missing ⚠️
dragonfly-client/src/resource/piece.rs 75.00% 2 Missing ⚠️
dragonfly-client/src/dynconfig/mod.rs 0.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1296      +/-   ##
==========================================
- Coverage   48.72%   48.64%   -0.09%     
==========================================
  Files          60       60              
  Lines       15078    15154      +76     
==========================================
+ Hits         7347     7371      +24     
- Misses       7731     7783      +52     
Files with missing lines Coverage Δ
dragonfly-client-backend/src/http.rs 98.40% <100.00%> (+0.04%) ⬆️
dragonfly-client-backend/src/lib.rs 95.53% <100.00%> (+0.06%) ⬆️
dragonfly-client/src/grpc/manager.rs 25.00% <100.00%> (ø)
dragonfly-client/src/grpc/mod.rs 0.00% <ø> (ø)
dragonfly-client/src/dynconfig/mod.rs 0.00% <0.00%> (ø)
dragonfly-client/src/grpc/scheduler.rs 0.00% <0.00%> (ø)
dragonfly-client/src/grpc/dfdaemon_upload.rs 0.00% <0.00%> (ø)
dragonfly-client/src/resource/piece.rs 64.11% <75.00%> (+0.42%) ⬆️
dragonfly-client/src/resource/piece_downloader.rs 10.34% <0.00%> (-0.21%) ⬇️
dragonfly-client/src/bin/dfcache/export.rs 0.00% <0.00%> (ø)
... and 5 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@chlins chlins left a comment

Choose a reason for hiding this comment

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

lgtm

@chlins chlins enabled auto-merge (squash) August 21, 2025 03:48
Copy link
Contributor

@LunaWhispers LunaWhispers left a comment

Choose a reason for hiding this comment

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

lgtm

@chlins chlins merged commit 578fc8d into main Aug 21, 2025
9 checks passed
@chlins chlins deleted the feature/content branch August 21, 2025 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants