(
ref: ConnectionRef,
observed: Pick<ConnectionRow, "updated_at" | "tools_synced_at">,
result: HealthCheckResult,
)
| 4915 | * `deadGrantVerdict` answers from `provider_state`, which no verdict |
| 4916 | * write touches. Best-effort, like every verdict write. */ |
| 4917 | const persistHealthResult = ( |
| 4918 | ref: ConnectionRef, |
| 4919 | observed: Pick<ConnectionRow, "updated_at" | "tools_synced_at">, |
| 4920 | result: HealthCheckResult, |
| 4921 | ): Effect.Effect<void, never> => |
| 4922 | core |
| 4923 | .updateMany("connection", { |
| 4924 | where: (b: AnyCb) => |
| 4925 | b.and( |
| 4926 | b("owner", "=", String(ref.owner)), |
| 4927 | b("integration", "=", String(ref.integration)), |
| 4928 | b("name", "=", String(ref.name)), |
| 4929 | b("updated_at", "=", observed.updated_at), |
| 4930 | observed.tools_synced_at == null |
| 4931 | ? b.isNull("tools_synced_at") |
| 4932 | : b("tools_synced_at", "=", observed.tools_synced_at), |
| 4933 | ), |
| 4934 | set: { last_health: result, updated_at: new Date() }, |
| 4935 | }) |
| 4936 | .pipe(Effect.ignore); |
| 4937 | |
| 4938 | /** Heal-on-use: a successful invocation is stronger evidence about the |
| 4939 | * credential than any persisted probe verdict, so flip a stale non-healthy |
no outgoing calls
no test coverage detected