fix(jobindex-search): map ASAP deadlines to null per the /scrape contract

apply_deadline_asap was emitted as the string "ASAP" on ~half of live
results - undocumented, contradicting the CLI's own README, and breaking
every consumer that does date arithmetic on the field (rank's sweep,
outcome's deadline check, notion-sync's typed date column). ASAP means
"no stated deadline", which the schema already defines null to mean.
The flag wins over any date field that happens to be present. Review
finding F12 (2026-08-19), decision approved by Mads.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mads Lorentzen
2026-08-19 20:29:40 +02:00
co-authored by Claude Opus 5
parent 2edf8c41f1
commit b067928da7
4 changed files with 28 additions and 2 deletions
@@ -45,6 +45,21 @@ describe("parseSearchPage", () => {
});
});
test("maps an ASAP posting's deadline to null (no stated deadline)", () => {
// apply_deadline_asap means "no fixed deadline, apply now". The /scrape
// schema defines null as exactly that, and every consumer (rank's expiry
// sweep, notion-sync's typed date column) does date arithmetic on this
// field - a bare "ASAP" string broke all of them on half of live results
// (review finding F12, 2026-08-19). lastdate present too: the flag wins.
const [job] = parseSearchPage(
stashPage({
hitcount: 1,
results: [{ ...RESULT, apply_deadline: undefined, apply_deadline_asap: true, lastdate: "2026-09-30" }],
}),
).results;
expect(job.deadline).toBeNull();
});
test("falls back to lastdate when apply_deadline is absent", () => {
const [job] = parseSearchPage(
stashPage({ hitcount: 1, results: [{ ...RESULT, apply_deadline: undefined, lastdate: "2026-09-30" }] }),