From 4b398cf45a015be28cfb467508564bf3b0ddc6ed Mon Sep 17 00:00:00 2001 From: Jannis Braun <151788261+TheZwiss@users.noreply.github.com> Date: Tue, 21 Apr 2026 22:21:47 +0200 Subject: [PATCH] types(web): unify FederationPeer with shared type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit packages/web/src/api/client.ts declared a local FederationPeer that had drifted from @backspace/shared: it loosened `status` to `string` (losing the exhaustive 7-value union) and widened `consecutiveFailures` and `lastSyncedAt` to `number | null`. The latter two are spurious — the server never returns null for either — and `status: string` defeated the compiler's ability to flag a missed case when `rejected`, `awaiting_approval`, or `needs_attention` were added over the course of the auto-peering / approval-queue / outbox-auth-failure-recovery work. Replace the local interface with a re-export of the shared type. All three status switches in FederationPanel.tsx (peerStatusColor, peerStatusDotColor, peerStatusLabel) and the StatusFilter union were already exhaustive over the 7 values, so no behaviour change is needed — the re-export just pins the compile-time contract. web tsc --noEmit is clean after the swap. Follow-up #23 from S2S DM unification backlog. --- packages/web/src/api/client.ts | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/packages/web/src/api/client.ts b/packages/web/src/api/client.ts index daad7ea0..e2360f9f 100644 --- a/packages/web/src/api/client.ts +++ b/packages/web/src/api/client.ts @@ -52,8 +52,11 @@ import type { FederationRegistryEntry, FederationIdentityDeleteRequest, FederationIdentityDeleteResponse, + FederationPeer, } from '@backspace/shared'; +export type { FederationPeer }; + export class RateLimitError extends Error { readonly retryAfter: number; constructor(retryAfter: number) { @@ -63,22 +66,6 @@ export class RateLimitError extends Error { } } -export interface FederationPeer { - id: string; - origin: string; - instanceName: string | null; - status: string; - lastSeenAt: number | null; - lastFailureAt: number | null; - consecutiveFailures: number | null; - consecutiveAuthFailures: number; - lastSyncedAt: number | null; - createdAt: number; - secretRotatedAt: number | null; - rotationInProgress: boolean; - autoRotateIntervalDays: number; -} - export interface ApprovalRequest { id: string; origin: string;