fix(discovery): block countries in vague locations via job description
CI / Linting (Biome) (push) Failing after 41s
CI / Tests (push) Successful in 5m22s
CI / Type Check (adzuna-extractor) (push) Successful in 1m9s
CI / Type Check (gradcracker-extractor) (push) Successful in 1m14s
CI / Type Check (hiringcafe-extractor) (push) Successful in 1m11s
CI / Type Check (orchestrator) (push) Successful in 1m28s
CI / Type Check (startupjobs-extractor) (push) Successful in 1m13s
CI / Type Check (ukvisajobs-extractor) (push) Successful in 1m12s
CI / Documentation (push) Successful in 2m0s

QAJobsBoard and similar feeds often store Worldwide/Remote while the real
country is only in the description. Scan title and description when location
is vague, and prefer concrete locations from QAJobsBoard postings.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-16 17:15:18 -04:00
co-authored by Cursor
parent f0261711c6
commit 0a63316100
5 changed files with 213 additions and 7 deletions
+36 -3
View File
@@ -81,14 +81,47 @@ function salaryLabel(raw: SalaryBand | undefined): string | undefined {
return schedule.trim() || undefined;
}
const VAGUE_LOCATION_LABELS = new Set([
"worldwide",
"global",
"anywhere",
"remote",
"unknown",
]);
function isVagueLocationLabel(value: string): boolean {
return VAGUE_LOCATION_LABELS.has(value.trim().toLowerCase());
}
function extractJobLocationFromDescription(
html: string | undefined,
): string | undefined {
if (!html) return undefined;
const text = stripHtml(html);
const match = text.match(
/\bjob\s+location\s*:\s*([^\n.]{2,120})/i,
);
if (!match?.[1]) return undefined;
const extracted = match[1].trim();
return extracted || undefined;
}
function locationLabel(job: QaJobBoardlyJob): string {
const limits = Array.isArray(job.location_limits)
? job.location_limits.filter(
(v): v is string => typeof v === "string" && v.trim().length > 0,
)
? job.location_limits
.map((v) => (typeof v === "string" ? v.trim() : ""))
.filter((v) => v.length > 0 && !isVagueLocationLabel(v))
: [];
if (limits.length > 0) return limits.join(", ");
const loc = asString(job.location);
if (loc && !isVagueLocationLabel(loc)) return loc;
const fromDescription = extractJobLocationFromDescription(
job.description?.html,
);
if (fromDescription) return fromDescription;
if (loc) return loc;
return "Unknown";
}