commit 830a5a4f05ba6a1233f5144a80bd5de1516c4322
parent 87d92b3424b65da9729ded2a0f9a1b5a73b22adf
Author: triesap <tyson@radroots.org>
Date: Sat, 22 Aug 2026 04:44:12 +0000
admin: align native portability guards
Diffstat:
5 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/src/lib.rs b/src/lib.rs
@@ -1,6 +1,7 @@
#![forbid(unsafe_code)]
#![doc = include_str!("../README")]
+#[cfg(any(target_os = "linux", target_os = "macos"))]
mod admin_v1;
mod cli_v1;
mod config_v1;
@@ -34,6 +35,7 @@ mod state_repository;
mod state_request;
mod state_response;
+#[cfg(any(target_os = "linux", target_os = "macos"))]
pub use admin_v1::{
MycAdminDocumentError, MycAdminDocumentErrorKind, MycAdminFuture, MycAdminHandler,
MycAdminHandlerError, MycAdminHandlerErrorKind, MycAdminMethod, MycAdminRequestDocument,
diff --git a/src/nip46_work.rs b/src/nip46_work.rs
@@ -302,7 +302,7 @@ pub struct MycNip46Work {
}
impl MycNip46Work {
- #[cfg(test)]
+ #[cfg(all(test, any(target_os = "linux", target_os = "macos")))]
pub(crate) fn local_for_test(
request: MycSignerRequestRecord,
connection: MycConnectionRecord,
diff --git a/src/state_completion.rs b/src/state_completion.rs
@@ -4,12 +4,12 @@ use core::fmt;
use std::error::Error;
use radroots_service_sqlite::ServiceSqliteTransaction;
-#[cfg(test)]
+#[cfg(all(test, any(target_os = "linux", target_os = "macos")))]
use radroots_service_sqlite::{ServiceSqliteTransactionError, ServiceSqliteTransactionErrorKind};
use sha2::{Digest, Sha256};
use sqlx::Row;
-#[cfg(test)]
+#[cfg(all(test, any(target_os = "linux", target_os = "macos")))]
use crate::state_repository::{
MycStateRepository, MycStateRepositoryError, MycStateRepositoryErrorKind, PersistedMetadata,
RepositoryOperationError, require_expected_metadata,
@@ -311,7 +311,7 @@ impl MycNip46CommitRequest {
})
}
- #[cfg(test)]
+ #[cfg(all(test, any(target_os = "linux", target_os = "macos")))]
pub(crate) fn fail_after_session_effect_for_test(mut self) -> Self {
self.fail_after_session_effect = true;
self
@@ -410,7 +410,7 @@ impl fmt::Debug for MycNip46CommitAdmission {
}
}
-#[cfg(test)]
+#[cfg(all(test, any(target_os = "linux", target_os = "macos")))]
impl MycStateRepository<'_> {
/// Atomically records the Step 147 completion component.
///
@@ -814,7 +814,7 @@ fn require_one(rows: u64) -> Result<(), CommitOperationError> {
.ok_or(CommitOperationError::Storage)
}
-#[cfg(test)]
+#[cfg(all(test, any(target_os = "linux", target_os = "macos")))]
const fn map_repository_error(error: RepositoryOperationError) -> CommitOperationError {
match error {
RepositoryOperationError::Binding => CommitOperationError::Binding,
@@ -822,7 +822,7 @@ const fn map_repository_error(error: RepositoryOperationError) -> CommitOperatio
}
}
-#[cfg(test)]
+#[cfg(all(test, any(target_os = "linux", target_os = "macos")))]
fn map_transaction_error(
error: ServiceSqliteTransactionError<CommitOperationError>,
) -> MycStateRepositoryError {
diff --git a/src/state_response.rs b/src/state_response.rs
@@ -236,14 +236,14 @@ impl MycNip46ResponseCommitRequest {
}
}
- #[cfg(test)]
+ #[cfg(all(test, any(target_os = "linux", target_os = "macos")))]
pub(crate) fn fail_after_completion_for_test(&self) -> Self {
let mut request = self.owned();
request.fail_after_completion = true;
request
}
- #[cfg(test)]
+ #[cfg(all(test, any(target_os = "linux", target_os = "macos")))]
pub(crate) fn fail_after_response_for_test(&self) -> Self {
let mut request = self.owned();
request.fail_after_response = true;
diff --git a/tests/package_boundary.rs b/tests/package_boundary.rs
@@ -454,6 +454,12 @@ fn step146_first_wave_gate_is_machine_bound_and_test_only() {
#[test]
fn step150_admin_adapter_is_closed_typed_and_transport_bounded() {
+ assert!(
+ ROOT.contains("#[cfg(any(target_os = \"linux\", target_os = \"macos\"))]\nmod admin_v1;")
+ );
+ assert!(ROOT.contains(
+ "#[cfg(any(target_os = \"linux\", target_os = \"macos\"))]\npub use admin_v1::{"
+ ));
for required in [
"pub const ALL: [Self; 21]",
"models.len() == 35",