mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-09-17 08:36:25 +00:00
feat(freehire-search): add --no-description for cheap discovery passes
A default search hydrates full bodies - ~73% of the payload, ~20k tokens per query fed into agent context - while /scrape's own Step 2 says to pre-filter by title before reading bodies. The flag keeps every other field and drops the bodies (live 10-result search: ~58k -> ~10k chars); hydration stays the default per the documented trade-off. The API returns bodies regardless of include_description=false (verified live), so the lean guarantee is enforced client-side. Review opportunity O1 (2026-08-19), approved as an enhancement. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
c85640e30a
commit
dd02c82485
@@ -112,6 +112,24 @@ describe("runSearch (mocked fetch)", () => {
|
||||
expect(requestedParams(mock).get("description_format")).toBe("markdown");
|
||||
});
|
||||
|
||||
test("skips description hydration when includeDescription is false", async () => {
|
||||
// A default search hydrates ~20k tokens of description bodies per query,
|
||||
// while /scrape's Step 2 says to pre-filter by title/snippet before
|
||||
// reading bodies. --no-description keeps the discovery pass cheap;
|
||||
// hydration stays the default (review opportunity O1, 2026-08-19).
|
||||
const mock = mockFetch(200, { data: [job()], meta: { total: 1 } });
|
||||
|
||||
const out = captureStdout();
|
||||
await runSearch({ ...searchOpts, query: "backend", includeDescription: false });
|
||||
|
||||
expect(requestedParams(mock).get("include_description")).toBe("false");
|
||||
expect(requestedParams(mock).get("description_format")).toBeNull();
|
||||
// The live API ignores include_description=false and sends bodies anyway
|
||||
// (verified 2026-08-19), so the lean guarantee is enforced client-side.
|
||||
const parsed = JSON.parse(out.get());
|
||||
expect(parsed.results[0].description).toBeNull();
|
||||
});
|
||||
|
||||
test("asks for the requested description format", async () => {
|
||||
const mock = mockFetch(200, { data: [job()], meta: { total: 1 } });
|
||||
captureStdout();
|
||||
|
||||
Reference in New Issue
Block a user