feat(registry): connections between workspaces in the registry client (#1028) #1062

Merged
sharang merged 1 commits from feat/registry-connections into main 2026-11-19 12:12:03 +00:00
Owner

Part of #1028 (phase 4), step 3 of the plan on that issue: the registry client for connections, with a fake registry in the tests.

The registry part, tenant-registry#138, has not started (open, unassigned, no PR). This client follows the API sketched in #138, so it will need adjusting if the registry builds it differently.

What it adds

Registry client (registry.rs):

  • active_connections(tenant) calls GET /v1/internal/tenants/{id}/connections?state=active and returns id, peer_tenant_id and peer_name. It isn't cached, so a connection ended a second ago is never offered.
  • connection(id) calls GET /v1/internal/connections/{id} and returns {active, tenant_ids}; a 404 means none.
  • ConnectionState::peer_of(tenant) gives the other side only while the connection is active and the tenant is one of exactly two distinct sides. Releases will ask this right before they write into another tenant's database (#1028: "a third tenant receives nothing", "an ended connection delivers nothing").

API: GET /api/v1/connections returns the workspace's active connections as {id, peer_name}, sorted by name, never the other tenant's id. It's for choosing whom to release a target to (the "Freigeben an" choice in the phase 4 mockup). It returns an empty list without a registry, and 503 when the registry can't be asked.

Tests

  • Unit: peer_of for both sides, a third tenant, an ended connection, a connection to itself, one side, and three sides.
  • tests/connections.rs against a fake registry:
    • the client lists and checks connections, including unknown (none) and a registry error;
    • the endpoint lists by name with id and name only, and no other tenant's id appears anywhere in the answer;
    • an unreachable registry gives 503.
  • Checks: the OpenAPI, route and registry gates pass, and clippy is clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9

Part of #1028 (phase 4), step 3 of the plan on that issue: the registry client for connections, with a fake registry in the tests. The registry part, tenant-registry#138, has **not started** (open, unassigned, no PR). This client follows the API sketched in #138, so it will need adjusting if the registry builds it differently. ## What it adds **Registry client** (`registry.rs`): - `active_connections(tenant)` calls `GET /v1/internal/tenants/{id}/connections?state=active` and returns `id`, `peer_tenant_id` and `peer_name`. It isn't cached, so a connection ended a second ago is never offered. - `connection(id)` calls `GET /v1/internal/connections/{id}` and returns `{active, tenant_ids}`; a `404` means none. - `ConnectionState::peer_of(tenant)` gives the other side only while the connection is active and the tenant is one of exactly two distinct sides. Releases will ask this right before they write into another tenant's database (#1028: "a third tenant receives nothing", "an ended connection delivers nothing"). **API:** `GET /api/v1/connections` returns the workspace's active connections as `{id, peer_name}`, sorted by name, **never the other tenant's id**. It's for choosing whom to release a target to (the "Freigeben an" choice in the phase 4 mockup). It returns an empty list without a registry, and `503` when the registry can't be asked. ## Tests - **Unit:** `peer_of` for both sides, a third tenant, an ended connection, a connection to itself, one side, and three sides. - **`tests/connections.rs` against a fake registry:** - the client lists and checks connections, including unknown (none) and a registry error; - the endpoint lists by name with id and name only, and no other tenant's id appears anywhere in the answer; - an unreachable registry gives `503`. - **Checks:** the OpenAPI, route and registry gates pass, and clippy is clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang added 1 commit 2026-11-19 11:49:26 +00:00
feat(registry): connections between workspaces in the registry client (#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 / Agent integration (pull_request) Successful in 5m18s
CI / Check (pull_request) Successful in 21m59s
469b666bfb
The Prüfwerk side of tenant-registry#138, built against its spec with a
fake registry in the tests (the registry part has not started):

- `RegistryClient::active_connections(tenant)`:
  `GET /v1/internal/tenants/{id}/connections?state=active`, not cached, so
  a connection just ended is never offered;
- `RegistryClient::connection(id)`: `GET /v1/internal/connections/{id}`,
  404 as none;
- `ConnectionState::peer_of(tenant)`: the other side while the connection
  is active and the tenant is one of exactly two distinct sides; what a
  delivery asks right before it writes to another tenant's database;
- `GET /api/v1/connections`: the workspace's active connections by id and
  the other workspace's display name, by name, never the other tenant's id
  (for choosing whom to release to); none without a registry, 503 when it
  cannot be asked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang merged commit fb8223bc11 into main 2026-11-19 12:12:03 +00:00
sharang deleted branch feat/registry-connections 2026-11-19 12:12:03 +00:00
Sign in to join this conversation.