(
ref: ConnectionRef,
observed: Pick<ConnectionRow, "updated_at" | "tools_synced_at">,
result: HealthCheckResult,
)
| 4355 | * `deadGrantVerdict` answers from `provider_state`, which no verdict |
| 4356 | * write touches. Best-effort, like every verdict write. */ |
| 4357 | const persistHealthResult = ( |
| 4358 | ref: ConnectionRef, |
| 4359 | observed: Pick<ConnectionRow, "updated_at" | "tools_synced_at">, |
| 4360 | result: HealthCheckResult, |
| 4361 | ): Effect.Effect<void, never> => |
| 4362 | core |
| 4363 | .updateMany("connection", { |
| 4364 | where: (b: AnyCb) => |
| 4365 | b.and( |
| 4366 | b("owner", "=", String(ref.owner)), |
| 4367 | b("integration", "=", String(ref.integration)), |
| 4368 | b("name", "=", String(ref.name)), |
| 4369 | b("updated_at", "=", observed.updated_at), |
| 4370 | observed.tools_synced_at == null |
| 4371 | ? b.isNull("tools_synced_at") |
| 4372 | : b("tools_synced_at", "=", observed.tools_synced_at), |
| 4373 | ), |
| 4374 | set: { last_health: result, updated_at: new Date() }, |
| 4375 | }) |
| 4376 | .pipe(Effect.ignore); |
| 4377 | |
| 4378 | /** Heal-on-use: a successful invocation is stronger evidence about the |
| 4379 | * credential than any persisted probe verdict, so flip a stale non-healthy |
no outgoing calls
no test coverage detected