refactor: drop dead code surfaced by cargo

cargo check was showing five real warnings, all genuinely dead:

* container/mod.rs   — re-exports compute_container_name, AdoptionReport,
                       ReconcileAction, ReconcileReport were unused outside
                       prod_orchestrator. Drop from the pub use line.
* prod_orchestrator  — with_runtime + insert_manifest_for_test only exist
                       for the test module in the same file. Mark them
                       #[cfg(test)] so they don't appear in release builds.
* async_lifecycle    — remove_package_entry has no callers; doc claims
                       "used for install-failure cleanup" but nothing
                       cleans up. Delete (10 lines).
* registry.rs        — `use tracing::{debug, info};` had no consumers.
* fips.rs            — unused-assignment chain on last_status. The poll
                       loop always sets it on every break path, so the
                       initial `None` and the unwrap_or_else fallback
                       were both dead. Refactored to `let after = loop
                       { ...; break s; };`.

cargo check is now clean. cargo test --workspace --bins: 614 passed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
archipelago 2026-05-01 15:34:02 -04:00
parent 45c1f0b6d1
commit 1c0df95f9a
5 changed files with 9 additions and 30 deletions

View File

@ -98,21 +98,14 @@ impl RpcHandler {
// Anchor bootstrap window: poll the status every ~3s for up to
// 20s. Bail as soon as the anchor is connected.
let mut last_status: Option<fips::FipsStatus> = None;
let deadline = std::time::Instant::now() + std::time::Duration::from_secs(20);
loop {
let after = loop {
tokio::time::sleep(std::time::Duration::from_secs(3)).await;
let s = fips::FipsStatus::query(&self.config.data_dir).await;
if s.anchor_connected {
last_status = Some(s);
break;
if s.anchor_connected || std::time::Instant::now() >= deadline {
break s;
}
last_status = Some(s);
if std::time::Instant::now() >= deadline {
break;
}
}
let after = last_status.unwrap_or_else(|| before.clone());
};
let recovered = after.anchor_connected && !before.anchor_connected;
let likely_cause = if after.anchor_connected {

View File

@ -410,16 +410,6 @@ async fn set_package_state_and_clear_uninstall_stage(
}
}
/// Remove a package entry from state. Used for install-failure cleanup
/// (since there's no pre-state to revert to — the entry was created
/// speculatively when we flipped to Installing).
async fn remove_package_entry(state_manager: &StateManager, package_id: &str) {
let (mut data, _) = state_manager.get_snapshot().await;
if data.package_data.remove(package_id).is_some() {
state_manager.update_data(data).await;
}
}
/// Kick the container scanner to run immediately and wait for it to finish
/// (with a 2s timeout). Used by install/update success paths so the fresh
/// manifest — with `interfaces.main.ui` populated from the now-running

View File

@ -14,8 +14,5 @@ pub mod traits;
pub use boot_reconciler::{BootReconciler, DEFAULT_INTERVAL as RECONCILER_DEFAULT_INTERVAL};
pub use dev_orchestrator::DevContainerOrchestrator;
pub use docker_packages::DockerPackageScanner;
pub use prod_orchestrator::{
compute_container_name, AdoptionReport, ProdContainerOrchestrator, ReconcileAction,
ReconcileReport,
};
pub use prod_orchestrator::ProdContainerOrchestrator;
pub use traits::ContainerOrchestrator;

View File

@ -187,9 +187,9 @@ impl ProdContainerOrchestrator {
})
}
/// Test/advanced constructor: inject an arbitrary runtime + manifests dir.
///
/// This is the entry point used by unit tests with a `MockRuntime`.
/// Test constructor: inject an arbitrary runtime + manifests dir. Used
/// by unit tests with `MockRuntime`.
#[cfg(test)]
pub fn with_runtime(runtime: Arc<dyn ContainerRuntimeTrait>, manifests_dir: PathBuf) -> Self {
Self {
runtime,
@ -274,7 +274,7 @@ impl ProdContainerOrchestrator {
}
/// Test helper: inject a manifest directly without touching the filesystem.
#[doc(hidden)]
#[cfg(test)]
pub async fn insert_manifest_for_test(&self, manifest: AppManifest, manifest_dir: PathBuf) {
let mut state = self.state.write().await;
state.manifests.insert(

View File

@ -8,7 +8,6 @@ use anyhow::{Context, Result};
use serde::{Deserialize, Serialize};
use std::path::Path;
use tokio::fs;
use tracing::{debug, info};
const REGISTRY_FILE: &str = "config/registries.json";
const OVH_REGISTRY_URL: &str = "146.59.87.168:3000/lfg2025";