Read big boards within the agents' reach: countries and remote from the enabled agents, Europe for favourites, filtered at the source by six hosts

app/jobs/reach.py derives each board's reach once per pull and the pull hands it to the runner through the batch payload. SmartRecruiters, Eightfold and SuccessFactors filter one country a request, Phenom a list, Workday and Oracle by host ids from facets. Remote beside countries is a series of its own, since two facets intersect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 09:55:18 +02:00
1 parent 3adafd8950
commit 3462a4abe7
17 files changed
+1324 -116

No files matched your search

+79 -3
View File
@@ -12,6 +12,17 @@ keeps the case the URL wrote (`KEEP_CASE`).
Written from live career sites on 2026-09-29 (`docs/plan-hosts/workday.md`).
The listing carries no description, so `detail` reads each role's own JSON.
Countries and remote are filtered on the server by the tenant's own facets
(`Filters(country="ids", remote="ids")`): `appliedFacets` takes
`{<facetParameter>: [<id>, ...]}`, ids within one facet are a union, and two
facets are an intersection, which is why the runner asks for remote in a
series of its own. Each tenant names its facets its own way (LEGO's
`Location` lists countries, others nest `locationCountry` under
`locationMainGroup`), so `facets` reads them off the first page and picks the
one whose values are countries. A host id is `<facetParameter>=<id>`. LEGO
answered 97 of 455 for Denmark on 2026-09-30; a role at several places is
kept when one of them is in the country.
"""
from __future__ import annotations
@@ -26,7 +37,8 @@ from typing import Any
from desk.sources import strip_html
from ._contract import Ask, Fields, Place, Reads
from ._contract import Ask, Fields, Filters, Place, Reads
from ._countries import code_of
from ._shared import Get, Page, Row, only, parse_dt
log = logging.getLogger(__name__)
@@ -37,7 +49,7 @@ KEEP_CASE = True
READS = Reads(
scope="board", listing="paged", page_size=20, ceiling=2000, text="detail",
complete="stated", places="many",
complete="stated", places="many", filters=Filters(country="ids", remote="ids"),
fields=Fields(posted="trusted", remote="stated", country="stated", employment="stated"),
robots="read: robots.txt allows /<Site>/ (checked 2026-09-29)",
)
@@ -104,7 +116,8 @@ def page(get: Get, slug: str, cursor: Any, ask: Ask = Ask()) -> Page:
offset, total = cursor or (0, None)
data = json.loads(get(
f"https://{_host(slug)}/wday/cxs/{tenant}/{site}/jobs", method="POST",
payload={"appliedFacets": {}, "limit": PAGE_SIZE, "offset": offset, "searchText": ""}))
payload={"appliedFacets": _applied(ask), "limit": PAGE_SIZE, "offset": offset,
"searchText": ""}))
if cursor is None:
stated = data.get("total")
total = stated if isinstance(stated, int) and not isinstance(stated, bool) else None
@@ -118,6 +131,69 @@ def page(get: Get, slug: str, cursor: Any, ask: Ask = Ask()) -> Page:
return data, results, total, (following, total) if more else None
def _applied(ask: Ask) -> dict[str, list[str]]:
"""`appliedFacets` for the host ids `ask` carries, `<facetParameter>=<id>`
each, grouped by facet."""
out: dict[str, list[str]] = {}
for value in (*ask.countries, *ask.remote_ids):
facet, sep, value_id = value.partition("=")
if sep and facet and value_id:
out.setdefault(facet, []).append(value_id)
return out
#: A facet whose values are countries: at least this share of them name one.
_COUNTRY_SHARE = 0.8
def _facet_lists(facets: Any) -> list[tuple[str, list[dict[str, Any]]]]:
"""`(facetParameter, values)` of every facet of an answer, the facets nested
in a group (`locationMainGroup` holds `locationCountry` on some tenants)
included."""
out: list[tuple[str, list[dict[str, Any]]]] = []
for facet in facets if isinstance(facets, list) else []:
if not isinstance(facet, dict):
continue
values = [v for v in facet.get("values") or [] if isinstance(v, dict)]
nested = [v for v in values if "values" in v and "facetParameter" in v]
out += _facet_lists(nested)
plain = [v for v in values if v not in nested]
if plain and str(facet.get("facetParameter") or ""):
out.append((str(facet["facetParameter"]), plain))
return out
def facets(get: Get, slug: str) -> dict[str, dict[str, str]]:
"""The tenant's host ids, read off one page of one role: `country` maps
an ISO code to `<facetParameter>=<id>` in the facet whose values are
countries (most of them, `_COUNTRY_SHARE`; the one with most countries
when two are), and `remote` maps each facet value that `_REMOTE` reads as
remote ("Remote", "Fully Flexible"), in whatever facet, to its id. A
tenant with neither states no such dimension, and the runner then does
not filter on it."""
tenant, _dc, site = _parts(slug) # type: ignore[misc]
data = json.loads(get(
f"https://{_host(slug)}/wday/cxs/{tenant}/{site}/jobs", method="POST",
payload={"appliedFacets": {}, "limit": 1, "offset": 0, "searchText": ""}))
country: dict[str, str] = {}
remote: dict[str, str] = {}
for name, values in _facet_lists(data.get("facets")):
found = {code: f"{name}={v['id']}" for v in values
if v.get("id") and (code := code_of(str(v.get("descriptor") or "")))}
if len(found) >= _COUNTRY_SHARE * len(values) and len(found) > len(country):
country = found
for v in values:
word = " ".join(str(v.get("descriptor") or "").split())
if v.get("id") and _remote(word) == "remote":
remote[word.lower()] = f"{name}={v['id']}"
out: dict[str, dict[str, str]] = {}
if country:
out["country"] = country
if remote:
out["remote"] = remote
return out
def _posting_id(posting: dict[str, Any], position: int) -> str:
return str(posting.get("externalPath") or "".join(posting.get("bulletFields") or [])
or f"#{position}")