fix(registry): a 404 for a tenant's connections lists none (#1028)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Canceled after 2m53s
CI / Agent integration (pull_request) Canceled after 2m54s

Before tenant-registry#138 the registry has no connections route; the
release screen would warn on every visit that connections cannot be
read. A 404 now lists no connections; other errors still answer 503.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-11-19 18:02:15 +01:00
1 parent da13aab408
commit b05154adce
2 files changed
+18 -2

No files matched your search

+7 -1
View File
@@ -631,7 +631,8 @@ impl RegistryClient {
///
/// # Errors
///
/// The registry could not be asked, or answered with an error.
/// The registry could not be asked, or answered with an error other than
/// 404.
pub async fn active_connections(&self, tenant_id: &str) -> Result<Vec<Connection>, String> {
#[derive(Deserialize)]
struct Page {
@@ -650,6 +651,11 @@ impl RegistryClient {
.send()
.await
.map_err(|e| format!("connection list failed: {e}"))?;
// A registry without connections for the tenant (or, before
// tenant-registry#138, without the route) has none to list.
if resp.status() == reqwest::StatusCode::NOT_FOUND {
return Ok(Vec::new());
}
if !resp.status().is_success() {
return Err(format!("connection list returned {}", resp.status()));
}
+11 -1
View File
@@ -32,7 +32,8 @@ use compliance_core::{OrgRole, TenantContext, TenantStatus};
use common::dev_config;
/// A registry where tenant `t-1` is connected to two workspaces and
/// connection `c-ended` has ended; `t-down` cannot be listed; `t-3` does not
/// connection `c-ended` has ended; `t-down` cannot be listed, `t-unknown`
/// is not known (404); `t-3` does not
/// hold Prüfwerk.
async fn fake_registry() -> String {
let app = Router::new()
@@ -45,6 +46,7 @@ async fn fake_registry() -> String {
{ "id": "c-1", "peer_tenant_id": "t-2", "peer_name": "beispiel Maschinenbau" },
] }))),
"t-down" => Err(StatusCode::INTERNAL_SERVER_ERROR),
"t-unknown" => Err(StatusCode::NOT_FOUND),
_ => Ok(Json(serde_json::json!({ "items": [] }))),
}
}),
@@ -148,6 +150,14 @@ async fn the_client_lists_and_checks_connections() {
assert_eq!(listed.len(), 2);
assert_eq!(listed[1].peer_tenant_id, "t-2");
assert!(registry.active_connections("t-down").await.is_err());
assert!(
registry
.active_connections("t-unknown")
.await
.unwrap()
.is_empty(),
"a 404 lists none"
);
let c1 = registry.connection("c-1").await.unwrap().unwrap();
assert_eq!(c1.peer_of("t-1"), Some("t-2"));