Let the runner drop and count a row without an id, a title or a link, as ADR Plugins 3.8 has it, in one place for whole, paged and search reads: the count is stamped per target, logged, named on the board's row, and over 10% of the rows fails the read; the 28 readers hand every listing over instead of skipping it

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Fable 5.1 committed 2026-10-06 14:04:33 +02:00
1 parent 38c31c830b
commit 911dfe8584
58 files changed
+479 -203

No files matched your search

+25 -16
View File
@@ -63,7 +63,7 @@ from desk.sources import strip_html
from ._contract import Ask, Fields, Filters, Place, Reads
from ._countries import NAMES
from ._shared import Get, Page, Row, add_place, html_text, is_web_url, only, parse_dt
from ._shared import Get, Page, Row, add_place, html_text, only, parse_dt
NAME = "successfactors"
LABEL = "SuccessFactors"
@@ -247,8 +247,9 @@ def _tile_fields(chunk: str) -> tuple[str, str, str]:
def _entries(text: str) -> list[dict[str, Any]]:
"""The roles of one search page, in the order shown, whichever layout it is
in and before the prefix filter: `id`, `href` (as written, relative),
`title`, `place`, `date` and `department`. A role is listed once, and a row
without a link to a role is not one."""
`title`, `place`, `date` and `department`. A role is listed once. The id
and the title are in the role's link, so a row without one is handed over
with an empty `id`, `href` and `title`, for the runner to drop and count."""
table = _ROW.split(text)[1:]
chunks = table or _TILE.split(text)[1:]
out: list[dict[str, Any]] = []
@@ -256,10 +257,12 @@ def _entries(text: str) -> list[dict[str, Any]]:
for chunk in chunks:
if table:
chunk = chunk.split("</tr>", 1)[0]
if not (link := _LINK.search(chunk)):
continue
href, job_id, title = html.unescape(link.group(1)), link.group(2), _text(link.group(3))
if job_id in seen:
if link := _LINK.search(chunk):
href, job_id, title = (html.unescape(link.group(1)), link.group(2),
_text(link.group(3)))
else:
href = job_id = title = ""
if job_id and job_id in seen:
continue
seen.add(job_id)
place, date, department = (_table_fields if table else _tile_fields)(chunk)
@@ -283,12 +286,14 @@ def page(get: Get, slug: str, cursor: Any, ask: Ask = Ask()) -> Page:
if not _SEARCH_PAGE.search(text):
raise ValueError("not a SuccessFactors search page")
found = _entries(text)
ids = [entry["id"] for entry in found if entry["id"]]
total = _total(text)
if found and found[0]["id"] == previous:
first = ids[0] if ids else None
if first is not None and first == previous:
return text, [], total, (start, previous)
more = bool(found) and (total is None or start + len(found) < total)
return (text, [{"id": entry["id"]} for entry in found], total,
(start + len(found), found[0]["id"]) if more else None)
return (text, [{"id": job_id} for job_id in ids], total,
(start + len(found), first) if more else None)
def rows(decoded: str, slug: str) -> list[Row]:
@@ -296,17 +301,21 @@ def rows(decoded: str, slug: str) -> list[Row]:
slug's prefix when it has one; the id in it is the requisition's `source_id`.
The table and the tile layout give a title, a location, a date and, where
the site has the column, a department; nothing else about a role is on
the list, so its description and pay are empty."""
the list, so its description and pay are empty.
A role linked on another host, or outside the prefix, is another board's
(another site, or another brand of a shared site), and is left out: it is
no role of this company. A row with no link or no title is handed over,
and the runner drops it."""
host, prefix = _parts(slug)
base = f"https://{host}/"
out = []
for entry in _entries(decoded):
url = urljoin(base, entry["href"])
if urlsplit(url).hostname != host or not is_web_url(url):
url = urljoin(base, entry["href"]) if entry["href"] else ""
if url and urlsplit(url).hostname != host:
continue
if prefix and not urlsplit(url).path.lower().startswith(f"{prefix.lower()}/job/"):
continue
if not entry["title"]:
if url and prefix and not urlsplit(url).path.lower().startswith(
f"{prefix.lower()}/job/"):
continue
out.append({
"source_id": entry["id"],