Files
PaperClipAI/server/src/services/native-runtime/failed-before-provider-turn.test.ts
T
f434f0e7bd fix(native): let a fresh replacement Runner publish its verified pack admission (#21498)
A new claim's own fresh Runner selection now supersedes the earlier claim's admission receipt while no provider artifacts are retained under it, so a refused reattachment no longer fails before the first provider turn as native_provider_artifacts_admission_unverified.

Co-Authored-By: Paperclip <Paperclip-Paperclip@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 04:28:57 -08:00

24 lines
1.3 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { NativeFailedBeforeProviderTurnError } from "./failed-before-provider-turn.js";
import { fail } from "./native-provider-artifact-files.js";
const causeOf = (thrown: () => unknown) => {
try { thrown(); } catch (error) { return error; }
throw new Error("expected a throw");
};
describe("NativeFailedBeforeProviderTurnError technical cause", () => {
it("names a provider-artifact failure that carries its code only as the message", () => {
const error = new NativeFailedBeforeProviderTurnError(null, causeOf(() => fail("admission_unverified")));
expect(error.technicalCause).toBe("native_provider_artifacts_admission_unverified");
});
it("prefers an explicit code and keeps free-form messages out of the cause", () => {
expect(new NativeFailedBeforeProviderTurnError(null, Object.assign(new Error("anything"), { code: "native_x" })).technicalCause)
.toBe("native_x");
expect(new NativeFailedBeforeProviderTurnError(null, new Error("native_provider at /home/user/secret")).technicalCause)
.toBe("unknown");
expect(new NativeFailedBeforeProviderTurnError(null, new Error("connect ECONNREFUSED")).technicalCause).toBe("unknown");
expect(new NativeFailedBeforeProviderTurnError(null, "native_string_cause").technicalCause).toBe("unknown");
});
});