fix: resume transient original-job collection and guard probe input

This commit is contained in:
Wenxin Duan
2026-09-15 01:29:13 +08:00
parent cc80265bb2
commit 2ad089d68a
7 changed files with 133 additions and 16 deletions
@@ -17,6 +17,10 @@ describe("image video remote boundary", () => {
for (const url of ["http://cdn.example/v", "https://user:pass@cdn.example/v", "https://127.0.0.1/v", "https://[::ffff:127.0.0.1]/v"]) await expect(harness.validateImageVideoUrl(url)).rejects.toBeDefined();
await expect(harness.validateImageVideoUrl("https://cdn.example/v", () => Promise.resolve([{ address: "192.168.1.2", family: 4 }]))).rejects.toBeDefined();
});
it("classifies a temporary DNS lookup failure as retryable without allowing private results", async () => {
await expect(harness.validateImageVideoUrl("https://cdn.example/video", () => Promise.reject(new Error("EAI_AGAIN")))).rejects.toMatchObject({ code: "I2V_TRANSFER_TRANSIENT" });
await expect(harness.validateImageVideoUrl("https://cdn.example/video", () => Promise.resolve([{ address: "127.0.0.1", family: 4 }]))).rejects.toMatchObject({ code: "BASE_URL_NOT_ALLOWED" });
});
it("extracts only the documented response envelope and rejects malformed or error responses", () => {
expect(harness).toHaveProperty("imageVideoResponse");
expect(harness.imageVideoResponse({ content: [{ type: "text", text: '{"job_id":"j1"}' }] })).toEqual({ job_id: "j1" });