mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-30 08:45:09 +01:00
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>
24 lines
1.3 KiB
TypeScript
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");
|
|
});
|
|
});
|