Merge wave B — the connect step reads liveness, not a latched field

A provider with no sync history reports "unknown" instead of "connected",
so a fresh account is no longer told a device it never linked is already
delivering; the connect step resolves the sync verdict into four honest
tiles, records the flow's result only for a connection that is actually
serving, points an unconfigured provider at its credentials, and steps
over a source the account already has.
This commit is contained in:
Marc-André Bombeck committed 2026-09-11 10:24:54 +02:00
commit 4d7b326fda
25 files changed
+1440 -73

No files matched your search

@@ -63,6 +63,7 @@ import {
IntegrationErrorMessage,
pillFailurePropsFor,
pillStateForVerdict,
type IntegrationState,
} from "./shared";
import {
CallbackMismatchNotice,
@@ -78,12 +79,12 @@ export interface OAuthProviderStatus {
available: boolean;
/** Whether the user has stored their own BYO client id/secret pair. */
hasOwnCredentials?: boolean;
state?:
| "connected"
| "error_transient"
| "error_reauth"
| "disconnected"
| "parked";
/**
* The raw ledger state, carried for shape parity with the envelope. The
* card paints from `syncHealth.verdict`, never from this — which is why
* v1.38.19's `unknown` member needs no arm here.
*/
state?: IntegrationState;
lastSuccessAt?: string | null;
lastAttemptAt?: string | null;
lastError?: string | null;
@@ -36,8 +36,16 @@ export type IntegrationKey =
// Nightscout folds onto the envelope so the card stops fetching its own
// status and inherits the shared verdict.
| "nightscout";
/** Mirrors `IntegrationState` in `src/lib/integrations/status.ts`. */
export type IntegrationState =
"connected" | "error_transient" | "error_reauth" | "disconnected" | "parked";
| "connected"
| "error_transient"
| "error_reauth"
| "disconnected"
| "parked"
// v1.38.19 — no ledger row: the ledger has no history for this provider.
// Read like `disconnected`; `syncHealth.verdict` owns liveness.
| "unknown";
export interface IntegrationStatusViewModel {
integration: IntegrationKey;