Files
PaperClipAI/server/src/services/native-runtime/setup-probe-failure.test.ts
T
Devin FoleyandPaperclip 6e340a3f96 Verify onboarding models and explain provider failures (#23563)
Verify deployment-configured model preferences with the selected account.
Preserve structured provider failures and show descriptive messages for known
causes through the existing onboarding error display. Keep the existing failure
buttons, account binding, and retry/sign-in behavior.

Validation: UI typecheck, 38 focused tests, four browser journeys, all applicable
CI checks, and Greptile 5/5 with no unresolved review comments.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-12-02 16:47:58 -08:00

19 lines
1.3 KiB
TypeScript

import { expect, it } from "vitest";
import { setupProbeFailure } from "./setup-probe-failure.js";
it.each(["model_unavailable", "authentication", "permission", "quota_exhausted", "rate_limit", "overloaded", "timeout"])(
"preserves the actionable %s category without exposing provider diagnostics", category => {
const failure = { schema: "paperclip.provider-failure.v1", provider: "anthropic", phase: "turn", category,
retryability: "requires_action", message: "private account at https://internal.example credential=fixture-secret" };
const error = Object.assign(new Error(failure.message), { providerFailure: failure });
const check = setupProbeFailure(new Error("wrapped", { cause: error }));
expect(check).toMatchObject({ code: `runner_hello_probe_${category === "authentication" ? "auth_required" : category}`, level: "error" });
expect(JSON.stringify(check)).not.toMatch(/internal\.example|fixture-secret|private account/);
expect(check.message).not.toMatch(/another subscription|change provider|reconnect|saved credentials/i);
},
);
it("does not infer plan restrictions from arbitrary errors", () => {
expect(setupProbeFailure(new Error("model_not_found https://private.example")))
.toMatchObject({ code: "runner_hello_probe_failed" });
});