Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@patrick-ogrady
Copy link
Contributor

@patrick-ogrady patrick-ogrady commented Sep 7, 2025

Fixes: #1548
Alternative: #1549

@patrick-ogrady patrick-ogrady marked this pull request as ready for review September 8, 2025 16:24
#[derive(Error, Debug)]
pub enum Error {
#[error("send failed: {0}")]
SendFailed(AnyError),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This approach can be taken to finally finish #1200

danlaine
danlaine previously approved these changes Sep 8, 2025
use commonware_p2p::{Recipients, Sender};
use thiserror::Error;

/// Errors that can be returned by [Failing].
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We define a standalone error type here to avoid accidentally satisfying some test case (if matched against crate::Error)

pub trait Sender: Clone + Debug + Send + 'static {
/// Error that can occur when sending a message.
type Error: Debug + StdError + Send;
type Error: Debug + StdError + Send + Sync;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't need to fix in this PR but we should have our own trait that requires all of these. Also it looks like std::error::Error already requires Debug, but it's fine to keep Debug here for now for consistency with other files in the monorepo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I almost added one but wanted to keep it minimal

#[derive(Error, Debug)]
pub enum Error {
#[error("send failed: {0}")]
SendFailed(anyhow::Error),
Copy link
Collaborator

Choose a reason for hiding this comment

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

so nice to not have to have a generic type on enum Error

@patrick-ogrady patrick-ogrady merged commit c654d6d into main Sep 8, 2025
37 checks passed
@patrick-ogrady patrick-ogrady deleted the minimal-collector-fix branch September 8, 2025 17:45
@codecov
Copy link

codecov bot commented Sep 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.07%. Comparing base (bb428d2) to head (b955658).
⚠️ Report is 3 commits behind head on main.

@@            Coverage Diff             @@
##             main    #1560      +/-   ##
==========================================
+ Coverage   92.02%   92.07%   +0.04%     
==========================================
  Files         284      286       +2     
  Lines       73163    73734     +571     
==========================================
+ Hits        67331    67887     +556     
- Misses       5832     5847      +15     
Files with missing lines Coverage Δ
collector/src/p2p/engine.rs 86.40% <100.00%> (+1.60%) ⬆️
collector/src/p2p/ingress.rs 100.00% <100.00%> (ø)
collector/src/p2p/mocks/sender.rs 100.00% <100.00%> (ø)
collector/src/p2p/mod.rs 98.95% <100.00%> (+0.15%) ⬆️
utils/src/lib.rs 100.00% <ø> (ø)

... and 9 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb428d2...b955658. Read the comment docs.

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

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.

Panic in monorepo/collector/src/p2p/ingress.rs:49

3 participants