mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-10 03:08:10 +02:00
fix(e2e): retain transient classification for admission socket drops
Recognize socket hang up only in transport errors. Test plain and prefixed drops plus HTTP bodies with misleading network text. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
a027895ea6
commit
9dbf9ae0d0
2 files changed
+4
-2
No files matched your search
@@ -308,6 +308,8 @@ it.each([
|
||||
["Playwright fetch timeout", new Error("apiRequestContext.get: Timeout 1000ms exceeded. PRIVATE"), "transient_infrastructure"],
|
||||
["server fetch timeout", new Error("Timeout 1000ms exceeded PRIVATE"), "transient_infrastructure"],
|
||||
["connection reset", new Error("apiRequestContext.get: read ECONNRESET PRIVATE"), "transient_infrastructure"],
|
||||
["socket hang up", new Error("socket hang up"), "transient_infrastructure"],
|
||||
["prefixed socket hang up", new Error("apiRequestContext.get: Socket Hang Up PRIVATE"), "transient_infrastructure"],
|
||||
["undefined", undefined, "candidate_failure"],
|
||||
["null", null, "candidate_failure"],
|
||||
["private string", "PRIVATE 503 TimeoutError", "candidate_failure"],
|
||||
@@ -335,7 +337,7 @@ it.each([[503, "transient_infrastructure"], [403, "permanent_infrastructure"], [
|
||||
vi.stubEnv("PAPERCLIP_RUNNER_E2E_PORT", "3100");
|
||||
const h = harness(43_000); h.bootstrap.prompt("actual-api");
|
||||
const original = h.api.get.getMockImplementation()!;
|
||||
const secret = "PRIVATE body: forbidden secret plaintext 503 timeout ".repeat(10_000);
|
||||
const secret = "PRIVATE body: forbidden secret plaintext 503 timeout socket hang up ".repeat(10_000);
|
||||
const request = { get: vi.fn(async (path: string) => ({
|
||||
ok: () => !path.endsWith("/leases"), status: () => status,
|
||||
url: () => "http://PRIVATE.invalid/private", text: async () => secret,
|
||||
|
||||
@@ -20,7 +20,7 @@ function admissionReadError(endpoint: AdmissionEndpoint, error: unknown): Remote
|
||||
} else if (error instanceof Error) {
|
||||
const message = error.message.slice(0, 256);
|
||||
if (error.name === "TimeoutError" || /^(?:apiRequestContext\.get: )?Timeout \d+ms exceeded\b/u.test(message)
|
||||
|| /\b(?:ECONNRESET|ECONNREFUSED|ETIMEDOUT|ENOTFOUND|EAI_AGAIN)\b/u.test(message)) failureClass = "transient_infrastructure";
|
||||
|| /\b(?:ECONNRESET|ECONNREFUSED|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|socket hang up)\b/iu.test(message)) failureClass = "transient_infrastructure";
|
||||
}
|
||||
} catch { /* Unknown rejection values remain a bounded candidate failure. */ }
|
||||
return new RemoteAdmissionReadError(endpoint, failureClass);
|
||||
|
||||
Reference in new issue
Block a user