Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.
TypeScript ai-agentai-resume-analyzerapplication-trackerapplication-tracking-systematscareerjob-applicationjob-automationjob-huntingjob-searchjob-seeker-toolsjob-trackerjob-trackingjobsearchjobseekersmcpollamaresumeresume-reviewself-hosted
feat(automations): remove the JSearch job board and the RapidAPI provider it powered
Khuram Niaz529967ccf9c9
diff --git a/.env.example b/.env.exampleindex debfe69..b86a210 100644--- a/.env.example+++ b/.env.example@@ -15,7 +15,7 @@ AUTH_TRUST_HOST=true# To set manually, uncomment and provide your own value:# AUTH_SECRET=-# ENCRYPTION_KEY is used to encrypt stored API keys (OpenAI, DeepSeek, RapidAPI)+# ENCRYPTION_KEY is used to encrypt stored API keys (OpenAI, DeepSeek, etc.)# Must be stable across restarts — changing it will make all stored API keys unrecoverable# Generate with: openssl rand -base64 32# ENCRYPTION_KEY=@@ -38,8 +38,6 @@ OLLAMA_BASE_URL=http://host.docker.internal:11434# The system uses LLM-based semantic extraction for intelligent, context-aware skill matching# No configuration needed - semantic extraction is the default-RAPIDAPI_KEY=your-rapidapi-key-here-# Enables the MCP server in production (default: on in dev, off in prod)MCP_ENABLED=truediff --git a/__tests__/api-key-resolver.spec.ts b/__tests__/api-key-resolver.spec.tsindex 000c05b..98252b9 100644--- a/__tests__/api-key-resolver.spec.ts+++ b/__tests__/api-key-resolver.spec.ts@@ -34,7 +34,6 @@ describe("resolveApiKey", () => {process.env = { ...OLD_ENV };delete process.env.OPENAI_API_KEY;delete process.env.DEEPSEEK_API_KEY;- delete process.env.RAPIDAPI_KEY;});afterAll(() => {@@ -78,12 +77,10 @@ describe("resolveApiKey", () => {expect(result).toBe("env-openai");});- it("resolves the rapidapi extra env var (not in the registry)", async () => {- process.env.RAPIDAPI_KEY = "rapid-123";+ it("returns undefined for a provider outside the registry", async () => {+ const result = await resolveApiKey(undefined, "not-a-provider");- const result = await resolveApiKey(undefined, "rapidapi");-- expect(result).toBe("rapid-123");+ expect(result).toBeUndefined();expect(mockFindUnique).not.toHaveBeenCalled();});diff --git a/__tests__/ats-runner.spec.ts b/__tests__/ats-runner.spec.tsindex 99381fe..f4b2f05 100644--- a/__tests__/ats-runner.spec.ts+++ b/__tests__/ats-runner.spec.ts@@ -34,10 +34,6 @@ vi.mock("@/lib/scraper/lever", () => ({searchLeverJobs: vi.fn(),}));-vi.mock("@/lib/scraper/jsearch", () => ({- searchJSearchJobs: vi.fn(),-}));-vi.mock("@/lib/api-key-resolver", () => ({resolveApiKey: vi.fn().mockResolvedValue(undefined),}));diff --git a/__tests__/automationSchedule.actions.spec.ts b/__tests__/automationSchedule.actions.spec.tsindex 273598f..d41c50d 100644--- a/__tests__/automationSchedule.actions.spec.ts+++ b/__tests__/automationSchedule.actions.spec.ts@@ -37,9 +37,12 @@ const RESUME_ID = "11111111-1111-4111-8111-111111111111";function baseInput(overrides: Record<string, unknown> = {}) {return {name: "Test Automation",- jobBoard: "jsearch",+ jobBoard: "greenhouse",keywords: "engineer",location: "New York",+ sourceConfig: {+ greenhouse: { companies: [{ name: "Anthropic", token: "anthropic" }] },+ },resumeId: RESUME_ID,matchThreshold: 80,scheduleHour: 8,diff --git a/__tests__/automationSourceConfig.schema.spec.ts b/__tests__/automationSourceConfig.schema.spec.tsindex dee49ff..c04b26d 100644--- a/__tests__/automationSourceConfig.schema.spec.ts+++ b/__tests__/automationSourceConfig.schema.spec.ts@@ -8,22 +8,14 @@ const base = {};describe("CreateAutomationSchema conditional validation", () => {- it("jsearch requires keywords + location", () => {- const result = CreateAutomationSchema.safeParse({- ...base,- jobBoard: "jsearch",- });- expect(result.success).toBe(false);- });-- it("jsearch passes with keywords + location", () => {+ it("rejects a retired job board", () => {const result = CreateAutomationSchema.safeParse({...base,jobBoard: "jsearch",keywords: "frontend",location: "Canada",});- expect(result.success).toBe(true);+ expect(result.success).toBe(false);});it("greenhouse requires at least one company", () => {diff --git a/__tests__/greenhouse-runner.spec.ts b/__tests__/greenhouse-runner.spec.tsindex 9d4d322..0b40bbe 100644--- a/__tests__/greenhouse-runner.spec.ts+++ b/__tests__/greenhouse-runner.spec.ts@@ -30,10 +30,6 @@ vi.mock("@/lib/scraper/greenhouse", () => ({searchGreenhouseJobs: vi.fn(),}));-vi.mock("@/lib/scraper/jsearch", () => ({- searchJSearchJobs: vi.fn(),-}));-vi.mock("@/lib/api-key-resolver", () => ({resolveApiKey: vi.fn().mockResolvedValue(undefined),}));@@ -53,7 +49,6 @@ vi.mock("@/lib/ai", async (orig) => {import { runAutomation } from "@/lib/scraper/runner";import { searchGreenhouseJobs } from "@/lib/scraper/greenhouse";-import { searchJSearchJobs } from "@/lib/scraper/jsearch";import { generateText } from "ai";import type { Automation } from "@/models/automation.model";import { AiProvider } from "@/models/ai.model";@@ -429,92 +424,3 @@ describe("runAutomation (greenhouse)", () => {});});});--const jsearchAutomation: Automation = {- ...automation,- id: "auto-js",- jobBoard: "jsearch",- keywords: "engineer",- location: "Remote",- sourceConfig: null,-};--function makeJSearchJob() {- return {- title: "Frontend Engineer",- company: "Acme",- location: "Remote",- description: "React role",- url: `https://jobs.example.com/${Math.random()}`,- postedDate: "2026-06-01T00:00:00Z",- };-}--describe("runAutomation (jsearch) concurrency", () => {- beforeEach(() => {- vi.clearAllMocks();-- (prisma.automationRun.create as any).mockResolvedValue({ id: "run1" });- (prisma.automationRun.update as any).mockResolvedValue({- id: "run1",- automationId: "auto-js",- });- (prisma.automation.findUnique as any).mockResolvedValue({ scheduleHour: 8 });- (prisma.automation.update as any).mockResolvedValue({});- (prisma.resume.findUnique as any).mockResolvedValue({- id: "resume1",- title: "My Resume",- ContactInfo: null,- ResumeSections: [],- });- (prisma.job.findMany as any).mockResolvedValue([]); // no existing urls- (prisma.job.create as any).mockResolvedValue({});- (prisma.jobTitle.findUnique as any).mockResolvedValue({ id: "jt" });- (prisma.location.findUnique as any).mockResolvedValue({ id: "loc" });- (prisma.company.findUnique as any).mockResolvedValue({ id: "co" });- (prisma.jobSource.findUnique as any).mockResolvedValue({ id: "src" });- (prisma.jobStatus.findFirst as any).mockResolvedValue({ id: "st" });-- // Hosted provider -> concurrency 3 (Ollama would force 1).- (prisma.userSettings.findUnique as any).mockResolvedValue({- settings: JSON.stringify({- ai: { provider: AiProvider.OPENAI, model: "gpt-4o-mini" },- }),- });- });-- // Guards the fix for Finding 1: under concurrent dispatch, in-flight jobs- // can still save after a sibling sets aiError, so the run must not report- // "failed" while jobs were actually persisted.- it("reports completed_with_errors (not failed) when aiError fires but jobs saved", async () => {- (searchJSearchJobs as any).mockResolvedValue({- success: true,- data: [- makeJSearchJob(),- makeJSearchJob(),- makeJSearchJob(),- makeJSearchJob(),- makeJSearchJob(),- ],- });-- const pending = deferredGenerateTextQueue();- const runPromise = runAutomation(jsearchAutomation);-- await vi.waitFor(() => expect(pending.length).toBe(3));-- pending[0].reject(new Error("fetch failed")); // -> ai_unavailable- pending[1].resolve({ text: scoreText(90) });- pending[2].resolve({ text: scoreText(85) });-- const result = await runPromise;-- // Queued jobs (4, 5) bail on the aiError check before dispatching.- expect(pending.length).toBe(3);- expect(result.status).toBe("completed_with_errors");- // Jobs 1 and 2 were in flight when job 0 failed; they still persist.- expect(result.jobsSaved).toBe(2);- expect((prisma.job.create as any).mock.calls.length).toBe(2);- expect(result.jobsMatched).toBe(2);- });-});diff --git a/__tests__/lever-fetch.spec.ts b/__tests__/lever-fetch.spec.tsindex 0817a8a..5aecd67 100644--- a/__tests__/lever-fetch.spec.ts+++ b/__tests__/lever-fetch.spec.ts@@ -252,7 +252,7 @@ describe("mapLeverJob", () => {});describe("workplace precedence in normalizeWorkplaceType (regression)", () => {- it("JSearch boolean path unchanged", () => {+ it("isRemote boolean path unchanged", () => {expect(normalizeWorkplaceType(true)).toBe("REMOTE");expect(normalizeWorkplaceType(false)).toBeNull();expect(normalizeWorkplaceType(undefined)).toBeNull();diff --git a/__tests__/scraper-mapper.spec.ts b/__tests__/scraper-mapper.spec.tsindex 9776535..ef4e10a 100644--- a/__tests__/scraper-mapper.spec.ts+++ b/__tests__/scraper-mapper.spec.ts@@ -87,7 +87,7 @@ describe("mapScrapedJobToJobRecord - workplaceType precedence", () => {expect(result.workplaceType).toBe("ONSITE");});- it("falls back to the isRemote boolean when workplaceType is absent (JSearch)", async () => {+ it("falls back to the isRemote boolean when workplaceType is absent", async () => {const remote = await mapScrapedJobToJobRecord({...baseInput,scrapedJob: { ...scrapedJob, isRemote: true },diff --git a/prisma/migrations/20260904120000_remove_jsearch_rapidapi/migration.sql b/prisma/migrations/20260904120000_remove_jsearch_rapidapi/migration.sqlnew file mode 100644index 0000000..c1cf54b--- /dev/null+++ b/prisma/migrations/20260904120000_remove_jsearch_rapidapi/migration.sql@@ -0,0 +1,4 @@+-- The JSearch job board was removed, and RapidAPI keys existed only to power+-- it. The settings UI no longer lists the provider, so these rows would be+-- unreachable orphans; drop them.+DELETE FROM "ApiKey" WHERE "provider" = 'rapidapi';diff --git a/src/actions/automation/mutations.ts b/src/actions/automation/mutations.tsindex a082035..195c924 100644--- a/src/actions/automation/mutations.ts+++ b/src/actions/automation/mutations.ts@@ -10,7 +10,7 @@ import {type UpdateAutomationInput,} from "@/models/automation.schema";import type { AutomationWithResume } from "@/models/automation.model";-import { isAtsBoard } from "@/models/automation.model";+import { isRetiredBoard } from "@/models/automation.model";import { APP_CONSTANTS } from "@/lib/constants";import { syncSchedulerState } from "@/lib/scheduler";import { formatError } from "./shared";@@ -117,6 +117,13 @@ export async function updateAutomation(return { success: false, message: "Automation not found" };}+ if (isRetiredBoard(existing.jobBoard)) {+ return {+ success: false,+ message: `The ${existing.jobBoard} job board has been removed. This automation can only be deleted.`,+ };+ }+if (validated.resumeId) {const resume = await db.resume.findFirst({where: {@@ -139,7 +146,7 @@ export async function updateAutomation(if (validated.sourceConfig !== undefined) {updateData.sourceConfig = JSON.stringify(validated.sourceConfig);}- if (validated.jobBoard && isAtsBoard(validated.jobBoard)) {+ if (validated.jobBoard) {updateData.keywords = validated.keywords ?? "";updateData.location = validated.location ?? "";}diff --git a/src/app/api/automations/[id]/run/route.ts b/src/app/api/automations/[id]/run/route.tsindex 3dbe2d4..f17d2c2 100644--- a/src/app/api/automations/[id]/run/route.ts+++ b/src/app/api/automations/[id]/run/route.ts@@ -11,7 +11,7 @@ import {import { PROVIDER_VERIFIERS } from "@/lib/ai/provider-registry.server";import { getOllamaBaseUrl } from "@/actions/apiKey.actions";import { AiProvider } from "@/models/ai.model";-import type { JobBoard } from "@/models/automation.model";+import { isRetiredBoard, type JobBoard } from "@/models/automation.model";import { APP_CONSTANTS } from "@/lib/constants";import { log } from "@/lib/telemetry";@@ -61,6 +61,15 @@ export async function POST(return NextResponse.json({ message: "Automation not found" }, { status: 404 });}+ if (isRetiredBoard(automation.jobBoard)) {+ return NextResponse.json(+ {+ message: `The ${automation.jobBoard} job board has been removed. Delete this automation and create a new one.`,+ },+ { status: 400 }+ );+ }+if (!automation.resume) {return NextResponse.json({ message: "Resume is missing. Please edit the automation and select a resume." },diff --git a/src/app/dashboard/automations/[id]/page.tsx b/src/app/dashboard/automations/[id]/page.tsxindex 957c891..fcd2082 100644--- a/src/app/dashboard/automations/[id]/page.tsx+++ b/src/app/dashboard/automations/[id]/page.tsx@@ -61,7 +61,7 @@ import type {JobBoard,LeverSourceConfig,} from "@/models/automation.model";-import { isAtsBoard } from "@/models/automation.model";+import { isRetiredBoard } from "@/models/automation.model";import { companyBoardUrl } from "@/lib/atsBoardUrl";import type { JobMatchData } from "@/models/ai.schemas";import { DiscoveredJobsList } from "@/components/automations/DiscoveredJobsList";@@ -540,9 +540,10 @@ export default function AutomationDetailPage() {const resumeMissing = !automation.resume;const newJobsCount = jobStatusCounts.new;- const greenhouseConfig = isAtsBoard(automation.jobBoard)- ? parseAtsConfig(automation.sourceConfig, automation.jobBoard)- : null;+ const retired = isRetiredBoard(automation.jobBoard);+ const greenhouseConfig = retired+ ? null+ : parseAtsConfig(automation.sourceConfig, automation.jobBoard);// The button must reflect the real run state, not just this page instance's// runNowLoading: after navigating away and back, runNowLoading resets but the// SSE reports the run is still live, so fall back to logData.isRunning.@@ -559,6 +560,13 @@ export default function AutomationDetailPage() {</Button><div className="flex-1 min-w-0"><h1 className="text-2xl font-bold">{automation.name}</h1>+ {retired && (+ <p className="flex items-center gap-2 text-amber-600 text-sm">+ <AlertTriangle className="h-4 w-4 shrink-0" />+ The {automation.jobBoard} job board was removed and no longer+ runs. Delete this automation.+ </p>+ )}{(automation.keywords || automation.location) && (<p className="text-muted-foreground">{[automation.keywords, automation.location]@@ -572,10 +580,12 @@ export default function AutomationDetailPage() {<Button variant="outline" size="icon" onClick={() => loadData(true)}><RefreshCw className="h-4 w-4" /></Button>- <Button variant="outline" onClick={() => setWizardOpen(true)}>- <Pencil className="h-4 w-4 mr-2" />- Edit- </Button>+ {!retired && (+ <Button variant="outline" onClick={() => setWizardOpen(true)}>+ <Pencil className="h-4 w-4 mr-2" />+ Edit+ </Button>+ )}<Buttonvariant="outline"className="text-destructive hover:text-destructive"@@ -584,21 +594,23 @@ export default function AutomationDetailPage() {<Trash2 className="h-4 w-4 mr-2" />Delete</Button>- <Button- variant="outline"- onClick={handlePauseResume}- disabled={actionLoading || resumeMissing}- >- {actionLoading ? (- <Loader2 className="h-4 w-4 mr-2 animate-spin" />- ) : automation.status === "active" ? (- <Pause className="h-4 w-4 mr-2" />- ) : (- <Play className="h-4 w-4 mr-2" />- )}- {automation.status === "active" ? "Pause" : "Resume"}- </Button>- {runActive ? (+ {!retired && (+ <Button+ variant="outline"+ onClick={handlePauseResume}+ disabled={actionLoading || resumeMissing}+ >+ {actionLoading ? (+ <Loader2 className="h-4 w-4 mr-2 animate-spin" />+ ) : automation.status === "active" ? (+ <Pause className="h-4 w-4 mr-2" />+ ) : (+ <Play className="h-4 w-4 mr-2" />+ )}+ {automation.status === "active" ? "Pause" : "Resume"}+ </Button>+ )}+ {retired ? null : runActive ? (<Buttonvariant="destructive"onClick={() => setAbortConfirmOpen(true)}diff --git a/src/components/automations/AutomationList.tsx b/src/components/automations/AutomationList.tsxindex 06f9374..ea021b0 100644--- a/src/components/automations/AutomationList.tsx+++ b/src/components/automations/AutomationList.tsx@@ -35,7 +35,7 @@ import {Zap,} from "lucide-react";import type { AutomationWithResume } from "@/models/automation.model";-import { isAtsBoard } from "@/models/automation.model";+import { isRetiredBoard } from "@/models/automation.model";import {deleteAutomation,pauseAutomation,@@ -123,17 +123,16 @@ export function AutomationList({const isLoading = loadingAction === automation.id;const resumeMissing = !automation.resume;- const ats = isAtsBoard(automation.jobBoard)- ? (() => {- try {- return JSON.parse(automation.sourceConfig ?? "{}")[- automation.jobBoard- ];- } catch {- return null;- }- })()- : null;+ const retired = isRetiredBoard(automation.jobBoard);+ const ats = (() => {+ try {+ return JSON.parse(automation.sourceConfig ?? "{}")[+ automation.jobBoard+ ];+ } catch {+ return null;+ }+ })();const ghCompanies: { name: string; token: string }[] =ats?.companies ?? [];const ghTitles: string[] = ats?.targetTitles ?? [];@@ -158,23 +157,37 @@ export function AutomationList({<Badge variant="outline" className="capitalize">{automation.jobBoard}</Badge>- <Badge- variant={- automation.status === "active" ? "default" : "secondary"- }- >- {automation.status}- </Badge>+ {retired ? (+ <Badge variant="destructive">Retired</Badge>+ ) : (+ <Badge+ variant={+ automation.status === "active" ? "default" : "secondary"+ }+ >+ {automation.status}+ </Badge>+ )}</div>- {resumeMissing && (+ {retired && (+ <div className="flex items-center gap-2 text-amber-600 text-sm">+ <AlertTriangle className="h-4 w-4 shrink-0" />+ <span>+ This job board was removed and no longer runs. Delete this+ automation.+ </span>+ </div>+ )}++ {!retired && resumeMissing && (<div className="flex items-center gap-2 text-amber-600 text-sm"><AlertTriangle className="h-4 w-4" /><span>Resume missing - select a new one</span></div>)}- {ats ? (+ {!retired && (<div className="space-y-1.5 text-sm text-muted-foreground"><div className="flex flex-wrap items-center gap-1">{ghCompanies.slice(0, 3).map((c) => (@@ -231,29 +244,6 @@ export function AutomationList({)}</div></div>- ) : (- <div className="flex flex-wrap gap-x-6 gap-y-1 text-sm text-muted-foreground">- <span>- <span className="font-medium text-foreground">- Keywords:- </span>{" "}- {automation.keywords}- </span>- <span>- <span className="font-medium text-foreground">- Location:- </span>{" "}- {automation.location}- </span>- {automation.resume && (- <span>- <span className="font-medium text-foreground">- Resume:- </span>{" "}- {automation.resume.title}- </span>- )}- </div>)}<div className="flex flex-wrap gap-x-4 gap-y-1 text-sm text-muted-foreground">@@ -268,12 +258,17 @@ export function AutomationList({<FileText className="h-4 w-4" /><span>{automation.matchThreshold}% threshold</span></div>- {automation.nextRunAt && automation.status === "active" && (- <span className="text-xs">- Next:{" "}- {format(new Date(automation.nextRunAt), "MMM d, h:mm a")}- </span>- )}+ {!retired &&+ automation.nextRunAt &&+ automation.status === "active" && (+ <span className="text-xs">+ Next:{" "}+ {format(+ new Date(automation.nextRunAt),+ "MMM d, h:mm a",+ )}+ </span>+ )}{automation.lastRunAt && (<span className="text-xs">Last:{" "}@@ -290,27 +285,32 @@ export function AutomationList({</Button></DropdownMenuTrigger><DropdownMenuContent align="end">- {automation.status === "active" ? (- <DropdownMenuItem- onClick={() => handlePause(automation.id)}- >- <Pause className="h-4 w-4 mr-2" />- Pause- </DropdownMenuItem>- ) : (- <DropdownMenuItem- onClick={() => handleResume(automation.id)}- disabled={resumeMissing}- >- <Play className="h-4 w-4 mr-2" />- Resume- </DropdownMenuItem>+ {!retired &&+ (automation.status === "active" ? (+ <DropdownMenuItem+ onClick={() => handlePause(automation.id)}+ >+ <Pause className="h-4 w-4 mr-2" />+ Pause+ </DropdownMenuItem>+ ) : (+ <DropdownMenuItem+ onClick={() => handleResume(automation.id)}+ disabled={resumeMissing}+ >+ <Play className="h-4 w-4 mr-2" />+ Resume+ </DropdownMenuItem>+ ))}+ {!retired && (+ <>+ <DropdownMenuItem onClick={() => onEdit(automation)}>+ <Pencil className="h-4 w-4 mr-2" />+ Edit+ </DropdownMenuItem>+ <DropdownMenuSeparator />+ </>)}- <DropdownMenuItem onClick={() => onEdit(automation)}>- <Pencil className="h-4 w-4 mr-2" />- Edit- </DropdownMenuItem>- <DropdownMenuSeparator /><DropdownMenuItemclassName="text-destructive"onClick={() => setDeleteId(automation.id)}diff --git a/src/components/automations/AutomationWizard.tsx b/src/components/automations/AutomationWizard.tsxindex d8343cc..7fafe4b 100644--- a/src/components/automations/AutomationWizard.tsx+++ b/src/components/automations/AutomationWizard.tsx@@ -41,9 +41,8 @@ import {} from "@/actions/automation.actions";import { toastSuccess, toastError } from "@/lib/toast";import type { AutomationWithResume, JobBoard } from "@/models/automation.model";-import { isAtsBoard } from "@/models/automation.model";import { AtsSearchStep, type AtsConfigValue } from "./AtsSearchStep";-import { ChevronLeft, ChevronRight, Loader2, AlertTriangle } from "lucide-react";+import { ChevronLeft, ChevronRight, Loader2 } from "lucide-react";import { APP_CONSTANTS } from "@/lib/constants";type AtsKey = "greenhouse" | "lever";@@ -170,25 +169,16 @@ export function AutomationWizard({}};- const isAts = isAtsBoard(formValues.jobBoard);- const atsKey: AtsKey | null = isAts- ? (formValues.jobBoard as AtsKey)- : null;+ const atsKey: AtsKey = formValues.jobBoard;const atsConfig: AtsConfigValue =- (atsKey ? formValues.sourceConfig?.[atsKey] : undefined) ?? EMPTY_ATS;+ formValues.sourceConfig?.[atsKey] ?? EMPTY_ATS;const canGoNext = () => {switch (step) {case 0:return (formValues.name?.trim().length ?? 0) > 0;case 1:- if (isAts) {- return (atsConfig.companies?.length ?? 0) > 0;- }- return (- (formValues.keywords?.trim().length ?? 0) > 0 &&- (formValues.location?.trim().length ?? 0) > 0- );+ return (atsConfig.companies?.length ?? 0) > 0;case 2:return (formValues.resumeId?.length ?? 0) > 0;case 3:@@ -274,9 +264,6 @@ export function AutomationWizard({</SelectTrigger></FormControl><SelectContent>- <SelectItem value="jsearch">- JSearch (Google Jobs)- </SelectItem><SelectItem value="greenhouse">Greenhouse (company boards)</SelectItem>@@ -286,78 +273,27 @@ export function AutomationWizard({</SelectContent></Select><FormDescription>- {formValues.jobBoard === "jsearch"- ? "Keyword-based job search via Google Jobs API (RapidAPI key required)"- : "Track specific companies' job boards"}+ Track specific companies' job boards</FormDescription><FormMessage /></FormItem>)}/>- {formValues.jobBoard === "jsearch" && (- <div className="flex items-center gap-2 text-amber-600 text-sm">- <AlertTriangle className="h-4 w-4 shrink-0" />- <span>- JSearch will be removed in the next release. More job board- options are coming soon.- </span>- </div>- )}</div>{/* Step 1: Search */}<div className={step === 1 ? "space-y-4" : "hidden"}>- {isAts && atsKey ? (- <AtsSearchStep- provider={formValues.jobBoard}- value={atsConfig}- onChange={(next) =>- form.setValue(- "sourceConfig",- { [atsKey]: next } as CreateAutomationInput["sourceConfig"],- { shouldValidate: true },- )- }- />- ) : (- <>- <FormField- control={form.control}- name="keywords"- render={({ field }) => (- <FormItem>- <FormLabel>Search Keywords</FormLabel>- <FormControl>- <Input- placeholder="e.g., Full Stack Developer"- {...field}- />- </FormControl>- <FormDescription>- Job titles, skills, or keywords to search for- </FormDescription>- <FormMessage />- </FormItem>- )}- />- <FormField- control={form.control}- name="location"- render={({ field }) => (- <FormItem>- <FormLabel>Location</FormLabel>- <FormControl>- <Input placeholder="e.g., Calgary, AB" {...field} />- </FormControl>- <FormDescription>- City, state/province, or region to search in- </FormDescription>- <FormMessage />- </FormItem>- )}- />- </>- )}+ <AtsSearchStep+ provider={formValues.jobBoard}+ value={atsConfig}+ onChange={(next) =>+ form.setValue(+ "sourceConfig",+ { [atsKey]: next } as CreateAutomationInput["sourceConfig"],+ { shouldValidate: true },+ )+ }+ /></div>{/* Step 2: Resume */}@@ -415,9 +351,9 @@ export function AutomationWizard({/></FormControl><FormDescription>- {isAts- ? "Highlight listings whose AI match score exceeds this threshold. Relevant listings are saved regardless — this only flags strong matches."- : "Only save jobs that match your resume above this percentage. Higher = fewer but better matches."}+ Highlight listings whose AI match score exceeds this+ threshold. Relevant listings are saved regardless — this only+ flags strong matches.</FormDescription><FormMessage /></FormItem>@@ -483,67 +419,48 @@ export function AutomationWizard({{formValues.jobBoard || "-"}</span></div>- {isAts ? (- <>- <div className="flex justify-between gap-4">- <span className="text-muted-foreground">Companies</span>- <span className="font-medium text-right">- {atsConfig.companies?.length- ? atsConfig.companies.map((c) => c.name).join(", ")- : "-"}- </span>- </div>- <div className="flex justify-between gap-4">- <span className="text-muted-foreground">Target titles</span>- <span className="font-medium text-right">- {atsConfig.targetTitles?.length- ? atsConfig.targetTitles.join(", ")- : "Any"}- </span>- </div>- <div className="flex justify-between gap-4">- <span className="text-muted-foreground">Locations</span>- <span className="font-medium text-right">- {atsConfig.locations?.length- ? `${atsConfig.locations.join(", ")}${- atsConfig.strictLocation ? " (strict)" : ""- }`- : "Any location"}- </span>- </div>- <div className="flex justify-between gap-4">- <span className="text-muted-foreground">- Jobs analyzed per run- </span>- <span className="font-medium text-right">- {atsConfig.topK ?? APP_CONSTANTS.MAX_JOBS_PER_RUN}- </span>- </div>- <div className="flex justify-between gap-4">- <span className="text-muted-foreground">- Save additional listings- </span>- <span className="font-medium text-right">- {atsConfig.saveUnanalyzed !== false ? "Yes" : "No"}- </span>- </div>- </>- ) : (- <>- <div className="flex justify-between">- <span className="text-muted-foreground">Keywords</span>- <span className="font-medium">- {formValues.keywords || "-"}- </span>- </div>- <div className="flex justify-between">- <span className="text-muted-foreground">Location</span>- <span className="font-medium">- {formValues.location || "-"}- </span>- </div>- </>- )}+ <div className="flex justify-between gap-4">+ <span className="text-muted-foreground">Companies</span>+ <span className="font-medium text-right">+ {atsConfig.companies?.length+ ? atsConfig.companies.map((c) => c.name).join(", ")+ : "-"}+ </span>+ </div>+ <div className="flex justify-between gap-4">+ <span className="text-muted-foreground">Target titles</span>+ <span className="font-medium text-right">+ {atsConfig.targetTitles?.length+ ? atsConfig.targetTitles.join(", ")+ : "Any"}+ </span>+ </div>+ <div className="flex justify-between gap-4">+ <span className="text-muted-foreground">Locations</span>+ <span className="font-medium text-right">+ {atsConfig.locations?.length+ ? `${atsConfig.locations.join(", ")}${+ atsConfig.strictLocation ? " (strict)" : ""+ }`+ : "Any location"}+ </span>+ </div>+ <div className="flex justify-between gap-4">+ <span className="text-muted-foreground">+ Jobs analyzed per run+ </span>+ <span className="font-medium text-right">+ {atsConfig.topK ?? APP_CONSTANTS.MAX_JOBS_PER_RUN}+ </span>+ </div>+ <div className="flex justify-between gap-4">+ <span className="text-muted-foreground">+ Save additional listings+ </span>+ <span className="font-medium text-right">+ {atsConfig.saveUnanalyzed !== false ? "Yes" : "No"}+ </span>+ </div><div className="flex justify-between"><span className="text-muted-foreground">Resume</span><span className="font-medium">diff --git a/src/components/automations/DiscoveredJobsList.tsx b/src/components/automations/DiscoveredJobsList.tsxindex 67d9ac4..f006313 100644--- a/src/components/automations/DiscoveredJobsList.tsx+++ b/src/components/automations/DiscoveredJobsList.tsx@@ -60,8 +60,8 @@ import {import { RecordsCount } from "@/components/RecordsCount";// A job is "un-analyzed" only when matchData explicitly marks it so (Greenhouse-// floor survivors). JSearch and legacy jobs have no flag but carry a real AI-// score, so they count as analyzed.+// floor survivors). Legacy jobs have no flag but carry a real AI score, so they+// count as analyzed.function isAnalyzed(job: DiscoveredJob): boolean {try {return JSON.parse(job.matchData ?? "{}").analyzed !== false;@@ -71,7 +71,7 @@ function isAnalyzed(job: DiscoveredJob): boolean {}// Lexical pre-rank as a percentage (weights sum to ~1, so raw × 100). Only-// Greenhouse jobs carry it; null for JSearch/legacy jobs.+// Greenhouse jobs carry it; null for legacy jobs.function getPrerankPercent(job: DiscoveredJob): number | null {try {const raw = JSON.parse(job.matchData ?? "{}").prerankScore;diff --git a/src/components/settings/ApiKeySettings.tsx b/src/components/settings/ApiKeySettings.tsxindex dd22976..4a92b70 100644--- a/src/components/settings/ApiKeySettings.tsx+++ b/src/components/settings/ApiKeySettings.tsx@@ -48,24 +48,14 @@ interface ProviderConfig {sensitive: boolean;}-const PROVIDERS: ProviderConfig[] = [- ...getAiProviders().map((entry) => ({- id: entry.id as ApiKeyProvider,- name: entry.displayName,- placeholder: entry.keyConfig.placeholder,- inputType: entry.keyConfig.inputType,- description: entry.keyConfig.description,- sensitive: entry.keyConfig.sensitive,- })),- {- id: "rapidapi",- name: "RapidAPI",- placeholder: "Your RapidAPI key",- inputType: "password" as const,- description: "Used for JSearch job discovery automations",- sensitive: true,- },-];+const PROVIDERS: ProviderConfig[] = getAiProviders().map((entry) => ({+ id: entry.id as ApiKeyProvider,+ name: entry.displayName,+ placeholder: entry.keyConfig.placeholder,+ inputType: entry.keyConfig.inputType,+ description: entry.keyConfig.description,+ sensitive: entry.keyConfig.sensitive,+}));function ApiKeySettings() {const [keys, setKeys] = useState<ApiKeyClientResponse[]>([]);diff --git a/src/lib/ai/provider-registry.server.ts b/src/lib/ai/provider-registry.server.tsindex f9e148a..c527739 100644--- a/src/lib/ai/provider-registry.server.ts+++ b/src/lib/ai/provider-registry.server.ts@@ -117,25 +117,4 @@ export const PROVIDER_VERIFIERS: Record<};return { success: true };},-- rapidapi: async (key) => {- const res = await fetch(- "https://jsearch.p.rapidapi.com/search?query=test&num_pages=1",- {- headers: {- "X-RapidAPI-Key": key,- "X-RapidAPI-Host": "jsearch.p.rapidapi.com",- },- },- );- if (!res.ok)- return {- success: false,- error:- res.status === 403- ? "Invalid API key"- : `RapidAPI returned ${res.status}`,- };- return { success: true };- },};diff --git a/src/lib/api-key-resolver.ts b/src/lib/api-key-resolver.tsindex 0f09e3f..b582edf 100644--- a/src/lib/api-key-resolver.ts+++ b/src/lib/api-key-resolver.ts@@ -4,11 +4,6 @@ import db from "@/lib/db";import { decrypt } from "@/lib/encryption";import { PROVIDER_REGISTRY } from "@/lib/ai/provider-registry";-// RapidAPI is not in the AI provider registry but still needs env var resolution-const EXTRA_ENV_VARS: Record<string, string> = {- rapidapi: "RAPIDAPI_KEY",-};-export async function resolveApiKey(userId: string | undefined,provider: string,@@ -40,12 +35,6 @@ export async function resolveApiKey(if (value) return value;}- const extraEnvVar = EXTRA_ENV_VARS[provider];- if (extraEnvVar) {- const value = process.env[extraEnvVar];- if (value) return value;- }-if (entry?.defaultCredential) return entry.defaultCredential;return undefined;diff --git a/src/lib/scheduler/index.ts b/src/lib/scheduler/index.tsindex c4782f1..3a69bc5 100644--- a/src/lib/scheduler/index.ts+++ b/src/lib/scheduler/index.ts@@ -2,7 +2,7 @@ import cron, { ScheduledTask } from "node-cron";import { SCHEDULER_CONSTANTS } from "@/lib/constants";import db from "@/lib/db";import { runAutomation, AutomationAlreadyRunningError } from "@/lib/scraper";-import type { JobBoard } from "@/models/automation.model";+import { ATS_BOARDS, type JobBoard } from "@/models/automation.model";import { log } from "@/lib/telemetry";let scheduledTask: ScheduledTask | null = null;@@ -18,6 +18,8 @@ async function runDueAutomations() {where: {status: "active",nextRunAt: { lte: now },+ // Rows left on a retired board never fire; the UI offers only delete.+ jobBoard: { in: ATS_BOARDS },},include: {resume: true,diff --git a/src/lib/scraper/ats/registry.ts b/src/lib/scraper/ats/registry.tsindex a4610cc..caa4d4a 100644--- a/src/lib/scraper/ats/registry.ts+++ b/src/lib/scraper/ats/registry.ts@@ -4,8 +4,8 @@ import { searchLeverJobs } from "../lever";import type { AtsProvider } from "./types";// Server-only: imports the real network-calling search fns (fetch, p-limit).-// Never import this from client-bundled code — use isAtsBoard from-// automation.model.ts for the plain "is this board ATS-shaped" check.+// Never import this from client-bundled code — use ATS_BOARDS from+// automation.model.ts for the plain, dependency-free board list.export const ATS_PROVIDERS: Partial<Record<JobBoard, AtsProvider>> = {greenhouse: {id: "greenhouse",diff --git a/src/lib/scraper/index.ts b/src/lib/scraper/index.tsindex 78dd417..ea651dd 100644--- a/src/lib/scraper/index.ts+++ b/src/lib/scraper/index.ts@@ -2,7 +2,6 @@ export * from "./types";export * from "./utils";export * from "./mapper";export * from "./schedule";-export { searchJSearchJobs } from "./jsearch";export {fetchBoardJobs,searchGreenhouseJobs,diff --git a/src/lib/scraper/jsearch/index.ts b/src/lib/scraper/jsearch/index.tsdeleted file mode 100644index 05b58a1..0000000--- a/src/lib/scraper/jsearch/index.ts+++ /dev/null@@ -1,126 +0,0 @@-import type { JobDetails, ScraperResult } from "../types";--const RAPIDAPI_KEY = process.env.RAPIDAPI_KEY;-const JSEARCH_BASE_URL = "https://jsearch.p.rapidapi.com";--interface JSearchJob {- job_id: string;- job_title: string;- employer_name: string;- employer_logo: string | null;- job_publisher: string;- job_employment_type: string;- job_apply_link: string;- job_description: string;- job_is_remote: boolean;- job_posted_at_datetime_utc: string;- job_city: string;- job_state: string;- job_country: string;- job_location: string;- job_min_salary: number | null;- job_max_salary: number | null;- job_salary_period: string | null;-}--interface JSearchResponse {- status: string;- request_id: string;- data: JSearchJob[];-}--// Extended search that returns full job details (no separate extract needed)-export async function searchJSearchJobs(- keywords: string,- location: string,- rapidApiKey?: string,-): Promise<ScraperResult<JobDetails[]>> {- const apiKey = rapidApiKey || RAPIDAPI_KEY;- if (!apiKey) {- return {- success: false,- error: { type: "network", message: "RAPIDAPI_KEY is not configured" },- };- }-- try {- const url = new URL(`${JSEARCH_BASE_URL}/search`);- url.searchParams.set("query", `${keywords} in ${location}`);- url.searchParams.set("page", "1");- url.searchParams.set("num_pages", "1");- url.searchParams.set("date_posted", "week");-- const response = await fetch(url.toString(), {- method: "GET",- headers: {- "X-RapidAPI-Key": apiKey,- "X-RapidAPI-Host": "jsearch.p.rapidapi.com",- },- });-- if (!response.ok) {- if (response.status === 429) {- return {- success: false,- error: { type: "rate_limited", retryAfter: 60 },- };- }- if (response.status === 403) {- return {- success: false,- error: {- type: "blocked",- reason: "API access denied - check your RapidAPI key",- },- };- }- return {- success: false,- error: {- type: "network",- message: `API error: ${response.status} ${response.statusText}`,- },- };- }-- const data: JSearchResponse = await response.json();-- const jobs: JobDetails[] = (data.data || []).map((job) => ({- title: job.job_title,- company: job.employer_name,- location: job.job_location || `${job.job_city}, ${job.job_state}`,- description: job.job_description,- url: job.job_apply_link,- postedDate: job.job_posted_at_datetime_utc,- salary: formatSalary(job),- employmentType: job.job_employment_type,- isRemote: job.job_is_remote,- }));-- return { success: true, data: jobs };- } catch (error) {- const message = error instanceof Error ? error.message : "Unknown error";- return { success: false, error: { type: "network", message } };- }-}--function formatSalary(job: JSearchJob): string | undefined {- if (!job.job_min_salary && !job.job_max_salary) {- return undefined;- }-- const min = job.job_min_salary;- const max = job.job_max_salary;- const period = job.job_salary_period || "year";-- if (min && max) {- return `$${min.toLocaleString()} - $${max.toLocaleString()} per ${period}`;- }- if (min) {- return `From $${min.toLocaleString()} per ${period}`;- }- if (max) {- return `Up to $${max.toLocaleString()} per ${period}`;- }- return undefined;-}diff --git a/src/lib/scraper/mapper.ts b/src/lib/scraper/mapper.tsindex 3c8d81c..4139eb2 100644--- a/src/lib/scraper/mapper.ts+++ b/src/lib/scraper/mapper.ts@@ -8,9 +8,9 @@ import {resolveJobSource,} from "@/lib/jobs/resolve";-// Maps source employment-type strings (JSearch's "FULLTIME"/"CONTRACTOR",-// Greenhouse's absence of the field, etc.) to JOB_TYPES enum keys. Defaults-// to full-time when the source doesn't expose employment type at all.+// Maps source employment-type strings ("FULLTIME"/"CONTRACTOR", Greenhouse's+// absence of the field, etc.) to JOB_TYPES enum keys. Defaults to full-time+// when the source doesn't expose employment type at all.const JOB_TYPE_ALIASES: Record<string, string> = {fulltime: "FT",parttime: "PT",diff --git a/src/lib/scraper/runner.ts b/src/lib/scraper/runner.tsindex a82aad3..19ebbe1 100644--- a/src/lib/scraper/runner.ts+++ b/src/lib/scraper/runner.ts@@ -8,8 +8,7 @@ import type {JobBoard,FunnelStage,} from "@/models/automation.model";-import type { ScraperError, JobDetails } from "./types";-import { searchJSearchJobs } from "./jsearch";+import type { JobDetails } from "./types";import { ATS_PROVIDERS } from "./ats/registry";import type { AtsProvider } from "./ats/types";import { runGreenhousePipeline } from "./greenhouse/pipeline";@@ -51,8 +50,6 @@ import {withSpan,} from "@/lib/telemetry";-const MAX_JOBS_PER_RUN = APP_CONSTANTS.MAX_JOBS_PER_RUN;-// Ollama serializes on the GPU, so it must process matches one at a time;// other providers can fan out concurrently.function getAutomationMatchLimit(provider: AiProvider) {@@ -94,18 +91,6 @@ export async function getUserAiSettings(userId: string): Promise<AiSettings> {};}-function getErrorMessage(error: ScraperError): string {- switch (error.type) {- case "blocked":- return error.reason;- case "rate_limited":- return `Rate limited${error.retryAfter ? ` - retry after ${error.retryAfter}s` : ""}`;- case "network":- case "parse":- return error.message;- }-}-export interface RunnerResult {runId: string;status: AutomationRunStatus;@@ -365,49 +350,16 @@ async function runAutomationTraced();const atsProvider = ATS_PROVIDERS[automation.jobBoard];- if (atsProvider) {- return await runAtsRun(- automation,- atsProvider,- run.id,- resume as ResumeWithSections,- effectiveSignal,- );- }-- automationLogger.log(- automation.id,- "info",- `Searching for jobs: "${automation.keywords}" in ${automation.location}`,- );-- // Use JSearch API with user's key if available- const rapidApiKey = await resolveApiKey(automation.userId, "rapidapi");- const searchResult = await searchJSearchJobs(- automation.keywords,- automation.location,- rapidApiKey,- );-- if (!searchResult.success) {- automationLogger.log(- automation.id,- "error",- `Search failed: ${searchResult.error.type} - ${getErrorMessage(searchResult.error)}`,- );+ if (!atsProvider) {+ // A retired board (jsearch) left on an existing row. The scheduler+ // filters these out; this covers a direct or manual invocation.+ const message = `Job board "${automation.jobBoard}" has been removed - delete this automation`;+ automationLogger.log(automation.id, "error", message);automationLogger.endRun(automation.id);- const status = getStatusFromError(searchResult.error);return await finalizeRun(run.id, {- status,- errorMessage:- searchResult.error.type === "network"- ? searchResult.error.message- : undefined,- blockedReason:- searchResult.error.type === "blocked"- ? searchResult.error.reason- : undefined,+ status: "blocked",+ blockedReason: "source_removed",jobsSearched: 0,jobsDeduplicated: 0,jobsProcessed: 0,@@ -416,247 +368,13 @@ async function runAutomationTraced(});}- const jobsSearched = searchResult.data.length;-- automationLogger.log(- automation.id,- "success",- `Found ${jobsSearched} jobs from JSearch API`,- { jobsSearched },+ return await runAtsRun(+ automation,+ atsProvider,+ run.id,+ resume as ResumeWithSections,+ effectiveSignal,);-- if (jobsSearched === 0) {- automationLogger.log(- automation.id,- "warning",- "No jobs found matching search criteria",- );- automationLogger.endRun(automation.id);-- return await finalizeRun(run.id, {- status: "completed",- jobsSearched: 0,- jobsDeduplicated: 0,- jobsProcessed: 0,- jobsMatched: 0,- jobsSaved: 0,- });- }-- automationLogger.log(- automation.id,- "info",- "Checking for duplicate jobs...",- );-- const existingKeys = await getExistingJobDedupeMap(automation.userId);- const newJobs = dedupeJobs(searchResult.data, existingKeys);- const jobsDeduplicated = newJobs.length;-- automationLogger.log(- automation.id,- "info",- `Filtered to ${jobsDeduplicated} new jobs (${jobsSearched - jobsDeduplicated} duplicates removed)`,- { jobsDeduplicated, duplicates: jobsSearched - jobsDeduplicated },- );-- const jobsToProcess = newJobs.slice(0, MAX_JOBS_PER_RUN);-- if (jobsToProcess.length < newJobs.length) {- automationLogger.log(- automation.id,- "info",- `Processing first ${jobsToProcess.length} of ${newJobs.length} new jobs (limit: ${MAX_JOBS_PER_RUN})`,- );- }-- let jobsProcessed = 0;- let jobsMatched = 0;- let jobsSaved = 0;- let aiError: string | null = null;-- const limit = getAutomationMatchLimit(aiSettings.provider);-- const processJob = async (job: JobDetails): Promise<void> => {- // Queued tasks bail immediately as slots free once aborted/errored.- if (effectiveSignal.aborted || aiError) return;-- automationLogger.log(- automation.id,- "info",- `Processing: ${job.title} at ${job.company}`,- );-- jobsProcessed++;-- const modelName =- aiSettings.model || getDefaultModelForProvider(aiSettings.provider);- automationLogger.log(- automation.id,- "info",- `Analyzing job match for: ${job.title} (using ${aiSettings.provider}/${modelName})`,- );-- const matchResult = await matchJobToResume(- job,- resume as ResumeWithSections,- automation.jobBoard as JobBoard,- aiSettings,- automation.userId,- effectiveSignal,- );-- // Abort may have fired mid-call; bail before saving this job.- if (effectiveSignal.aborted) return;-- if (!matchResult.success) {- if (matchResult.error === "ai_unavailable") {- // Only the first concurrent task to fail logs; siblings stay quiet.- if (!aiError) {- aiError = `AI provider (${aiSettings.provider}) is not available. Please check your settings.`;- automationLogger.log(automation.id, "error", aiError);- }- } else {- automationLogger.log(- automation.id,- "warning",- `AI matching failed: ${matchResult.error}`,- );- }- return;- }-- automationLogger.log(- automation.id,- "info",- `Match score: ${matchResult.score}% (threshold: ${automation.matchThreshold}%)`,- { score: matchResult.score, threshold: automation.matchThreshold },- );-- if (matchResult.score < automation.matchThreshold) {- automationLogger.log(- automation.id,- "info",- `Job skipped - score below threshold`,- );- return;- }-- jobsMatched++;-- automationLogger.log(- automation.id,- "success",- `Job matched! Saving to database...`,- {- title: job.title,- company: job.company,- },- );-- try {- const scrapedJob: ScrapedJobData = {- title: job.title,- company: job.company,- location: job.location,- description: job.description,- sourceUrl: normalizeJobUrl(job.url),- sourceBoard: automation.jobBoard as JobBoard,- employmentType: job.employmentType,- isRemote: job.isRemote,- };-- const jobRecord = await mapScrapedJobToJobRecord({- scrapedJob,- userId: automation.userId,- automationId: automation.id,- matchScore: matchResult.score,- matchData: JSON.stringify({- ...matchResult.data,- resumeId: resume.id,- resumeTitle: resume.title,- matchedAt: new Date().toISOString(),- provider: aiSettings.provider,- model: modelName,- }),- });-- await db.job.create({ data: jobRecord });- jobsSaved++;-- automationLogger.log(- automation.id,- "success",- `Job saved successfully (${jobsSaved} total)`,- { jobsSaved },- );- } catch (err: any) {- if (err?.code === "P2002") {- // Another concurrent run already saved this URL first.- automationLogger.log(- automation.id,- "info",- "Job skipped - already saved by a concurrent run",- );- return;- }- const errorMsg = err instanceof Error ? err.message : "Unknown error";- automationLogger.log(- automation.id,- "error",- `Failed to save job: ${errorMsg}`,- );- log.error("[Automation] Failed to save job", {- "automation.id": automation.id,- error: errorMsg,- });- }- };-- // JSearch returns full job details, no separate extraction needed- await Promise.allSettled(- jobsToProcess.map((job) => limit(() => processJob(job))),- );-- if (effectiveSignal.aborted) {- automationLogger.log(automation.id, "warning", "Run aborted by user");- }-- // Concurrent dispatch means in-flight jobs can still save after a sibling- // sets aiError, so "failed" would be misleading — treat it as partial.- const finalStatus: AutomationRunStatus = effectiveSignal.aborted- ? "cancelled"- : aiError- ? "completed_with_errors"- : jobsProcessed < jobsToProcess.length- ? "completed_with_errors"- : "completed";-- automationLogger.log(- automation.id,- finalStatus === "completed" ? "success" : "warning",- `Run finished with status: ${finalStatus}`,- {- status: finalStatus,- jobsSearched,- jobsDeduplicated,- jobsProcessed,- jobsMatched,- jobsSaved,- },- );-- automationLogger.endRun(automation.id);-- return await finalizeRun(run.id, {- status: finalStatus,- errorMessage: aiError || undefined,- jobsSearched,- jobsDeduplicated,- jobsProcessed,- jobsMatched,- jobsSaved,- });} catch (error) {// An abort surfaces here as an AbortError; finalize as cancelled, not failed.if (effectiveSignal.aborted || (error instanceof Error && error.name === "AbortError")) {@@ -1385,17 +1103,6 @@ async function convertResumeForMatch(return parts.filter(Boolean).join("\n");}-function getStatusFromError(error: ScraperError): AutomationRunStatus {- switch (error.type) {- case "blocked":- return "blocked";- case "rate_limited":- return "rate_limited";- default:- return "failed";- }-}-interface FinalizeData {status: AutomationRunStatus;errorMessage?: string;diff --git a/src/lib/scraper/utils.ts b/src/lib/scraper/utils.tsindex 437733b..3248f0a 100644--- a/src/lib/scraper/utils.ts+++ b/src/lib/scraper/utils.ts@@ -95,7 +95,7 @@ export function jobDedupeKey(job: DedupableJob): string {}// Removes jobs already saved (existingKeys) and collapses duplicates within the-// batch itself. Both source paths (JSearch, Greenhouse) run through here.+// batch itself. Both ATS source paths (Greenhouse, Lever) run through here.// Accepts any key lookup with `.has` so callers can pass a Set or the// getExistingJobDedupeMap Map directly.export function dedupeJobs<T extends DedupableJob>(diff --git a/src/models/apiKey.model.ts b/src/models/apiKey.model.tsindex 788fc3a..3afc0aa 100644--- a/src/models/apiKey.model.ts+++ b/src/models/apiKey.model.ts@@ -1,4 +1,4 @@-export type ApiKeyProvider = "openai" | "deepseek" | "openrouter" | "ollama" | "rapidapi";+export type ApiKeyProvider = "openai" | "deepseek" | "openrouter" | "ollama";export interface ApiKeyRecord {id: string;diff --git a/src/models/apiKey.schema.ts b/src/models/apiKey.schema.tsindex 683b1e7..9975170 100644--- a/src/models/apiKey.schema.ts+++ b/src/models/apiKey.schema.ts@@ -1,7 +1,7 @@import { z } from "zod";export const apiKeySaveSchema = z.object({- provider: z.enum(["openai", "deepseek", "openrouter", "ollama", "gemini", "rapidapi"]),+ provider: z.enum(["openai", "deepseek", "openrouter", "ollama", "gemini"]),key: z.string().min(1, "API key is required"),label: z.string().optional(),sensitive: z.boolean().default(true),diff --git a/src/models/automation.model.ts b/src/models/automation.model.tsindex e3cb4ae..13d69cd 100644--- a/src/models/automation.model.ts+++ b/src/models/automation.model.ts@@ -11,7 +11,7 @@ export type AutomationRunStatus =| "rate_limited"| "cancelled";export type DiscoveryStatus = "new" | "accepted" | "dismissed";-export type JobBoard = "jsearch" | "greenhouse" | "lever";+export type JobBoard = "greenhouse" | "lever";export interface GreenhouseCompany {name: string;@@ -47,12 +47,16 @@ export interface SourceConfig {lever?: LeverSourceConfig;}-// Plain, dependency-free ATS-board check. Do NOT import this from-// ats/registry.ts (that pulls the network-calling search fns into client-// bundles). Both the client-imported schema and the runner import it here.+// Plain, dependency-free board list. Do NOT import this from ats/registry.ts+// (that pulls the network-calling search fns into client bundles). Both the+// client-imported schema and the scheduler import it here.export const ATS_BOARDS: JobBoard[] = ["greenhouse", "lever"];-export function isAtsBoard(board: JobBoard): boolean {- return ATS_BOARDS.includes(board);++// Boards that used to exist and were removed. Their Automation rows stay in+// the database; the UI marks them retired and only offers pause/delete.+export const RETIRED_BOARDS = ["jsearch"];+export function isRetiredBoard(board: string): boolean {+ return RETIRED_BOARDS.includes(board);}export interface Automation {diff --git a/src/models/automation.schema.ts b/src/models/automation.schema.tsindex b92955c..5c7fb8e 100644--- a/src/models/automation.schema.ts+++ b/src/models/automation.schema.ts@@ -1,11 +1,10 @@import { z } from "zod";import { APP_CONSTANTS } from "@/lib/constants";-import { isAtsBoard } from "./automation.model";// Deep-import (NOT the barrel) — utils.ts is pure; the barrel pulls scraper// network code into the client bundle via this file's client consumers.import { ATS_TOKEN_REGEX } from "@/lib/scraper/utils";-export const JobBoardSchema = z.enum(["jsearch", "greenhouse", "lever"]);+export const JobBoardSchema = z.enum(["greenhouse", "lever"]);export const AutomationStatusSchema = z.enum(["active", "paused"]);@@ -68,33 +67,13 @@ export const CreateAutomationSchema = zscheduleHour: z.number().min(0).max(23),}).superRefine((data, ctx) => {- if (data.jobBoard === "jsearch") {- if (!data.keywords || data.keywords.trim().length === 0) {- ctx.addIssue({- code: z.ZodIssueCode.custom,- path: ["keywords"],- message: "Keywords are required",- });- }- if (!data.location || data.location.trim().length === 0) {- ctx.addIssue({- code: z.ZodIssueCode.custom,- path: ["location"],- message: "Location is required",- });- }- }-- if (isAtsBoard(data.jobBoard)) {- const atsKey = data.jobBoard as "greenhouse" | "lever";- const companies = data.sourceConfig?.[atsKey]?.companies ?? [];- if (companies.length < 1) {- ctx.addIssue({- code: z.ZodIssueCode.custom,- path: ["sourceConfig", atsKey, "companies"],- message: "Select at least one company",- });- }+ const companies = data.sourceConfig?.[data.jobBoard]?.companies ?? [];+ if (companies.length < 1) {+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ path: ["sourceConfig", data.jobBoard, "companies"],+ message: "Select at least one company",+ });}});@@ -110,16 +89,14 @@ export const UpdateAutomationSchema = zscheduleHour: z.number().min(0).max(23).optional(),}).superRefine((data, ctx) => {- if (data.jobBoard && isAtsBoard(data.jobBoard)) {- const atsKey = data.jobBoard as "greenhouse" | "lever";- const companies = data.sourceConfig?.[atsKey]?.companies ?? [];- if (companies.length < 1) {- ctx.addIssue({- code: z.ZodIssueCode.custom,- path: ["sourceConfig", atsKey, "companies"],- message: "Select at least one company",- });- }+ if (!data.jobBoard) return;+ const companies = data.sourceConfig?.[data.jobBoard]?.companies ?? [];+ if (companies.length < 1) {+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ path: ["sourceConfig", data.jobBoard, "companies"],+ message: "Select at least one company",+ });}});