mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-11-09 00:17:39 +00:00
fix(freehire-search): say what --region is, and warn when it matches a thin bucket (#651)
* fix(freehire-search): warn when --region gets a value outside the vocabulary freehire's contract - the openapi Regions enum and RegionValues in vocab.go - defines a closed set: nine buckets plus none. Anything else is a stray tag, so a region filter on us or any other country code matches a handful of postings and reads as an empty or thin market, which is how #616 started. search now checks the requested values (--region and the --facet regions= escape hatch, case-insensitively) against that set and, when one falls outside it, writes one JSON line on stderr after the results, with code REGION_VALUE_UNKNOWN. The result count is deliberately not consulted: a broad query returns real hits under a stray tag and the parameter is still wrong. stdout stays clean JSON, exit code 0. Tests are unit-level with a stubbed fetch: no extra request to the free API, and no change to the existing search tests. * changelog: place the #651 entry under [Unreleased] Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Mads Lorentzen <madslorentzen_17@hotmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
5 files changed
+250
No files matched your search
@@ -43,6 +43,9 @@ Compose (`make up` → API on `:8080`, same `/api/v1/...` paths).
|
||||
|
||||
`search` accepts `--format json|table|plain` (default `json`); `detail` accepts `--format json|plain`.
|
||||
All errors are written to **stderr** as `{ "error": "...", "code": "..." }` with exit code `1`.
|
||||
One diagnostic is a warning instead: a `--region` value outside the documented vocabulary
|
||||
prints `{ "warning": "...", "code": "REGION_VALUE_UNKNOWN" }` to stderr after the results,
|
||||
and exits `0`, leaving stdout a valid JSON document.
|
||||
|
||||
`search` hits the API's agent endpoint, so every JSON result already carries the
|
||||
posting's **full** description (Markdown by default, `--description-format
|
||||
|
||||
Reference in new issue
Block a user