commit 2b6f6fcc2a59e5fdedbc1f61049486b7d32be92e
parent 1d5b57217083d47b65ff5b974f9cd53f67d35c21
Author: triesap <tyson@radroots.org>
Date: Fri, 3 Jul 2026 20:58:19 +0000
radrootsd: remove runtime path dead-code suppressions
Move resolver-only runtime contract helpers into test-owned boundaries.
Reference process path entrypoints from tests without executing ambient environment reads.
Diffstat:
2 files changed, 38 insertions(+), 18 deletions(-)
diff --git a/src/app/config.rs b/src/app/config.rs
@@ -403,12 +403,13 @@ mod tests {
load_settings_from_path_with_resolver,
};
use crate::app::paths::{
- default_runtime_paths_for_process, resolve_runtime_paths_with_resolver,
- runtime_contract_with_resolver,
+ RadrootsdRuntimeContractOutput, default_runtime_paths_for_process,
+ resolve_runtime_paths_with_resolver, runtime_contract_with_selection,
};
use radroots_runtime::RadrootsNostrServiceConfig;
use radroots_runtime_paths::{
RadrootsHostEnvironment, RadrootsPathProfile, RadrootsPathResolver, RadrootsPlatform,
+ RadrootsRuntimePathSelection,
};
fn linux_resolver(home: &str) -> RadrootsPathResolver {
@@ -436,6 +437,17 @@ mod tests {
}
}
+ fn runtime_contract_with_resolver(
+ resolver: &RadrootsPathResolver,
+ profile: RadrootsPathProfile,
+ repo_local_root: Option<&std::path::Path>,
+ ) -> anyhow::Result<RadrootsdRuntimeContractOutput> {
+ runtime_contract_with_selection(
+ resolver,
+ &RadrootsRuntimePathSelection::caller(profile, repo_local_root.map(PathBuf::from)),
+ )
+ }
+
#[test]
fn nip46_defaults_are_expected() {
let cfg = Nip46Config::default();
diff --git a/src/app/paths.rs b/src/app/paths.rs
@@ -96,7 +96,6 @@ pub(crate) fn default_publish_proxy_database_path() -> PathBuf {
.publish_proxy_database_path
}
-#[cfg_attr(test, allow(dead_code))]
pub fn default_config_path_for_process() -> Result<PathBuf> {
Ok(default_runtime_paths_for_process()?.config_path)
}
@@ -105,25 +104,12 @@ pub fn default_identity_path_for_process() -> Result<PathBuf> {
Ok(default_runtime_paths_for_process()?.identity_path)
}
-#[cfg_attr(test, allow(dead_code))]
pub fn runtime_contract_for_process() -> Result<RadrootsdRuntimeContractOutput> {
let selection = process_path_selection_with_sources()?;
runtime_contract_with_selection(&RadrootsPathResolver::current(), &selection)
}
-#[cfg_attr(not(test), allow(dead_code))]
-pub(crate) fn runtime_contract_with_resolver(
- resolver: &RadrootsPathResolver,
- profile: RadrootsPathProfile,
- repo_local_root: Option<&Path>,
-) -> Result<RadrootsdRuntimeContractOutput> {
- runtime_contract_with_selection(
- resolver,
- &RadrootsRuntimePathSelection::caller(profile, repo_local_root.map(Path::to_path_buf)),
- )
-}
-
-fn runtime_contract_with_selection(
+pub(crate) fn runtime_contract_with_selection(
resolver: &RadrootsPathResolver,
selection: &RadrootsRuntimePathSelection,
) -> Result<RadrootsdRuntimeContractOutput> {
@@ -157,9 +143,24 @@ mod tests {
use radroots_runtime_paths::{
RadrootsHostEnvironment, RadrootsPathProfile, RadrootsPathResolver, RadrootsPlatform,
+ RadrootsRuntimePathSelection,
};
- use super::runtime_contract_with_resolver;
+ use super::{
+ RadrootsdRuntimeContractOutput, default_config_path_for_process,
+ runtime_contract_for_process, runtime_contract_with_selection,
+ };
+
+ fn runtime_contract_with_resolver(
+ resolver: &RadrootsPathResolver,
+ profile: RadrootsPathProfile,
+ repo_local_root: Option<&std::path::Path>,
+ ) -> anyhow::Result<RadrootsdRuntimeContractOutput> {
+ runtime_contract_with_selection(
+ resolver,
+ &RadrootsRuntimePathSelection::caller(profile, repo_local_root.map(PathBuf::from)),
+ )
+ }
fn linux_resolver() -> RadrootsPathResolver {
RadrootsPathResolver::new(
@@ -172,6 +173,13 @@ mod tests {
}
#[test]
+ fn process_path_entrypoints_remain_linked_in_test_builds() {
+ let _default_config_path: fn() -> anyhow::Result<PathBuf> = default_config_path_for_process;
+ let _runtime_contract: fn() -> anyhow::Result<RadrootsdRuntimeContractOutput> =
+ runtime_contract_for_process;
+ }
+
+ #[test]
fn runtime_contract_output_contains_canonical_runtime_paths() {
let contract = runtime_contract_with_resolver(
&linux_resolver(),