Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

fix: retain posting enrichment warning for captures

Amruth Pillai959da798e766
diff --git a/apps/web/src/features/applications/components/add-application-dialog.tsx b/apps/web/src/features/applications/components/add-application-dialog.tsx
index 92d042936..7ae49f6b4 100644
--- a/apps/web/src/features/applications/components/add-application-dialog.tsx
+++ b/apps/web/src/features/applications/components/add-application-dialog.tsx
@@ -681,7 +681,10 @@ function AddApplicationForm({ onClose, onAdded, initialCapture, forPicker }: Add
)}
</div>
)}
- {initialCapture?.description && !read.error && !read.isPending ? null : providerState.isUnavailable && !link ? (
+ {initialCapture?.description &&
+ !read.error &&
+ !read.isPending &&
+ !parsed?.enrichmentWarning ? null : providerState.isUnavailable && !link ? (
<AiProviderLoadState state={providerState} />
) : (
<ReadStatus
diff --git a/apps/web/src/features/applications/components/application-workflows.test.tsx b/apps/web/src/features/applications/components/application-workflows.test.tsx
index 372754750..9bc33ae69 100644
--- a/apps/web/src/features/applications/components/application-workflows.test.tsx
+++ b/apps/web/src/features/applications/components/application-workflows.test.tsx
@@ -471,3 +471,38 @@ it("keeps the link's failure above paste recovery instead of replacing it with i
});
await waitFor(() => expect(screen.queryByRole("alert")).toBeNull());
});
+
+it("keeps one failure status when optional AI enrichment fails for a captured posting", async () => {
+ const posting = "Build accessible tools for a fictional studio.";
+ api.parsePosting.mockResolvedValue({
+ role: "",
+ company: "",
+ location: "",
+ salary: "",
+ requirements: [],
+ jobDescription: posting,
+ filledBy: "none",
+ enrichmentWarning: true,
+ postingSource: { method: "paste", format: "text", truncated: false, completeness: "unknown" },
+ });
+ mount(
+ <AddApplicationDialog
+ open
+ onOpenChange={vi.fn()}
+ onAdded={vi.fn()}
+ initialCapture={{
+ url: "https://jobs.example.test/captured",
+ role: "Tools Engineer",
+ company: "Fictional Studio",
+ location: "",
+ description: posting,
+ truncated: false,
+ }}
+ />,
+ );
+ fireEvent.click(await screen.findByRole("button", { name: "Read with AI" }));
+ await waitFor(() => expect(api.parsePosting).toHaveBeenCalledTimes(1));
+ expect(await screen.findAllByText(/AI couldn't fill the details/)).toHaveLength(1);
+ expect(screen.queryByText(/Some job details couldn't be read/)).toBeNull();
+ expect(screen.getByRole("textbox", { name: "Saved description" })).toHaveValue(posting);
+});
diff --git a/tests/e2e/specs/application-feedback.spec.ts b/tests/e2e/specs/application-feedback.spec.ts
index 8377c0a14..91b06539d 100644
--- a/tests/e2e/specs/application-feedback.spec.ts
+++ b/tests/e2e/specs/application-feedback.spec.ts
@@ -112,3 +112,54 @@ test("closed application shows Outcome with its reason and no preparation or Edi
await expect(page.getByRole("button", { name: "Prepare a resume", exact: true })).toHaveCount(0);
await card.screenshot({ path: info.outputPath("closed-outcome.png"), animations: "disabled" });
});
+
+test("captured posting retains one warning and its description after failed optional AI enrichment", async ({
+ authPage: page,
+}) => {
+ const provider = await page.request.post("/api/openapi/ai-providers", {
+ data: {
+ label: "Fictional local reader",
+ provider: "openai-compatible",
+ model: "stub",
+ baseURL: stub.baseURL,
+ apiKey: "stub-key",
+ },
+ });
+ expect(provider.ok()).toBe(true);
+ const connection = await provider.json();
+ expect((await page.request.post(`/api/openapi/ai-providers/${connection.id}/test`)).ok()).toBe(true);
+ const description = "Build accessible tools and keep fictional customer information private.";
+ const capture = {
+ url: "https://jobs.example.test/retained-warning",
+ role: "Tools Engineer",
+ company: "Fictional Studio",
+ location: "",
+ description,
+ truncated: false,
+ };
+ await page.goto(`/dashboard/applications/#posting=${encodeURIComponent(JSON.stringify(capture))}`);
+ const dialog = page.getByRole("dialog", { name: "Save a job", exact: true });
+ const before = stub.requests.length;
+ await dialog.getByRole("button", { name: "Read with AI", exact: true }).click();
+ await page.getByRole("alertdialog").getByRole("button", { name: "Allow this operation", exact: true }).click();
+ await expect(
+ dialog.getByText("AI couldn't fill the details. The posting is retained; complete the fields manually.", {
+ exact: true,
+ }),
+ ).toHaveCount(1);
+ await expect(dialog.getByText(/Some job details couldn't be read/)).toHaveCount(0);
+ await expect(dialog.getByLabel("Saved description", { exact: true })).toHaveValue(description);
+ expect(stub.requests).toHaveLength(before + 1);
+ await dialog.getByLabel("Role", { exact: true }).fill(capture.role);
+ await dialog.getByLabel("Company", { exact: true }).fill(capture.company);
+ await dialog.getByRole("button", { name: "Save job", exact: true }).click();
+ await expect(dialog).toBeHidden();
+ const jobs = await (await page.request.get("/api/openapi/applications")).json();
+ expect(jobs).toHaveLength(1);
+ expect(jobs[0]).toMatchObject({
+ role: capture.role,
+ company: capture.company,
+ jobDescription: description,
+ sourceUrl: capture.url,
+ });
+});