Hosts a to l declare READS: places, teaser, stated seniority and employment

Ashby, BambooHR, Deel, Eightfold, Gem, Greenhouse, HiBob, HR Manager, Jibe,
Jobylon and Lever move to feed_url(slug, ask) and page(get, slug, cursor, ask),
declare READS with the robots decision, and drop robots_page. Rows carry
places (Ashby secondaryLocations, Lever allLocations, Greenhouse offices in
place of a Hybrid placeholder), Jobylon keeps its summary as teaser and maps
experience and employment, Eightfold reads creationTs as the posting date and
Ashby reads workplaceType. Fixtures <name>-places.* and jobylon-teaser.html
drive the conformance checks; the eleven names leave UNDECLARED.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 09:11:53 +02:00
1 parent 4c0da58da7
commit f2e652a8da
35 files changed
+1290 -391

No files matched your search

+33 -13
View File
@@ -19,13 +19,24 @@ from __future__ import annotations
import html
import json
import logging
import re
from collections.abc import Callable
from typing import Any
from desk.sources import strip_html
from ._shared import Get, Page, Row, only, parse_dt
from ._contract import Ask, Fields, Place, Reads, Row
from ._shared import Get, Page, only, parse_dt
log = logging.getLogger(__name__)
READS = Reads(
scope="board", listing="paged", text="detail", complete="end",
places="many", empty="suspect",
fields=Fields(posted="listed", remote="stated", employment="stated"),
robots="read: robots.txt allows /<board> (checked 2026-09-29)",
)
NAME = "gem"
LABEL = "Gem"
@@ -57,6 +68,11 @@ DETAIL_QUERY = (
#: `job.locationType` -> `store._remote`'s words.
_REMOTE = {"IN_OFFICE": "onsite", "HYBRID": "hybrid", "REMOTE": "remote"}
#: `job.employmentType` -> the app's employment words.
_EMPLOYMENT = {"FULL_TIME": "full_time", "PART_TIME": "part_time", "CONTRACT": "contract",
"CONTRACTOR": "contract", "INTERN": "intern", "INTERNSHIP": "intern",
"TEMPORARY": "temporary", "FREELANCE": "freelance"}
def slug_ok(slug: str) -> bool:
return bool(_BOARD.fullmatch(slug))
@@ -70,10 +86,6 @@ def careers_url(slug: str) -> str:
return f"https://{_HOST}/{slug}"
def robots_page(slug: str) -> str:
return careers_url(slug)
def _ask(get: Get, operation: str, query: str, variables: dict[str, str],
path: str) -> Any:
"""One GraphQL call, and the part of its answer at `data.<path>`. An
@@ -93,7 +105,7 @@ def _ask(get: Get, operation: str, query: str, variables: dict[str, str],
return data[path]
def page(get: Get, slug: str, cursor: Any) -> Page:
def page(get: Get, slug: str, cursor: Any, ask: Ask) -> Page:
"""The one page there is: `data.oatsExternalJobPostings.jobPostings`."""
board = _ask(get, "JobBoardList", LIST_QUERY, {"boardId": slug}, "oatsExternalJobPostings")
postings = board.get("jobPostings") if isinstance(board, dict) else None
@@ -116,26 +128,34 @@ def rows(postings: list[dict[str, Any]], slug: str) -> list[Row]:
if not title or not ext_id:
continue
locations = p.get("locations") or []
places: list[str] = []
places: list[Place] = []
for loc in locations:
place = str(loc.get("city") or loc.get("name") or "").strip()
if place and place not in places:
places.append(place)
text = str(loc.get("city") or loc.get("name") or "").strip()
if text and text not in (pl["text"] for pl in places):
places.append({"text": text, "remote": loc["isRemote"]
if isinstance(loc.get("isRemote"), bool) else None})
job = p.get("job") or {}
remote = _REMOTE.get(str(job.get("locationType") or "").upper())
if remote is None and locations and all(loc.get("isRemote") for loc in locations):
remote = "remote"
out.append({
row: Row = {
"source_id": ext_id,
"title": title,
"location": "; ".join(places),
"places": places,
"location": "; ".join(pl["text"] for pl in places),
"url": f"{careers_url(slug)}/{ext_id}",
"posted": None, # only the role's own query has a date
"department": str((job.get("department") or {}).get("name") or "").strip(),
"description": "",
"remote": remote,
"salary_text": "",
})
}
if word := str(job.get("employmentType") or "").strip().upper():
if employment := _EMPLOYMENT.get(word):
row["employment"] = employment
else:
log.debug("gem: unknown employmentType %r", word)
out.append(row)
return out