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(mcp): label matches scored from incomplete descriptions as provisional
Khuram Niaz1ed23c8c7119
diff --git a/__tests__/saveMatchResult.spec.ts b/__tests__/saveMatchResult.spec.tsindex 37cce2a..5e099cc 100644--- a/__tests__/saveMatchResult.spec.ts+++ b/__tests__/saveMatchResult.spec.ts@@ -6,7 +6,7 @@ const prisma = new PrismaClient();vi.mock("@prisma/client", () => {const mPrismaClient = {- job: { update: vi.fn() },+ job: { update: vi.fn(), findFirst: vi.fn() },user: { findUnique: vi.fn() },resume: { findFirst: vi.fn() },};@@ -31,6 +31,9 @@ describe("handleSaveMatchResult", () => {title: "My Resume",});(prisma.job.update as any).mockResolvedValue({ id: "job-1" });+ (prisma.job.findFirst as any).mockResolvedValue({+ descriptionCompleteness: "full",+ });});it("parses a valid matchText and persists clamped score + shaped matchData", async () => {@@ -214,4 +217,47 @@ describe("handleSaveMatchResult", () => {expect(result.content[0].text).toContain("Error: connection reset");});++ it("stamps the job's descriptionCompleteness onto matchData", async () => {+ (prisma.job.findFirst as any).mockResolvedValue({+ descriptionCompleteness: "partial",+ });++ await handleSaveMatchResult(+ { jobId: "job-1", matchText: validMatchText },+ "user-1",+ "my-token",+ );++ const data = (prisma.job.update as any).mock.calls[0][0].data;+ expect(JSON.parse(data.matchData).descriptionCompleteness).toBe("partial");+ });++ it("scopes the completeness lookup to the caller's MCP-created jobs", async () => {+ await handleSaveMatchResult(+ { jobId: "job-1", matchText: validMatchText },+ "user-1",+ "my-token",+ );++ expect(prisma.job.findFirst).toHaveBeenCalledWith({+ where: { id: "job-1", userId: "user-1", createdVia: { not: null } },+ select: { descriptionCompleteness: true },+ });+ });++ it("omits descriptionCompleteness when the job has none recorded", async () => {+ (prisma.job.findFirst as any).mockResolvedValue({+ descriptionCompleteness: null,+ });++ await handleSaveMatchResult(+ { jobId: "job-1", matchText: validMatchText },+ "user-1",+ "my-token",+ );++ const data = (prisma.job.update as any).mock.calls[0][0].data;+ expect(JSON.parse(data.matchData).descriptionCompleteness).toBeUndefined();+ });});diff --git a/src/components/automations/MatchDetails.tsx b/src/components/automations/MatchDetails.tsxindex 6d48b31..2c0775e 100644--- a/src/components/automations/MatchDetails.tsx+++ b/src/components/automations/MatchDetails.tsx@@ -33,11 +33,22 @@ export function MatchDetails({ matchData, discoveredAt }: MatchDetailsProps) {return (<div className="space-y-3">- {matchData.recommendation && (- <Badge variant="outline" className="capitalize">- {matchData.recommendation}- </Badge>- )}+ <div className="flex flex-wrap items-center gap-2">+ {matchData.recommendation && (+ <Badge variant="outline" className="capitalize">+ {matchData.recommendation}+ </Badge>+ )}+ {matchData.descriptionCompleteness &&+ matchData.descriptionCompleteness !== "full" && (+ <Badge+ variant="secondary"+ title="Scored from an incomplete job description — re-run the match after adding the full posting."+ >+ Provisional score+ </Badge>+ )}+ </div>{html ? (<div className="text-sm leading-relaxed [&_p]:mt-2 [&_ul]:mt-2 [&_ol]:mt-2 [&_h2]:mt-4 [&_h2]:font-semibold">diff --git a/src/lib/mcp/tools/saveMatchResult.ts b/src/lib/mcp/tools/saveMatchResult.tsindex 69f2027..08bc090 100644--- a/src/lib/mcp/tools/saveMatchResult.ts+++ b/src/lib/mcp/tools/saveMatchResult.ts@@ -5,6 +5,7 @@ import { McpSaveMatchResultSchema } from "@/models/mcp.schema";import { checkMcpRateLimit } from "@/lib/mcp/rate-limit";import { parseJobMatch } from "@/lib/ai/jobMatch/parse";import type { JobMatchData } from "@/models/ai.schemas";+import type { DescriptionCompleteness } from "@/models/job.model";export async function handleSaveMatchResult(input: z.infer<typeof McpSaveMatchResultSchema>,@@ -61,6 +62,13 @@ export async function handleSaveMatchResult(: null;}+ // Same scope as the update below, so a job the caller can't write to+ // never leaks its completeness through this read either.+ const job = await prisma.job.findFirst({+ where: { id: input.jobId, userId, createdVia: { not: null } },+ select: { descriptionCompleteness: true },+ });+const matchData: JobMatchData = {matchScore: parsed.scores.matchScore,recommendation: parsed.scores.recommendation,@@ -71,6 +79,8 @@ export async function handleSaveMatchResult(provider: APP_CONSTANTS.MCP_MATCH_PROVIDER_MARKER,model: tokenName,analyzed: true,+ descriptionCompleteness:+ (job?.descriptionCompleteness as DescriptionCompleteness | null) ?? undefined,};try {diff --git a/src/models/ai.schemas.ts b/src/models/ai.schemas.tsindex 7b29263..4442cd4 100644--- a/src/models/ai.schemas.ts+++ b/src/models/ai.schemas.ts@@ -1,4 +1,5 @@import { z } from "zod";+import type { DescriptionCompleteness } from "@/models/job.model";// RESUME REVIEW SCORES SCHEMA// The review body is free-form markdown; only the four scores are structured@@ -64,4 +65,6 @@ export type JobMatchData = JobMatchScores & {prerankScore?: number; // raw lexical score (internal sort only; NOT shown as %)analyzed?: boolean; // true once LLM match has run (auto top-K or on-demand)prerankComponents?: PrerankComponents;+ // Set by the MCP path: how complete the job description was when scored.+ descriptionCompleteness?: DescriptionCompleteness;};