mirror of
https://github.com/codewhale-hq/Codewhale.git
synced 2026-11-08 01:48:20 -10:00
fix(ci): unbreak the Windows build and rustfmt gate on main
Every PR's required checks were red for reasons on main itself: - Lint: `cargo fmt --check` diffed two hunks in crates/tui/src/mcp.rs from e1acc381ab; formatted. - Test (windows-latest): dead code is denied on Windows, where code that is Unix-only or compiled out by the debug test-isolation gate leaves helpers unused. `native_snapshot_roots` (read only under cfg(not(windows))) and the cfg(test) `load_global_context_file` get `cfg_attr(windows, expect(dead_code))`; the Ollama probe helpers (`TAGS_PROBE_TIMEOUT`, `probe_client`, `fetch_text`, `fetch_tag_profile`, `ollama_v1_base_url`, `record_ollama_tags_into_lake`, `probe_live_local_ollama_catalog`) and `acquire_runtime_chat_inference_ownership`, which S23 placed behind the shared test-isolation predicate, get `cfg_attr(windows, allow(dead_code))`. The supervisor attribute was written by the #7091 session and left uncommitted; taken over here. The Windows "dsh-message-compat.js no longer names dsh-brand" failure is CRLF checkout changing the pinned source hash; contributor PR #7109 fixes that and lands separately. Verified: rustfmt --check clean on mcp.rs; the attributes match the exact items in Test (windows-latest) on PR #7105 (job 122399216069). A local x86_64-pc-windows-msvc check could not complete (aws-lc-sys needs MSVC headers), so Windows proof comes from the next PR CI run on this main. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
3a72047c1b
commit
715bb2ed02
6 files changed
+21
-9
No files matched your search
@@ -111,6 +111,7 @@ pub(crate) struct RemoteControlInferencePermit {
|
||||
}
|
||||
|
||||
#[cfg(any(test, all(feature = "test-thread-scoped-state", debug_assertions)))]
|
||||
#[cfg_attr(windows, allow(dead_code))]
|
||||
pub(crate) async fn acquire_runtime_chat_inference_ownership() -> RuntimeChatInferenceOwnership {
|
||||
let gate = runtime_chat_inference_gate().write_owned().await;
|
||||
RuntimeChatInferenceOwnership { _gate: gate }
|
||||
|
||||
@@ -5,6 +5,7 @@ use codewhale_config::catalog::{
|
||||
};
|
||||
use serde::Deserialize;
|
||||
|
||||
#[cfg_attr(windows, allow(dead_code))]
|
||||
pub(crate) const TAGS_PROBE_TIMEOUT: Duration = Duration::from_secs(2);
|
||||
|
||||
/// Upper bound on `/api/show` lookups per probe. A developer box can hold
|
||||
@@ -207,6 +208,7 @@ pub(crate) fn ollama_catalog_delta(
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(windows, allow(dead_code))]
|
||||
pub(crate) fn probe_client() -> anyhow::Result<reqwest::Client> {
|
||||
// The first-run probe can run before any provider client has installed
|
||||
// the rustls crypto provider; the shared builder installs it (the bare
|
||||
@@ -216,6 +218,7 @@ pub(crate) fn probe_client() -> anyhow::Result<reqwest::Client> {
|
||||
.build()?)
|
||||
}
|
||||
|
||||
#[cfg_attr(windows, allow(dead_code))]
|
||||
pub(crate) async fn fetch_text(url: &str) -> anyhow::Result<String> {
|
||||
let response = probe_client()?.get(url).send().await?;
|
||||
if !response.status().is_success() {
|
||||
@@ -226,6 +229,7 @@ pub(crate) async fn fetch_text(url: &str) -> anyhow::Result<String> {
|
||||
.map_err(|reason| anyhow::anyhow!("Ollama catalog response rejected: {reason:?}"))
|
||||
}
|
||||
|
||||
#[cfg_attr(windows, allow(dead_code))]
|
||||
pub(crate) async fn fetch_tag_profile(origin: &str, tag: &str) -> anyhow::Result<OllamaTagProfile> {
|
||||
let response = probe_client()?
|
||||
.post(format!("{origin}/api/show"))
|
||||
|
||||
@@ -1556,6 +1556,7 @@ pub(crate) struct HostProcess {
|
||||
/// How the cap is enforced for this process, settled at the handshake.
|
||||
memory: Arc<std::sync::OnceLock<MemoryEnforcement>>,
|
||||
pub sandbox: HostSandbox,
|
||||
#[cfg_attr(windows, expect(dead_code))]
|
||||
native_snapshot_roots: Vec<PathBuf>,
|
||||
tree: Arc<codewhale_runtime::process_tree::ProcessTree>,
|
||||
#[cfg(windows)]
|
||||
|
||||
@@ -59,6 +59,7 @@ pub(crate) fn should_adopt_live_local_ollama(
|
||||
}
|
||||
|
||||
/// Resolve the OpenAI-compat Ollama base URL (`…/v1`) from config defaults.
|
||||
#[cfg_attr(windows, allow(dead_code))]
|
||||
pub(crate) fn ollama_v1_base_url(config: &Config) -> String {
|
||||
config
|
||||
.resolve_provider_pin_identity("ollama")
|
||||
@@ -68,6 +69,7 @@ pub(crate) fn ollama_v1_base_url(config: &Config) -> String {
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
#[cfg_attr(windows, allow(dead_code))]
|
||||
fn record_ollama_tags_into_lake(
|
||||
endpoint_v1: &str,
|
||||
tags: &[String],
|
||||
@@ -98,6 +100,7 @@ fn record_ollama_tags_into_lake(
|
||||
/// Probe local Ollama for a live catalog. Prefers native `/api/tags`, falls
|
||||
/// back to OpenAI-compat `/v1/models`. Returns `None` when nothing useful
|
||||
/// answered — never invents a tag.
|
||||
#[cfg_attr(windows, allow(dead_code))]
|
||||
pub(crate) async fn probe_live_local_ollama_catalog(
|
||||
config: &Config,
|
||||
) -> Option<LiveLocalOllamaCatalog> {
|
||||
|
||||
+11
-9
@@ -1442,14 +1442,14 @@ fn verify_mcp_skill_file(file: &McpSkillFile, result: &serde_json::Value) -> Res
|
||||
.decode(blob)
|
||||
.context("MCP skill file blob is not base64")?
|
||||
};
|
||||
let digest = sha2::Sha256::digest(&bytes).iter().fold(
|
||||
String::from("sha256:"),
|
||||
|mut out, byte| {
|
||||
use std::fmt::Write as _;
|
||||
let _ = write!(out, "{byte:02x}");
|
||||
out
|
||||
},
|
||||
);
|
||||
let digest =
|
||||
sha2::Sha256::digest(&bytes)
|
||||
.iter()
|
||||
.fold(String::from("sha256:"), |mut out, byte| {
|
||||
use std::fmt::Write as _;
|
||||
let _ = write!(out, "{byte:02x}");
|
||||
out
|
||||
});
|
||||
anyhow::ensure!(
|
||||
bytes.len() as u64 == file.size && digest == file.digest,
|
||||
"MCP skill file '{}' does not match its listed size and digest; it was not loaded",
|
||||
@@ -4498,7 +4498,9 @@ impl McpPool {
|
||||
.iter_mut()
|
||||
.filter(|(_, connection)| connection.is_transport_ready())
|
||||
.filter_map(|(name, connection)| {
|
||||
connection.catalog_needs_revalidation().then(|| name.clone())
|
||||
connection
|
||||
.catalog_needs_revalidation()
|
||||
.then(|| name.clone())
|
||||
})
|
||||
.collect();
|
||||
let mut refreshed = Vec::new();
|
||||
|
||||
@@ -1903,6 +1903,7 @@ fn load_rules_from_dir(
|
||||
|
||||
/// User-owned global instructions may intentionally resolve through links.
|
||||
#[cfg(test)]
|
||||
#[cfg_attr(windows, expect(dead_code))]
|
||||
fn load_global_context_file(path: &Path) -> Result<String, ProjectContextError> {
|
||||
load_global_context_file_limited(path, DEFAULT_FILE_MAX_BYTES)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user