fix: keep AI provider and billing metadata out of case results

This commit is contained in:
SepehrYahyaee
2026-11-09 15:13:51 +03:30
parent 2f00e9cccc
commit 3073391d79
4 changed files with 56 additions and 5 deletions
+23 -1
View File
@@ -187,7 +187,19 @@ describe("durable AI jobs", () => {
{
imageKey: aiImageKey(image.path),
status: "completed",
result,
result: {
...result,
requestId: "PRIVATE_REQUEST",
pipeline: { price_model: "PRIVATE_MODEL" },
pricing: {
car: "پژو",
totals: { overall: 1200000 },
costUsd: 0.04,
model: "PRIVATE_MODEL",
durationMs: 1000,
},
},
errorRequestId: "PRIVATE_ERROR_REQUEST",
path: "private",
attempts: 1,
},
@@ -204,6 +216,16 @@ describe("durable AI jobs", () => {
result,
});
expect(view.images[0]).not.toHaveProperty("path");
expect(view.images[0]).not.toHaveProperty("errorRequestId");
expect(view.images[0].result).not.toHaveProperty("requestId");
expect(view.images[0].result).not.toHaveProperty("pipeline");
expect(view.images[0].result.pricing).toMatchObject({
car: "پژو",
totals: { overall: 1200000 },
});
for (const key of ["costUsd", "model", "durationMs"])
expect(view.images[0].result.pricing).not.toHaveProperty(key);
expect(JSON.stringify(view)).not.toContain("PRIVATE_");
});
it("manual retry affects only failed jobs for current claim/photos", async () => {
const { service, jobs } = setup();