Files
ai-kit/test
CatoandClaude Opus 5 ca19d36b70 feat: ask — let an app probe its OWN path, not a chain this module assembles (#40)
Found while trying to answer "does the AI work?" for every app in the
fleet. Two apps could answer; seven could not, because every AI route in
them is behind a login and only two had the probe wired.

Wiring the rest hit a wall: `createAiHealthHandler` needs a `Link[]`, and
four of them cannot produce one. kivvi builds its chain from its own
provider CLASSES; orangecat from a registry it deliberately owns (its
BYOK list includes paid ids); vitareba talks to ONE operator-configured
endpoint chosen for data residency; aoz-housing keeps a provider layer
that predates this package. Requiring a chain meant rewriting those or
leaving them unprobeable — and unprobeable is the state that made this
whole question unanswerable.

`ask` takes a function instead. The gating, the caching, the
never-cache-a-failure rule, the 200/503 contract: all unchanged.

The better reason is not the four awkward apps. A probe built from a
chain THIS module assembles tests A path; `ask` tests THE path — the same
function the app's real features call — so the probe cannot drift away
from the code it vouches for.

An empty or whitespace-only result is a FAILURE, for the same reason
complete() treats it as one, and it matters more here: several of these
apps return "" or null on failure BY DESIGN so callers can degrade.
Accepting that would make the probe report health on exactly the outage
it exists to catch. Verified by mutation — dropping the check turns that
test red and nothing else.


Claude-Session: https://claude.ai/code/session_01NHDLTKGirKU7He8q2YR2y4

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-07 13:33:30 +00:00
..