freehire-search: identify this project in the User-Agent (#633)

The old value linked to freehire.me, which named the API rather than the
caller, so the API's operators could not reach this project before a
limit or field change. Use the owner/project form freehire's API docs ask
for, with this repo as the contact URL.
This commit is contained in:
Ilya Strelov authored and GitHub committed 2026-10-18 21:38:27 +02:00
1 parent 30158c0493
commit ce9b656829
2 files changed
+7 -3

No files matched your search

@@ -16,7 +16,11 @@ export function writeError(error: string, code: string): void {
process.stderr.write(JSON.stringify({ error, code }) + "\n")
}
const UA = "freehire-search-skill/1.0 (+https://freehire.me)"
// Names this project, the shape freehire's API docs ask for (owner/project/version
// plus a contact URL), so the API's operators can reach the maintainer before a
// limit or a field changes. The old value linked to freehire.me itself, which
// identified the API, not the caller.
const UA = "MadsLorentzen/ai-job-search/1.0 (+https://github.com/MadsLorentzen/ai-job-search; freehire-search)"
/** The shared API response envelope: {data, meta, error}. */
export interface Envelope<T> {
@@ -138,8 +138,8 @@ points users to (`?q=<role>` scopes the counts). Example:
serves HTML, which `cleanHtml` (`cli/src/helpers.ts`) strips into readable text.
Search descriptions arrive already rendered by the API and are passed through
verbatim — stripping them again would undo the Markdown structure.
- Fetch uses a browser-ish User-Agent, `Accept: application/json`, and exponential
backoff with jitter on 429/5xx (max 6 retries). A connection error (API
- Fetch sends `User-Agent: MadsLorentzen/ai-job-search/1.0 (+https://github.com/MadsLorentzen/ai-job-search; freehire-search)`
and `Accept: application/json`, and uses exponential backoff with jitter on 429/5xx (max 6 retries). A connection error (API
unreachable) fails fast with a clear message — no retry, since it is not
transient server load — which is the graceful-degradation contract: an outage
degrades this source quickly instead of hanging the caller.