Skip to content

feat(grpc): add block list support for download and upload tasks#1660

Merged
chlins merged 4 commits intomainfrom
feat/blocklist
Feb 10, 2026
Merged

feat(grpc): add block list support for download and upload tasks#1660
chlins merged 4 commits intomainfrom
feat/blocklist

Conversation

@chlins
Copy link
Member

@chlins chlins commented Feb 4, 2026

This pull request introduces logic to block certain download and upload tasks based on configurable block lists, and adds new metrics to track when such tasks are blocked. It updates both the download and upload gRPC server implementations to consult the block list before proceeding with a task, returning a permission denied error if blocked. Additionally, it adds Prometheus metrics to count blocked download and upload tasks, and updates dependencies accordingly.

Block list enforcement and metrics tracking:

  • Added logic to both DfdaemonDownloadServerHandler and DfdaemonUploadServerHandler to check block lists (using is_task_download_blocked, is_persistent_task_download_blocked, and is_persistent_cache_task_download_blocked) before processing download and upload requests. If a task is blocked, the server now logs a warning, increments a new blocked-task metric, and returns a permission denied error. [1] [2] [3] [4] [5] [6]

  • Added new Prometheus metrics DOWNLOAD_TASK_BLOCKED_COUNT and UPLOAD_TASK_BLOCKED_COUNT in dragonfly-client-metric/src/lib.rs, along with corresponding collection functions collect_download_task_blocked_metrics and collect_upload_task_blocked_metrics, and registered these metrics in the registry. [1] [2] [3]

Dependency and configuration updates:

  • Updated the dragonfly-api dependency version from 2.2.13 to 2.2.14 in Cargo.toml.
  • Added regex as a workspace dependency in dragonfly-client/Cargo.toml.

Infrastructure and code structure:

  • Updated constructors and struct definitions for download/upload servers and handlers to include a reference to the dynamic configuration (Dynconfig), which is now used in block list checks. [1] Fd27329fL114R133, [2] [3] [4] Fc6ac6f5L118R137, [5] [6]
  • Added the blocklist module to the gRPC module tree.

Minor improvements:

  • Extended logging to include warnings when a download or upload is blocked by the block list. [1] [2]

These changes collectively enhance the system's ability to control which tasks are allowed based on dynamic policies, and provide observability into how often tasks are being blocked.

Description

Related Issue

Motivation and Context

Screenshots (if appropriate)

@chlins chlins added the enhancement New feature or request label Feb 4, 2026
@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

❌ Patch coverage is 73.69863% with 96 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.86%. Comparing base (035ae91) to head (7f33cdb).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
dragonfly-client/src/grpc/block_list.rs 78.88% 72 Missing ⚠️
dragonfly-client-metric/src/lib.rs 0.00% 18 Missing ⚠️
dragonfly-client/src/grpc/dfdaemon_download.rs 0.00% 3 Missing ⚠️
dragonfly-client/src/dynconfig/mod.rs 0.00% 2 Missing ⚠️
dragonfly-client/src/bin/dfdaemon/main.rs 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1660      +/-   ##
==========================================
+ Coverage   50.83%   50.86%   +0.02%     
==========================================
  Files          83       84       +1     
  Lines       20029    20522     +493     
==========================================
+ Hits        10182    10438     +256     
- Misses       9847    10084     +237     
Files with missing lines Coverage Δ
dragonfly-client/src/grpc/mod.rs 0.00% <ø> (ø)
dragonfly-client/src/proxy/mod.rs 0.00% <ø> (ø)
dragonfly-client/src/bin/dfdaemon/main.rs 0.00% <0.00%> (ø)
dragonfly-client/src/dynconfig/mod.rs 0.00% <0.00%> (ø)
dragonfly-client/src/grpc/dfdaemon_download.rs 4.67% <0.00%> (-0.02%) ⬇️
dragonfly-client-metric/src/lib.rs 73.17% <0.00%> (-1.54%) ⬇️
dragonfly-client/src/grpc/block_list.rs 78.88% <78.88%> (ø)

... and 5 files with indirect coverage changes

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

@chlins chlins force-pushed the feat/blocklist branch 4 times, most recently from 837e6cb to f4b054b Compare February 9, 2026 04:22
Signed-off-by: chlins <chlins.zhang@gmail.com>
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

Adds dynamic block list enforcement to dfdaemon task handling and exposes new Prometheus counters to observe blocked download/upload attempts, using dynconfig-provided policy from the scheduler cluster.

Changes:

  • Enforce block list checks in dfdaemon download/upload task RPC paths and return PermissionDenied when blocked (with new blocked-task metrics).
  • Introduce a grpc::blocklist module and extend dynconfig to deserialize scheduler-provided client/seed-client block list configuration.
  • Add new Prometheus counters for blocked download/upload tasks and map gRPC PermissionDenied to HTTP 403 in the proxy.

Reviewed changes

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

Show a summary per file
File Description
dragonfly-client/src/proxy/mod.rs Maps gRPC PermissionDenied to HTTP 403 Forbidden for proxy-via-dfdaemon flow.
dragonfly-client/src/grpc/mod.rs Exposes the new blocklist module in the gRPC module tree.
dragonfly-client/src/grpc/dfdaemon_download.rs Adds block list enforcement + metrics for download/persistent/persistent-cache download & upload RPCs.
dragonfly-client/src/grpc/blocklist.rs Implements block list evaluation logic (including regex matching) with unit tests.
dragonfly-client/src/dynconfig/mod.rs Adds block list config structs and deserializes scheduler cluster client/seed-client config JSON into dynconfig state.
dragonfly-client/src/bin/dfdaemon/main.rs Wires dynconfig into the download gRPC server constructor.
dragonfly-client/Cargo.toml Adds regex as a workspace dependency for the client crate.
dragonfly-client-metric/src/lib.rs Adds and registers blocked-task counters + collection helpers.
Cargo.toml Bumps dragonfly-api to 2.2.14.
Cargo.lock Lockfile updates for dragonfly-api bump and new dependency resolution.

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

Signed-off-by: chlins <chlins.zhang@gmail.com>
…feat/blocklist

Signed-off-by: Gaius <gaius.qi@gmail.com>
Signed-off-by: Gaius <gaius.qi@gmail.com>
Copy link
Member

@gaius-qi gaius-qi 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 b16030f into main Feb 10, 2026
6 of 7 checks passed
@chlins chlins deleted the feat/blocklist branch February 10, 2026 10:01
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