mirror of
https://github.com/hanzoai/mcp.git
synced 2026-10-15 12:30:12 +00:00
Drop the last /api/ address, and make the mode tests take turns
The registry fallback asked ui.hanzo.ai/api/registry, which 301s to a 404 — so a dead address stood in for a second chance nobody had. The primary serves; the fallback is gone rather than moved, because /v1/registry is not served either and pointing a client at an address the estate does not answer is the same defect with a better prefix. The mode tests raced a process-wide singleton: one activates minimal while another activates guido and reads it back, and cargo runs them in threads of one process. Three runs gave ok, ok, FAILED. They share a lock now.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
//! - paas, ingress, -> platform.hanzo.ai (/v1/*)
|
||||
//! mpc
|
||||
//! - billing -> api.hanzo.ai (/v1/billing/*)
|
||||
//! - commerce -> api.hanzo.ai (/api/v1/*)
|
||||
|
||||
//! - team -> api.hanzo.ai (/team/*)
|
||||
//! - api -> api.hanzo.ai (generic method/path/body bridge)
|
||||
//!
|
||||
|
||||
@@ -312,6 +312,16 @@ impl ModeToolDefinition {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
/// The active mode is a process-wide singleton (`personality::REGISTRY`) and
|
||||
/// cargo runs these in parallel threads of ONE process, so a test that
|
||||
/// activates and then reads back can have another test's activation land in
|
||||
/// between. They take turns rather than racing; the state is genuinely
|
||||
/// shared, so serialising the tests is the honest fix and not a workaround.
|
||||
fn mode_turn() -> std::sync::MutexGuard<'static, ()> {
|
||||
static TURN: std::sync::Mutex<()> = std::sync::Mutex::new(());
|
||||
TURN.lock().unwrap_or_else(|e| e.into_inner())
|
||||
}
|
||||
use super::*;
|
||||
|
||||
#[tokio::test]
|
||||
@@ -347,6 +357,7 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_activate_mode() {
|
||||
let _turn = mode_turn();
|
||||
let tool = ModeTool::new();
|
||||
let args = ModeToolArgs {
|
||||
action: "activate".to_string(),
|
||||
@@ -362,6 +373,7 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_current_mode() {
|
||||
let _turn = mode_turn();
|
||||
let tool = ModeTool::new();
|
||||
|
||||
// Activate a mode first
|
||||
|
||||
@@ -118,20 +118,18 @@ function getGitHubClient(): GitHubAPIClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Hanzo registry is available
|
||||
* Answers whether the component registry is reachable.
|
||||
*
|
||||
* One address. The fallback this replaced asked `/api/registry`, which the estate
|
||||
* does not serve — it 301s to a 404 — and it was reached only when the first
|
||||
* fetch THREW, so a dead address stood in for a second chance nobody had.
|
||||
*/
|
||||
async function checkHanzoRegistry(): Promise<boolean> {
|
||||
try {
|
||||
const response = await fetch('https://ui.hanzo.ai/registry/index.json');
|
||||
return response.ok;
|
||||
} catch {
|
||||
// Try alternate endpoints
|
||||
try {
|
||||
const response = await fetch('https://ui.hanzo.ai/api/registry');
|
||||
return response.ok;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user