Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
Improvements for semver compatibility
Merged fintohaps opened 6 months ago

This patch is a series of changes for further improving semver compatibility by using non_exhaustive and marking modules as private.

6 files changed +19 -11 30908dcf ed5a68c1
modified crates/radicle-crypto/src/lib.rs
@@ -28,6 +28,7 @@ pub type SharedSecret = [u8; 32];
/// Error returned if signing fails, eg. due to an HSM or KMS.
#[derive(Debug, Clone, Error)]
#[error(transparent)]
+
#[non_exhaustive]
pub struct SignerError {
    #[from]
    source: Arc<dyn std::error::Error + Send + Sync>,
@@ -93,6 +94,7 @@ impl fmt::Debug for Signature {
}

#[derive(Error, Debug)]
+
#[non_exhaustive]
pub enum SignatureError {
    #[error("invalid multibase string: {0}")]
    Multibase(#[from] multibase::Error),
@@ -273,6 +275,7 @@ impl Deref for SecretKey {
}

#[derive(Error, Debug)]
+
#[non_exhaustive]
pub enum PublicKeyError {
    #[error("invalid length {0}")]
    InvalidLength(usize),
modified crates/radicle-crypto/src/ssh.rs
@@ -16,6 +16,7 @@ use crate::PublicKey;
pub use keystore::{Keystore, Passphrase};

#[derive(Debug, Error)]
+
#[non_exhaustive]
pub enum ExtendedSignatureError {
    #[error(transparent)]
    Ssh(#[from] ssh_key::Error),
@@ -128,6 +129,7 @@ pub mod fmt {
}

#[derive(Debug, Error)]
+
#[non_exhaustive]
pub enum SignatureError {
    #[error(transparent)]
    Invalid(#[from] crypto::Error),
@@ -164,6 +166,7 @@ impl Encodable for crypto::Signature {
}

#[derive(Debug, Error)]
+
#[non_exhaustive]
pub enum PublicKeyError {
    #[error(transparent)]
    Invalid(#[from] crypto::Error),
@@ -199,6 +202,7 @@ impl Encodable for PublicKey {
}

#[derive(Debug, Error)]
+
#[non_exhaustive]
pub enum SecretKeyError {
    #[error(transparent)]
    Encoding(#[from] encoding::Error),
modified crates/radicle-crypto/src/ssh/keystore.rs
@@ -15,6 +15,7 @@ use super::ExtendedSignature;
pub type Passphrase = Zeroizing<String>;

#[derive(Debug, Error)]
+
#[non_exhaustive]
pub enum Error {
    #[error(transparent)]
    Io(#[from] io::Error),
@@ -227,6 +228,7 @@ impl Keystore {
}

#[derive(Debug, Error)]
+
#[non_exhaustive]
pub enum MemorySignerError {
    #[error(transparent)]
    Keystore(#[from] Error),
modified crates/radicle-node/src/lib.rs
@@ -3,19 +3,21 @@
// suggestions did not make sense.
#![allow(clippy::byte_char_slices)]

-
use std::str::FromStr;
-
use std::sync::LazyLock;
-

-
pub mod control;
pub mod fingerprint;
pub mod runtime;
+

+
mod control;
pub(crate) use radicle_protocol::service;
+
mod wire;
+
mod worker;
+

#[cfg(any(test, feature = "test"))]
pub mod test;
#[cfg(test)]
pub mod tests;
-
pub mod wire;
-
pub mod worker;
+

+
use std::str::FromStr;
+
use std::sync::LazyLock;

use radicle::version::Version;

modified crates/radicle-node/src/wire.rs
@@ -17,7 +17,7 @@ use cyphernet::{Digest, EcSk, Ecdh, Sha256};
use localtime::LocalTime;
use netservices::resource::{ListenerEvent, NetAccept, NetTransport, SessionEvent};
use netservices::session::{NoiseSession, ProtocolArtifact, Socks5Session};
-
use netservices::{NetConnection, NetReader, NetWriter};
+
use netservices::NetConnection;
use radicle::node::device::Device;
use reactor::{ResourceId, ResourceType, Timestamp};

@@ -70,10 +70,6 @@ pub enum Control {

/// Peer session type.
pub type WireSession<G> = NoiseSession<G, Sha256, Socks5Session<net::TcpStream>>;
-
/// Peer session type (read-only).
-
pub type WireReader = NetReader<Socks5Session<net::TcpStream>>;
-
/// Peer session type (write-only).
-
pub type WireWriter<G> = NetWriter<NoiseState<G, Sha256>, Socks5Session<net::TcpStream>>;

/// Reactor action.
type Action<G> = reactor::Action<NetAccept<WireSession<G>>, NetTransport<WireSession<G>>>;
modified crates/radicle/src/rad.rs
@@ -225,6 +225,7 @@ where
}

#[derive(Error, Debug)]
+
#[non_exhaustive]
pub enum CheckoutError {
    #[error("failed to fetch to working copy: {0}")]
    FetchIo(#[source] std::io::Error),