From 0b76b16daad39ab4b9b4900a1948ce7867a52bc9 Mon Sep 17 00:00:00 2001 From: Wolf Date: Tue, 29 Sep 2026 20:00:52 +0200 Subject: [PATCH 1/5] Read Pinpoint boards from their postings.json Co-Authored-By: Claude Sonnet 5.5 --- plugins/atshosts/pinpoint.py | 149 +++++++++++++++++++++++++++++ tests/fixtures/ats/pinpoint.json | 1 + tests/test_ats_pinpoint.py | 155 +++++++++++++++++++++++++++++++ 3 files changed, 305 insertions(+) create mode 100644 plugins/atshosts/pinpoint.py create mode 100644 tests/fixtures/ats/pinpoint.json create mode 100644 tests/test_ats_pinpoint.py diff --git a/plugins/atshosts/pinpoint.py b/plugins/atshosts/pinpoint.py new file mode 100644 index 0000000..dd6bd2e --- /dev/null +++ b/plugins/atshosts/pinpoint.py @@ -0,0 +1,149 @@ +"""Pinpoint: `pinpoint:` for acme.pinpointhq.com, the whole board +in one JSON answer. There is no probe: an unknown subdomain's answer was not +checked, and a board is found by the link a career site carries. + +Written from Xeneta's board on 2026-09-29 (two roles); jobhunt-hq did not read +Pinpoint. Unverified: whether a large board pages `/postings.json` (the answer +has a `data` list and no paging keys, so every board is read as complete +here), and the spelling of `compensation_frequency`, since no board read so far +shows its pay (`compensation_visible` was false on both roles). A board shared +by several brands (inMusic's, with Native Instruments on it) is read whole; +there is no filter on `job.division`. + +There is no posted date in the listing, only in each posting's page as JSON-LD, +so `posted` stays None rather than costing a request a role for it. +""" + +from __future__ import annotations + +import html +import json +from collections.abc import Callable +from typing import Any + +from desk.sources import strip_html + +from ._shared import Row, is_web_url, label_slug_ok, num, only, pay_line, yearly_amount + +NAME = "pinpoint" +LABEL = "Pinpoint" +PATTERNS = (r"https?://([a-z0-9-]+)\.pinpointhq\.com",) + +#: `workplace_type` -> `store._remote`'s words. Anything else says nothing. +_REMOTE = {"onsite": "onsite", "on_site": "onsite", "hybrid": "hybrid", "remote": "remote"} + +#: `compensation_frequency` -> the multiplier that makes a figure yearly. The +#: spellings are a guess, since no board read so far states pay; a frequency +#: not listed leaves the yearly columns empty, and `salary_text` still says it. +_YEARLY = {"annually": 1, "annual": 1, "yearly": 1, "year": 1, "monthly": 12, "month": 12} + +#: `compensation_frequency` -> the word `salary_text` says after "per". +_PERIOD = {"annually": "year", "annual": "year", "yearly": "year", "monthly": "month", + "weekly": "week", "daily": "day", "hourly": "hour"} + +#: The sections of a posting's text, in the order the page shows them: the +#: description, then these fields, each with its own heading in `_header`. +_SECTIONS = ("key_responsibilities", "skills_knowledge_expertise", "benefits") + + +def host(slug: str) -> str: + return f"{slug.lower()}.pinpointhq.com" + + +def slug_ok(slug: str) -> bool: + return label_slug_ok(slug) + + +def allowed(slug: str) -> Callable[[str], bool]: + return only(host(slug)) + + +def careers_url(slug: str) -> str: + return f"https://{host(slug)}/" + + +def robots_page(slug: str) -> str: + return careers_url(slug) + + +def feed_url(slug: str) -> str: + return f"https://{host(slug)}/postings.json" + + +def _plain(markup: Any) -> str: + """HTML as one line of plain text: the tags out, the entities read (Pinpoint + writes `&` and ` `), the whitespace, non-breaking included, collapsed.""" + return " ".join(html.unescape(strip_html(str(markup or ""))).split()) + + +def _text(j: dict[str, Any]) -> str: + """The description and the sections after it, each section under its own + heading, as plain text with a blank line between them.""" + parts = [_plain(j.get("description"))] + for field in _SECTIONS: + body = _plain(j.get(field)) + if body: + heading = str(j.get(f"{field}_header") or "").strip() + parts.append(f"{heading}: {body}" if heading else body) + return "\n\n".join(p for p in parts if p) + + +def _place(location: dict[str, Any]) -> str: + """The place's name, then its `province` where that says more. Pinpoint + fills `province` with a region or a country as the company typed it, so it + is kept only when it differs from the name.""" + parts: list[str] = [] + for part in (location.get("name") or location.get("city"), location.get("province")): + part = str(part or "").strip() + if part and part.lower() not in (p.lower() for p in parts): + parts.append(part) + return ", ".join(parts) + + +def _pay(j: dict[str, Any]) -> tuple[int | None, int | None, str, str]: + """`(salary_min, salary_max, currency, salary_text)` of a posting whose + pay is shown (`compensation_visible`); the free-text `compensation` is the + line when the bounds are not given.""" + if not j.get("compensation_visible"): + return None, None, "", "" + lo, hi = num(j.get("compensation_minimum")), num(j.get("compensation_maximum")) + frequency = str(j.get("compensation_frequency") or "").strip().lower() + period = _PERIOD.get(frequency, frequency) + text = pay_line(lo, hi, j.get("compensation_currency"), period) + text = text or str(j.get("compensation") or "").strip() + low, high, code = yearly_amount(lo, hi, j.get("compensation_currency"), frequency, _YEARLY) + return low, high, code, text + + +def parse(body: bytes, slug: str) -> list[Row]: + """`{slug}.pinpointhq.com/postings.json` -> `{"data": [...]}`. A posting has + `id`, `title`, `url`, `location` (`name`, `city`, `province`), + `workplace_type`, `job` (`requisition_id`, `department`, `division`), the + HTML `description` and its sections, and the `compensation_*` fields.""" + data = json.loads(body) + if not isinstance(data, dict) or not isinstance(data.get("data"), list): + raise ValueError("not a Pinpoint listing: no data list") + out = [] + for j in data["data"]: + title = (j.get("title") or "").strip() + url = (j.get("url") or "").strip() + source_id = str(j.get("id") or "") + if not title or not source_id or not is_web_url(url): + continue + job = j.get("job") or {} + low, high, currency, salary_text = _pay(j) + out.append({ + "source_id": source_id, + "title": title, + "location": _place(j.get("location") or {}), + "url": url, + "posted": None, # only the posting's own page has a date + "department": str((job.get("department") or {}).get("name") or "").strip(), + "description": _text(j), + "remote": _REMOTE.get(str(j.get("workplace_type") or "").strip().lower()), + "salary_text": salary_text, + "salary_min": low, + "salary_max": high, + "currency": currency, + }) + return out diff --git a/tests/fixtures/ats/pinpoint.json b/tests/fixtures/ats/pinpoint.json new file mode 100644 index 0000000..6cffdcb --- /dev/null +++ b/tests/fixtures/ats/pinpoint.json @@ -0,0 +1 @@ +{"data":[{"id":"581878","benefits":"\u003cul\u003e\u003cli\u003e\u003c!--block--\u003eWe will help you \u003cstrong\u003egrow your career:\u003c/strong\u003e We help you identify areas of growth for you, whether you want to grow as a specialist in your field or eventually want to go into a leadership/management role.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eWe have a \u003cstrong\u003etransparent and open work environment\u003c/strong\u003e where everyone is empowered to make an impact and encouraged to voice their ideas.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eKeeping true to our value, “\u003cstrong\u003eXeneta is one”\u003c/strong\u003e, we regularly bring colleagues together across locations. We organize an annual global company trip, and we aim to create opportunities for people to meet in person from time to time.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eYou will receive an\u003cstrong\u003e individual education budget \u003c/strong\u003eand can educate yourself during work hours: you can spend several hours each month attending courses, reading books, or getting involved in communities.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eYou will enjoy our\u003cstrong\u003e generous vacation plan\u003c/strong\u003e: 26 paid days of vacation per year.\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eWe value \u003cstrong\u003ework-life balance \u003c/strong\u003eand want to make sure you can spend quality time with your family or enjoy your hobbies when your workday is over.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eWe have \u003cstrong\u003eflexible working hours\u003c/strong\u003e (core time with meetings is 11:00 to 16:00 EET, the rest is up to you).\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eFull-time position, employed through GI Group, our staffing partner in Romania.\u003c/li\u003e\u003c/ul\u003e\u003cdiv\u003e\u003c!--block--\u003e\u003cbr\u003eWhy you will love it here\u003c/div\u003e\u003cul\u003e\u003cli\u003e\u003c!--block--\u003e\u003cstrong\u003eOur Impact\u003c/strong\u003e: We’re category leaders digitalizing the way ocean and air freight is procured bringing on-demand actionable data to all industry stakeholders. We’re moving fast.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003e\u003cstrong\u003eOur Technology\u003c/strong\u003e: Deep data analytics and integrations coupled with a scalable, sleek and beautiful user interface.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003e\u003cstrong\u003eOur Team\u003c/strong\u003e: Shipping, consulting and tech all-stars on our roster.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003e\u003cstrong\u003eOur Values\u003c/strong\u003e: Xeneta is One. Transparency builds trust. Ownership drives Impact. Modernization through data. Diversity is our Superpower.\u003c/li\u003e\u003c/ul\u003e\u003cdiv\u003e\u003c!--block--\u003eMake sure to highlight your past achievements that you think are relevant. Be sure to give us an idea of who you are as a real live person and not just your professional experience. \u0026nbsp;\u003cbr\u003e\u003cbr\u003e\u003c/div\u003e\u003cdiv\u003e\u003c!--block--\u003eXeneta is an equal opportunity employer. We celebrate diversity and are committed to creating an inclusive environment for all employees. \u0026nbsp;\u003cbr\u003e\u003cbr\u003e\u003c/div\u003e\u003cdiv\u003e\u003c!--block--\u003eLooking forward to hearing from you!\u0026nbsp;\u003c/div\u003e","benefits_header":"Job Benefits","compensation":null,"compensation_minimum":null,"compensation_maximum":null,"compensation_currency":null,"compensation_frequency":null,"compensation_visible":false,"deadline_at":null,"description":"\u003cdiv\u003e\u003c!--block--\u003e\u003cstrong\u003eData Detective Wanted to join our Data \u0026amp; Analytics Team\u003c/strong\u003e \u003cbr\u003e\u003cbr\u003e\u003cem\u003eLocation: Bucharest, Romania\u003c/em\u003e\u003cbr\u003e\u003cbr\u003eAs a \u003cstrong\u003eData Operations Analyst \u003c/strong\u003eat Xeneta, you’ll learn how to master complex data analytics within the world of supply chain and logistics. Xeneta is one of the world's leading data platforms providing market intelligence to the ocean and air freight industry. We have a big team of skilled Data Analysts that will help you learn the ropes from the ground up, while enabling you to collect and analyze data in one of the world’s greatest container shipping datasets. \u0026nbsp;\u003c/div\u003e\u003cdiv\u003e\u003c!--block--\u003e\u003cbr\u003eBring your analytical mindset and a genuine curiosity for how global shipping works and join our team!\u0026nbsp;\u003c/div\u003e","employment_type":"permanent_full_time","employment_type_text":"Permanent - Full Time","key_responsibilities":"\u003cdiv\u003e\u003c!--block--\u003eJoin our Liner Data \u0026amp; Analytics Team (LDAT) and own a portfolio of container shipping services for the world's largest ocean carriers. Liner shipping data is messy, inconsistent, and constantly changing. You'll turn that chaos into the accurate database our customers rely on to make shipping decisions, working at the center of a fast-moving industry with direct ownership over the data that shapes how the world sees ocean freight.\u0026nbsp;\u003cbr\u003e\u003cbr\u003eYour key tasks will be:\u003c/div\u003e\u003cul\u003e\u003cli\u003e\u003c!--block--\u003eReview and validate liner service data on a recurring cycle.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eMonitor vessel movements, deployment changes, blank sailings, and schedule updates for your portfolio, and update our platform to reflect the current state. \u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eInvestigate and resolve data quality exceptions: missing vessel assignments, stale voyage legs, unmatched data points and carrier discrepancies.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eQuery our database to dig into data issues and support your own analysis. \u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eWork closely with Customer Success and Sales teams in answering customers´ data requests throughout their procurement life cycle journey.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eMaintain forecast accuracy for your portfolio. \u0026nbsp;\u003c/li\u003e\u003c/ul\u003e","key_responsibilities_header":"Key Responsibilities","reporting_to":"John Kingori","skills_knowledge_expertise":"\u003cdiv\u003e\u003c!--block--\u003eIn this role, we are looking for someone with the following background and skills:\u0026nbsp;\u003c/div\u003e\u003cul\u003e\u003cli\u003e\u003c!--block--\u003eBachelor's degree in Business Administration, Economics, Mathematics, Engineering, Logistics, and related fields.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eFluent in English, oral and written.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eHigh attention to detail; you catch discrepancies across large datasets.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eAnalytical and problem-solving mindset.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eComfortable working async across time zones in a distributed team.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eOutstanding team player, also fully capable of working independently.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eYou're curious by nature and learn new tools and systems quickly, always asking why the data looks the way it does, not just what it shows.\u0026nbsp;\u003c/li\u003e\u003c/ul\u003e\u003cdiv\u003e\u003c!--block--\u003e\u003cstrong\u003eBonus points for\u003c/strong\u003e\u0026nbsp;\u003c/div\u003e\u003cul\u003e\u003cli\u003e\u003c!--block--\u003eExperience as a Data Analyst\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eFamiliarity with container shipping, vessel schedules, or liner service structures.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eProficiency with AI tools to speed up data analysis, scripting, or documentation.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eWorking knowledge of SQL; comfortable writing and troubleshooting queries against a relational database.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eComfortable building and maintaining dashboards in Power BI.\u0026nbsp;\u003c/li\u003e\u003c/ul\u003e\u003cdiv\u003e\u003c!--block--\u003e\u003cem\u003ePlease note that English is our working language, so we ask that your application and CV are submitted in English.\u003c/em\u003e\u003c/div\u003e","skills_knowledge_expertise_header":"Skills, Knowledge \u0026 Expertise","title":"Data Operations Analyst - LSP","url":"https://xeneta.pinpointhq.com/en/postings/a85d5d45-b334-4f5c-aaea-d0b399b08a2e","path":"/en/postings/a85d5d45-b334-4f5c-aaea-d0b399b08a2e","workplace_type":"hybrid","workplace_type_text":"Hybrid","job":{"id":"582848","requisition_id":"REQ-0328","department":{"id":"51942","name":"RMT - LSP"},"division":null,"structure_custom_group_one":null},"location":{"id":"71041","city":"Bucharest","name":"Bucharest","postal_code":"","province":"Bucharest","street_address":""}},{"id":"587635","benefits":"\u003cul\u003e\u003cli\u003e\u003c!--block--\u003eWe have a \u003cstrong\u003etransparent and open work environment\u003c/strong\u003e where everyone is empowered to make an impact and encouraged to voice their ideas.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eKeeping true to our value, “\u003cstrong\u003eXeneta is one”\u003c/strong\u003e, we regularly bring colleagues together across locations. We organize an annual global company trip, and we aim to create opportunities for people to meet in person.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eYou will enjoy our\u003cstrong\u003e generous vacation plan\u003c/strong\u003e: 26 paid days of vacation per year.\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eWe value \u003cstrong\u003ework-life balance \u003c/strong\u003eand want to make sure you can spend quality time with your family or enjoy your hobbies when your workday is over.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eWe have \u003cstrong\u003eflexible working hours\u003c/strong\u003e (core time with meetings is 11:00 to 16:00 EET, the rest is up to you).\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eNote that the positions is employed through \u003cstrong\u003eGI Group,\u003c/strong\u003e our staffing partner in Romania.\u003c/li\u003e\u003c/ul\u003e\u003cdiv\u003e\u003c!--block--\u003eWhy you will love it here\u003c/div\u003e\u003cul\u003e\u003cli\u003e\u003c!--block--\u003e\u003cstrong\u003eOur Impact\u003c/strong\u003e: We’re category leaders digitalizing the way ocean and air freight is procured bringing on-demand actionable data to all industry stakeholders. We’re moving fast.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003e\u003cstrong\u003eOur Technology\u003c/strong\u003e: Deep data analytics and integrations coupled with a scalable, sleek and beautiful user interface.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003e\u003cstrong\u003eOur Team\u003c/strong\u003e: Shipping, consulting and tech all-stars on our roster.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003e\u003cstrong\u003eOur Values\u003c/strong\u003e: Xeneta is One. Transparency builds trust. Ownership drives Impact. Modernization through data. Diversity is our Superpower.\u003c/li\u003e\u003c/ul\u003e\u003cdiv\u003e\u003c!--block--\u003eMake sure to highlight your past achievements that you think are relevant. Be sure to give us an idea of who you are as a real live person and not just your professional experience. \u0026nbsp;\u003cbr\u003e\u003cbr\u003e\u003c/div\u003e\u003cdiv\u003e\u003c!--block--\u003eXeneta is an equal opportunity employer. We celebrate diversity and are committed to creating an inclusive environment for all employees. Looking forward to hearing from you!\u0026nbsp;\u003c/div\u003e","benefits_header":"Benefits","compensation":null,"compensation_minimum":null,"compensation_maximum":null,"compensation_currency":null,"compensation_frequency":null,"compensation_visible":false,"deadline_at":"2026-10-09T23:59:59+02:00","description":"\u003cdiv\u003e\u003c!--block--\u003eWe are looking for a \u003cstrong\u003ePeople \u0026amp; Culture Assistant \u003c/strong\u003eto join our People Experience Team. This is a temporary, 12-month contract for a full-time role, as one of our team members is on leave.\u0026nbsp;\u003c/div\u003e\u003cdiv\u003e\u003c!--block--\u003e\u0026nbsp;\u003cbr\u003eCustomer centricity is a core principle in Xeneta. For the People \u0026amp; Culture team, our colleagues are our customers. As People and Culture Assistant, you will ensure our Executive Leadership's days run as smoothly and efficiently as possible. You will be their business partner who enables them to focus on their core responsibilities and helps them meet their business goals and objectives. You will work with our C-suite and thus get exposure to all the different areas of our business.\u0026nbsp; \u003cbr\u003e\u0026nbsp;\u003cbr\u003eWe're seeking a diligent and self-motivated person to join our People \u0026amp; Culture team. This is an exciting opportunity to work with various tasks and responsibilities in an international tech company!\u0026nbsp; \u003cbr\u003e\u003cbr\u003e\u003cem\u003eWe would prefer someone who can start quickly and we will call candidates in for interviews on a continuous basis, so please apply as soon as possible.\u0026nbsp;\u003c/em\u003e\u003c/div\u003e","employment_type":"fixed_term_full_time","employment_type_text":"Fixed Term - Full Time","key_responsibilities":"\u003cdiv\u003e\u003c!--block--\u003eYour main responsibility will be to support the CEO, CPO, and CRO. As such, your key tasks will be: \u0026nbsp;\u003c/div\u003e\u003cul\u003e\u003cli\u003e\u003c!--block--\u003eOwn calendar management: organizing inboxes, scheduling meetings, resolving scheduling conflicts, prioritizing calendar events, communicating urgent requests and changes to relevant stakeholders.\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eManage Xeneta Board meeting logistics, including liaising with Board members, setting Board calendar, ensuring timely delivery of Board materials, and scheduling Board dinners.\u0026nbsp; \u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eArrange and coordinate travel plans, itineraries, and agendas.\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eSupport with various administrative and ad hoc tasks, such as processing expense reimbursements.\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eSchedule and coordinate various events for C-Suite and Extended Leadership Team members, such as offsite meetings, departmental events, team-building events, etc.\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eSupport the People Experience Team on other global events and initiatives, such as supporting the Senior People Experience Partner on ticketing systems and ad hoc office management.\u003c/li\u003e\u003c/ul\u003e","key_responsibilities_header":"Key Responsibilities","reporting_to":"","skills_knowledge_expertise":"\u003cdiv\u003e\u003c!--block--\u003eWe are looking for someone who has the following experience and skills: \u0026nbsp;\u003c/div\u003e\u003cul\u003e\u003cli\u003e\u003c!--block--\u003eIdeally 1-3 years of experience in a similar role, such as Scheduling Assistant, Personal Assistant, Coordinator, or Executive Assistant.\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eBusiness fluent in English, oral and written.\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eDemonstrated proficiency in Microsoft Suite (Outlook, Teams, Word, PowerPoint, Excel).\u0026nbsp;\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eExcellent communication, interpersonal, and organizational skills.\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eSelf-motivated; able to work independently and efficiently.\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eYou thrive in an international, fast-working environment and enjoy making people's lives easier. You remain calm and composed, even while handling tasks that demand detail-focus and accuracy.\u003c/li\u003e\u003cli\u003e\u003c!--block--\u003eAbility to quickly familiarize yourself with new topics. You like digging into new things and can deal with multiple issues simultaneously.\u0026nbsp;\u003c/li\u003e\u003c/ul\u003e","skills_knowledge_expertise_header":"Skills, Knowledge and Expertise","title":"People \u0026 Culture Assistant","url":"https://xeneta.pinpointhq.com/en/postings/ae6a3963-acf7-4ed0-8147-7138f7ebb21e","path":"/en/postings/ae6a3963-acf7-4ed0-8147-7138f7ebb21e","workplace_type":"hybrid","workplace_type_text":"Hybrid","job":{"id":"588176","requisition_id":"REQ-0331","department":{"id":"9357","name":"People \u0026 Culture"},"division":null,"structure_custom_group_one":null},"location":{"id":"71041","city":"Bucharest","name":"Bucharest","postal_code":"","province":"Bucharest","street_address":""}}]} \ No newline at end of file diff --git a/tests/test_ats_pinpoint.py b/tests/test_ats_pinpoint.py new file mode 100644 index 0000000..f1547d2 --- /dev/null +++ b/tests/test_ats_pinpoint.py @@ -0,0 +1,155 @@ +"""The Pinpoint host module against a saved listing (Xeneta's whole board, two roles). No network.""" + +from __future__ import annotations + +import json +import sys +from pathlib import Path + +import httpx +import pytest + +ROOT = Path(__file__).resolve().parents[1] +if str(ROOT) not in sys.path: + sys.path.insert(0, str(ROOT)) + +from app.jobs import discover # noqa: E402 +from plugins import ats, atshosts # noqa: E402 +from plugins.atshosts import pinpoint # noqa: E402 + +FIXTURES = ROOT / "tests" / "fixtures" / "ats" + + +def _body() -> bytes: + return (FIXTURES / "pinpoint.json").read_bytes() + + +def test_a_listing_becomes_rows() -> None: + rows = pinpoint.parse(_body(), "xeneta") + assert [r["source_id"] for r in rows] == ["581878", "587635"] + first = rows[0] + assert first["title"] == "Data Operations Analyst - LSP" + assert first["url"] == ("https://xeneta.pinpointhq.com/en/postings/" + "a85d5d45-b334-4f5c-aaea-d0b399b08a2e") + assert first["location"] == "Bucharest" # the province repeats the name + assert first["department"] == "RMT - LSP" + assert first["remote"] == "hybrid" + assert first["posted"] is None # the listing has no date + assert (first["salary_text"], first["salary_min"], first["salary_max"], + first["currency"]) == ("", None, None, "") + + +def test_the_description_joins_the_sections_as_plain_text() -> None: + text = pinpoint.parse(_body(), "xeneta")[0]["description"] + assert text.startswith("Data Detective Wanted to join our Data & Analytics Team") + assert "<" not in text and "&" not in text and "\xa0" not in text + assert "\n\nKey Responsibilities: Join our Liner Data & Analytics Team" in text + assert "\n\nSkills, Knowledge & Expertise: In this role" in text + assert "\n\nJob Benefits: We will help you grow your career:" in text + + +def test_a_region_is_kept_when_it_says_more_than_the_name() -> None: + body = json.loads(_body()) + body["data"][0]["location"] = {"name": "London", "city": "London", "province": "England"} + body["data"][1]["location"] = {"name": "", "city": "Oslo", "province": "Norway"} + rows = pinpoint.parse(json.dumps(body).encode(), "xeneta") + assert [r["location"] for r in rows] == ["London, England", "Oslo, Norway"] + + +@pytest.mark.parametrize(("kind", "remote"), [ + ("onsite", "onsite"), ("hybrid", "hybrid"), ("remote", "remote"), ("", None), (None, None)]) +def test_the_workplace_type_maps_to_the_remote_words(kind: str | None, remote: str | None) -> None: + body = json.loads(_body()) + body["data"][0]["workplace_type"] = kind + assert pinpoint.parse(json.dumps(body).encode(), "xeneta")[0]["remote"] == remote + + +def test_pay_is_read_only_when_the_board_shows_it() -> None: + body = json.loads(_body()) + pay = {"compensation_minimum": 60000, "compensation_maximum": 80000, + "compensation_currency": "EUR", "compensation_frequency": "annually"} + body["data"][0] |= pay | {"compensation_visible": True} + body["data"][1] |= pay # hidden: `compensation_visible` is false + first, second = pinpoint.parse(json.dumps(body).encode(), "xeneta") + assert (first["salary_min"], first["salary_max"], first["currency"]) == (60000, 80000, "EUR") + assert first["salary_text"] == "EUR 60,000 to 80,000 per year" + assert (second["salary_min"], second["salary_text"]) == (None, "") + + +def test_an_unknown_pay_frequency_keeps_the_text_and_leaves_the_columns() -> None: + body = json.loads(_body()) + body["data"][0] |= {"compensation_minimum": 40, "compensation_maximum": 50, + "compensation_currency": "GBP", "compensation_frequency": "hourly", + "compensation_visible": True} + row = pinpoint.parse(json.dumps(body).encode(), "xeneta")[0] + assert row["salary_text"] == "GBP 40 to 50 per hour" + assert (row["salary_min"], row["salary_max"], row["currency"]) == (None, None, "") + + +def test_a_posting_without_a_title_or_an_id_or_a_web_url_is_left_out() -> None: + body = json.loads(_body()) + body["data"][0]["title"] = "" + body["data"][1]["url"] = "javascript:alert(1)" + assert pinpoint.parse(json.dumps(body).encode(), "xeneta") == [] + + +def test_an_empty_board_is_no_rows_and_a_page_that_is_not_a_listing_raises() -> None: + assert pinpoint.parse(b'{"data": []}', "xeneta") == [] + for body in (b"", b"[]", b'{"error": "nope"}'): + with pytest.raises(ValueError): + pinpoint.parse(body, "xeneta") + + +def test_the_board_is_read_through_the_app_and_is_complete() -> None: + seen: list[str] = [] + + def handler(request: httpx.Request) -> httpx.Response: + seen.append(str(request.url)) + return httpx.Response(200, content=_body()) + + with httpx.Client(transport=httpx.MockTransport(handler)) as client: + rows, complete = ats._fetch_rows(client, "pinpoint:xeneta") + assert seen == ["https://xeneta.pinpointhq.com/postings.json"] + assert len(rows) == 2 and complete + + +def test_the_slug_the_urls_and_the_allow_list() -> None: + assert pinpoint.slug_ok("xeneta") and pinpoint.slug_ok("Xeneta") and pinpoint.slug_ok("a-b1") + assert pinpoint.careers_url("xeneta") == "https://xeneta.pinpointhq.com/" + assert pinpoint.robots_page("xeneta") == "https://xeneta.pinpointhq.com/" + assert pinpoint.feed_url("Xeneta") == "https://xeneta.pinpointhq.com/postings.json" + allow = pinpoint.allowed("Xeneta") + assert allow("xeneta.pinpointhq.com") and allow("XENETA.pinpointhq.com") + assert not allow("pinpointhq.com") and not allow("other.pinpointhq.com") + assert not allow("xeneta.pinpointhq.com.evil.example") and not allow("localhost") + assert atshosts.HOSTS["pinpoint"] is pinpoint and ats.HOSTS["pinpoint"] == "Pinpoint" + + +@pytest.mark.parametrize("slug", [ + "", "a@b", "a#b", "a?b", "..", "a/b", "a%2fb", "a:443", "a b", " a", "a\n", "a\r\n", + "a.b", "127.0.0.1", "[::1]", "a_b", "2130706433.evil"]) +def test_a_hostile_slug_is_refused(slug: str) -> None: + assert not pinpoint.slug_ok(slug) + assert not ats.is_known_target(f"pinpoint:{slug}") + + +@pytest.mark.parametrize("slug", ["localhost", "www"]) +def test_a_slug_that_is_a_local_word_still_only_reaches_pinpoints_own_host(slug: str) -> None: + """`localhost` is a fine DNS label, but the host it names is + `localhost.pinpointhq.com`, which is Pinpoint's.""" + assert pinpoint.allowed(slug)(f"{slug}.pinpointhq.com") + assert not pinpoint.allowed(slug)(slug) + + +def test_discovery_finds_the_subdomain() -> None: + page = ('Jobs' + '') + assert [(h, s) for h, s, _ in discover.boards_in(page)] == [("pinpoint", "xeneta")] + assert discover.boards_in("https://pinpointhq.com/") == [] + assert "pinpoint" not in {h for h, _ in discover._UNREADABLE if h not in atshosts.HOSTS} + + +def test_a_pinpoint_board_is_not_probed() -> None: + assert not hasattr(pinpoint, "probe_url") + + From 76187d586280be162c24711bb6c1315f2f51a04e Mon Sep 17 00:00:00 2001 From: Wolf Date: Tue, 29 Sep 2026 20:02:45 +0200 Subject: [PATCH 2/5] Read BambooHR boards from their careers list and role pages Co-Authored-By: Claude Sonnet 5.5 --- plugins/atshosts/bamboohr.py | 135 +++++++++++++++ tests/fixtures/ats/bamboohr-detail-26.json | 1 + tests/fixtures/ats/bamboohr-detail-37.json | 1 + tests/fixtures/ats/bamboohr.json | 1 + tests/test_ats_bamboohr.py | 185 +++++++++++++++++++++ 5 files changed, 323 insertions(+) create mode 100644 plugins/atshosts/bamboohr.py create mode 100644 tests/fixtures/ats/bamboohr-detail-26.json create mode 100644 tests/fixtures/ats/bamboohr-detail-37.json create mode 100644 tests/fixtures/ats/bamboohr.json create mode 100644 tests/test_ats_bamboohr.py diff --git a/plugins/atshosts/bamboohr.py b/plugins/atshosts/bamboohr.py new file mode 100644 index 0000000..0a558a2 --- /dev/null +++ b/plugins/atshosts/bamboohr.py @@ -0,0 +1,135 @@ +"""BambooHR: `bamboohr:` for acme.bamboohr.com, the whole board in +one JSON answer and each role's text, date and country on its own page. + +Written from Configit's board on 2026-09-29 (two roles); jobhunt-hq did not +read BambooHR. Unverified: whether a large board pages `/careers/list` (this +one states `meta.totalCount` and no paging keys, so a list shorter than its +count is refused rather than read as the whole board), and the words of +`locationType`, taken to be BambooHR's own settings, "0" in the office, "1" +remote and "2" hybrid; Configit's hybrid roles say "2" and `isRemote` is null. + +A posting that invites an unsolicited application without a role (Configit's +first) is listed like any other role. +""" + +from __future__ import annotations + +import html +import json +from collections.abc import Callable +from typing import Any + +from desk.sources import strip_html + +from ._shared import Get, Row, label_slug_ok, only, parse_dt + +NAME = "bamboohr" +LABEL = "BambooHR" +PATTERNS = ( + # Not the company's own app or documentation subdomains, which BambooHR + # itself serves and which name no board. + r"https?://(?!(?:app|resources|documentation|help)\.)([a-z0-9-]+)\.bamboohr\.com", +) + +#: `locationType` -> `store._remote`'s words. Anything else says nothing. +_REMOTE = {"0": "onsite", "1": "remote", "2": "hybrid"} + +#: Sent on the detail read: without it the same URL answers the page's HTML. +_JSON = {"Accept": "application/json"} + + +def host(slug: str) -> str: + return f"{slug.lower()}.bamboohr.com" + + +def slug_ok(slug: str) -> bool: + return label_slug_ok(slug) + + +def allowed(slug: str) -> Callable[[str], bool]: + return only(host(slug)) + + +def careers_url(slug: str) -> str: + return f"https://{host(slug)}/careers" + + +def robots_page(slug: str) -> str: + return careers_url(slug) + + +def feed_url(slug: str) -> str: + return f"https://{host(slug)}/careers/list" + + +def _remote(j: dict[str, Any]) -> str | None: + if j.get("isRemote") is True: + return "remote" + return _REMOTE.get(str(j.get("locationType") if j.get("locationType") is not None else "")) + + +def _place(j: dict[str, Any]) -> str: + """City, state and country of a role, as far as either of its two + location objects states them (`atsLocation` mirrors `location` and is + filled by companies that use BambooHR's own applicant tracking).""" + place, ats_place = j.get("location") or {}, j.get("atsLocation") or {} + country = place.get("addressCountry") or ats_place.get("country") + parts = (place.get("city") or ats_place.get("city"), + place.get("state") or ats_place.get("state"), country) + return ", ".join(str(p).strip() for p in parts if p and str(p).strip()) + + +def parse(body: bytes, slug: str) -> list[Row]: + """`/careers/list` -> `{"meta": {"totalCount": n}, "result": [...]}`. A + role has `id`, `jobOpeningName`, `departmentLabel`, `location` (`city`, + `state`), `atsLocation` (the same with a `country`, null so far), + `isRemote` and `locationType`. The text, the date and the country are only + on the role's own page (`detail`), which is why `description` and `posted` + are empty here.""" + data = json.loads(body) + listed = data.get("result") if isinstance(data, dict) else None + if not isinstance(listed, list): + raise ValueError("not a BambooHR listing: no result list") + stated = (data.get("meta") or {}).get("totalCount") + if isinstance(stated, int) and stated > len(listed): + raise ValueError(f"BambooHR listing has {len(listed)} of {stated} roles") + out = [] + for j in listed: + title = (j.get("jobOpeningName") or "").strip() + source_id = str(j.get("id") or "") + if not title or not source_id: + continue + out.append({ + "source_id": source_id, + "title": title, + "location": _place(j), + "url": f"https://{host(slug)}/careers/{source_id}", + "posted": None, + "department": str(j.get("departmentLabel") or "").strip(), + "description": "", + "remote": _remote(j), + "salary_text": "", # the list states no pay; the detail's `compensation` was null + }) + return out + + +def detail(get: Get, slug: str, row: Row) -> dict[str, Any]: + """`/careers//detail` -> `{"result": {"jobOpening": {...}}}`, with the + HTML `description`, `datePosted` (a date), `location` (`city`, `state`, + `addressCountry`) and `locationType`. The location is the listing's with + the country added, since the listing has none.""" + data = json.loads(get(f"https://{host(slug)}/careers/{row['source_id']}/detail", + headers=_JSON)) + opening = ((data.get("result") or {}).get("jobOpening") + if isinstance(data, dict) else None) + if not isinstance(opening, dict): + raise ValueError("not a BambooHR role: no result.jobOpening") + out: dict[str, Any] = { + "description": " ".join(html.unescape(strip_html(opening.get("description") or "")).split()), + "posted": parse_dt(opening.get("datePosted")), + } + if place := _place(opening): + out["location"] = place + if remote := _remote(opening): + out["remote"] = remote + return out diff --git a/tests/fixtures/ats/bamboohr-detail-26.json b/tests/fixtures/ats/bamboohr-detail-26.json new file mode 100644 index 0000000..523e39b --- /dev/null +++ b/tests/fixtures/ats/bamboohr-detail-26.json @@ -0,0 +1 @@ +{"meta":{},"result":{"jobOpening":{"jobOpeningShareUrl":"https:\/\/configit.bamboohr.com\/careers\/26","jobOpeningName":"Unsolicited application - All Configit locations","jobOpeningStatus":"Open","jobCategoryId":null,"departmentId":null,"departmentLabel":"","employmentStatusLabel":"Full-Time","employmentType":null,"location":{"city":"K\u00f8benhavn \u00d8","state":null,"postalCode":"2100","addressCountry":"Denmark"},"atsLocation":{"country":null,"countryId":null,"state":null,"city":null},"description":"

Hi,<\/p>\n


<\/p>\n

If there is currently no vacant position that matches your skills, you are welcome to send us an unsolicited application.<\/p>\n


<\/p>\n

We are curious to hear about you and why you'd like to join us.<\/p>\n


<\/p>\n

Please also let us know in which of our locations you'd like to work:<\/p>\n


<\/p>\n

    \n
  • Copenhagen (Denmark)<\/li>\n
  • Langenfeld (Germany, D\u00fcsseldorf\/Cologne area)<\/li>\n
  • UK (remote)<\/li>\n
  • US (Atlanta)<\/li>\n<\/ul>\n


    <\/p>\n

      <\/ul>\n

      Our Global HR Team and our managers are looking forward to reviewing your application.<\/p>","compensation":null,"datePosted":"2025-10-10","minimumExperience":null,"locationType":"2","seekPromoted":false,"aiProcessingDisclosureEnabled":false},"formFields":{"firstName":{"isRequired":true,"value":"","label":"First Name"},"lastName":{"isRequired":true,"value":"","label":"Last Name"},"email":{"isRequired":true,"value":"","label":"Email"},"phone":{"isRequired":true,"value":"","label":"Phone"},"streetAddress":{"isRequired":true,"value":"","label":"Address"},"city":{"isRequired":true,"value":"","label":"City"},"state":{"isRequired":true,"value":"","label":"State","options":[]},"zip":{"isRequired":true,"value":"","label":"ZIP"},"countryId":{"isRequired":true,"value":"57","label":"Country","options":[{"id":"1","text":"United States"},{"id":"2","text":"Canada"},{"id":"3","text":"Australia"},{"id":"4","text":"Afghanistan"},{"id":"5","text":"Albania"},{"id":"6","text":"Algeria"},{"id":"7","text":"American Samoa"},{"id":"8","text":"Andorra"},{"id":"9","text":"Anguilla"},{"id":"10","text":"Angola"},{"id":"11","text":"Antarctica"},{"id":"12","text":"Antigua and Barbuda"},{"id":"13","text":"Argentina"},{"id":"14","text":"Armenia"},{"id":"15","text":"Aruba"},{"id":"16","text":"Austria"},{"id":"17","text":"Azerbaijan"},{"id":"18","text":"Bahamas"},{"id":"19","text":"Bahrain"},{"id":"20","text":"Bangladesh"},{"id":"21","text":"Barbados"},{"id":"22","text":"Belgium"},{"id":"23","text":"Belize"},{"id":"24","text":"Benin"},{"id":"25","text":"Bermuda"},{"id":"26","text":"Bhutan"},{"id":"27","text":"Bolivia"},{"id":"28","text":"Bosnia and Herzegovina"},{"id":"29","text":"Botswana"},{"id":"30","text":"Bouvet Island"},{"id":"31","text":"Brazil"},{"id":"32","text":"British Indian Ocean Territory"},{"id":"33","text":"Brunei Darussalam"},{"id":"34","text":"Bulgaria"},{"id":"35","text":"Burkina Faso"},{"id":"36","text":"Burundi"},{"id":"37","text":"Cambodia"},{"id":"38","text":"Cameroon"},{"id":"39","text":"Cape Verde"},{"id":"40","text":"Cayman Islands"},{"id":"41","text":"Central African Republic"},{"id":"42","text":"Chad"},{"id":"43","text":"Chile"},{"id":"44","text":"China"},{"id":"45","text":"Christmas Island"},{"id":"46","text":"Cocos (Keeling Islands)"},{"id":"47","text":"Colombia"},{"id":"48","text":"Comoros"},{"id":"49","text":"Congo"},{"id":"50","text":"Cook Islands"},{"id":"51","text":"Costa Rica"},{"id":"52","text":"Cote D'Ivoire (Ivory Coast)"},{"id":"53","text":"Croatia (Hrvatska)"},{"id":"54","text":"Cuba"},{"id":"55","text":"Cyprus"},{"id":"56","text":"Czech Republic"},{"id":"57","text":"Denmark"},{"id":"58","text":"Djibouti"},{"id":"59","text":"Dominica"},{"id":"60","text":"Dominican Republic"},{"id":"61","text":"East Timor"},{"id":"62","text":"Egypt"},{"id":"63","text":"El Salvador"},{"id":"64","text":"Ecuador"},{"id":"65","text":"Equatorial Guinea"},{"id":"66","text":"Eritrea"},{"id":"67","text":"Estonia"},{"id":"68","text":"Ethiopia"},{"id":"69","text":"Falkland Islands (Malvinas)"},{"id":"70","text":"Faroe Islands"},{"id":"71","text":"Fiji"},{"id":"72","text":"Finland"},{"id":"73","text":"France"},{"id":"74","text":"France, Metropolitan"},{"id":"75","text":"French Guiana"},{"id":"76","text":"French Polynesia"},{"id":"77","text":"French Southern Territories"},{"id":"78","text":"French West Indies"},{"id":"79","text":"Gabon"},{"id":"80","text":"Gambia"},{"id":"81","text":"Georgia"},{"id":"82","text":"Germany"},{"id":"83","text":"Ghana"},{"id":"84","text":"Gibraltar"},{"id":"85","text":"Greece"},{"id":"86","text":"Greenland"},{"id":"87","text":"Grenada"},{"id":"88","text":"Guadeloupe"},{"id":"89","text":"Guam"},{"id":"90","text":"Guatemala"},{"id":"91","text":"Guinea"},{"id":"92","text":"Guinea-Bissau"},{"id":"93","text":"Guyana"},{"id":"94","text":"Haiti"},{"id":"95","text":"Heard and McDonald Islands"},{"id":"96","text":"Honduras"},{"id":"97","text":"Hong Kong"},{"id":"98","text":"Hungary"},{"id":"99","text":"Iceland"},{"id":"100","text":"India"},{"id":"101","text":"Indonesia"},{"id":"102","text":"Iran"},{"id":"103","text":"Iraq"},{"id":"104","text":"Ireland"},{"id":"105","text":"Israel"},{"id":"106","text":"Italy"},{"id":"107","text":"Jamaica"},{"id":"108","text":"Japan"},{"id":"109","text":"Jordan"},{"id":"110","text":"Kazakhstan"},{"id":"111","text":"Kenya"},{"id":"112","text":"Kiribati"},{"id":"113","text":"Korea (North)"},{"id":"114","text":"Korea (South)"},{"id":"115","text":"Kuwait"},{"id":"116","text":"Kyrgyzstan"},{"id":"117","text":"Laos"},{"id":"118","text":"Latvia"},{"id":"119","text":"Lebanon"},{"id":"120","text":"Lesotho"},{"id":"121","text":"Liberia"},{"id":"122","text":"Libya"},{"id":"123","text":"Liechtenstein"},{"id":"124","text":"Lithuania"},{"id":"125","text":"Luxembourg"},{"id":"126","text":"Macao"},{"id":"127","text":"Macedonia"},{"id":"128","text":"Madagascar"},{"id":"129","text":"Malawi"},{"id":"130","text":"Malaysia"},{"id":"131","text":"Maldives"},{"id":"132","text":"Mali"},{"id":"133","text":"Malta"},{"id":"134","text":"Marshall Islands"},{"id":"135","text":"Martinique"},{"id":"136","text":"Mauritania"},{"id":"137","text":"Mauritius"},{"id":"138","text":"Mayotte"},{"id":"139","text":"Mexico"},{"id":"140","text":"Micronesia"},{"id":"141","text":"Moldova"},{"id":"142","text":"Monaco"},{"id":"143","text":"Mongolia"},{"id":"144","text":"Montenegro"},{"id":"145","text":"Montserrat"},{"id":"146","text":"Morocco"},{"id":"147","text":"Mozambique"},{"id":"148","text":"Namibia"},{"id":"149","text":"Nauru"},{"id":"150","text":"Nepal"},{"id":"151","text":"Netherlands"},{"id":"152","text":"Netherlands Antilles"},{"id":"153","text":"New Caledonia"},{"id":"154","text":"New Zealand"},{"id":"155","text":"Nicaragua"},{"id":"156","text":"Niger"},{"id":"157","text":"Nigeria"},{"id":"158","text":"Niue"},{"id":"159","text":"Norfolk Island"},{"id":"160","text":"Northern Mariana Islands"},{"id":"161","text":"Norway"},{"id":"162","text":"Oman"},{"id":"163","text":"Pakistan"},{"id":"164","text":"Palau"},{"id":"165","text":"Panama"},{"id":"166","text":"Papua New Guinea"},{"id":"167","text":"Paraguay"},{"id":"168","text":"Peru"},{"id":"169","text":"Philippines"},{"id":"170","text":"Pitcairn"},{"id":"171","text":"Poland"},{"id":"172","text":"Portugal"},{"id":"173","text":"Puerto Rico"},{"id":"174","text":"Qatar"},{"id":"175","text":"Rwanda"},{"id":"176","text":"Reunion"},{"id":"177","text":"Romania"},{"id":"178","text":"Russian Federation"},{"id":"179","text":"Samoa"},{"id":"180","text":"San Marino"},{"id":"181","text":"Sao Tome and Principe"},{"id":"182","text":"Saudi Arabia"},{"id":"183","text":"Senegal"},{"id":"184","text":"Serbia"},{"id":"185","text":"Seychelles"},{"id":"186","text":"Sierra Leone"},{"id":"187","text":"Singapore"},{"id":"188","text":"Slovakia"},{"id":"189","text":"Slovenia"},{"id":"190","text":"Solomon Islands"},{"id":"191","text":"South Africa"},{"id":"192","text":"Spain"},{"id":"193","text":"Sri Lanka"},{"id":"194","text":"St. Helena"},{"id":"195","text":"Saint Kitts and Nevis"},{"id":"196","text":"Saint Lucia"},{"id":"197","text":"St. Pierre and Miquelon"},{"id":"198","text":"Saint Vincent and the Grenadines"},{"id":"199","text":"Sudan"},{"id":"200","text":"Suriname"},{"id":"201","text":"Svalbard"},{"id":"202","text":"Swaziland"},{"id":"203","text":"Sweden"},{"id":"204","text":"Switzerland"},{"id":"205","text":"Syria"},{"id":"206","text":"Taiwan"},{"id":"207","text":"Tajikistan"},{"id":"208","text":"Tanzania"},{"id":"209","text":"Thailand"},{"id":"210","text":"Togo"},{"id":"211","text":"Tokelau"},{"id":"212","text":"Tonga"},{"id":"213","text":"Trinidad and Tobago"},{"id":"214","text":"Tunisia"},{"id":"215","text":"Turkey"},{"id":"216","text":"Turkmenistan"},{"id":"217","text":"Turks and Caicos Islands"},{"id":"218","text":"Tuvalu"},{"id":"219","text":"Uganda"},{"id":"220","text":"Ukraine"},{"id":"221","text":"United Arab Emirates"},{"id":"222","text":"United Kingdom"},{"id":"223","text":"US Minor Outlying Islands"},{"id":"224","text":"Uruguay"},{"id":"225","text":"Uzbekistan"},{"id":"226","text":"Vanuatu"},{"id":"227","text":"Vatican City State"},{"id":"228","text":"Venezuela"},{"id":"229","text":"Viet Nam"},{"id":"230","text":"Virgin Islands (British)"},{"id":"231","text":"Virgin Islands, U.S."},{"id":"232","text":"Wallis and Futuna Islands"},{"id":"233","text":"Western Sahara"},{"id":"234","text":"Yemen"},{"id":"235","text":"Yugoslavia"},{"id":"236","text":"Zaire"},{"id":"237","text":"Zambia"},{"id":"238","text":"\u00c5land Islands"},{"id":"239","text":"Saint Barth\u00e9lemy"},{"id":"240","text":"Bonaire, Sint Eustatius and Saba"},{"id":"241","text":"Belarus"},{"id":"242","text":"Congo, the Democratic Republic of the"},{"id":"243","text":"Cura\u00e7ao"},{"id":"244","text":"Guernsey"},{"id":"245","text":"South Georgia and the South Sandwich Islands"},{"id":"246","text":"Isle of Man"},{"id":"247","text":"Jersey"},{"id":"248","text":"Myanmar"},{"id":"249","text":"Palestinian Territories"},{"id":"250","text":"Somalia"},{"id":"251","text":"South Sudan"},{"id":"252","text":"Sint Maarten (Dutch part)"},{"id":"253","text":"Zimbabwe"},{"id":"254","text":"Kosovo"},{"id":"255","text":"Kurdistan"},{"id":"256","text":"Saint Martin (French part)"}]},"linkedinUrl":{"isRequired":false,"value":"","label":"LinkedIn URL"},"resumeFileId":{"isRequired":true,"value":"","label":"Resume"},"coverLetterFileId":{"isRequired":true,"value":"","label":"Cover Letter"},"customQuestions":[{"id":"61","isRequired":true,"question":"By submitting my application, I agree that: \u2022\tConfigit A\/S (Data Controller) may process my personal data for recruitment purposes, as described in the Privacy Policy (go.configit.com\/privacy-policy-bamboohr). \u2022\tMy data will be stored securely in the Applicant Tracking System (ATS) provided by BambooHR (Data Processor). \u2022\tMy data will be retained for 6 months after the recruitment process, unless I consent to longer storage in a talent pool.","type":"checkbox","value":"","isValueOther":false,"hasOther":"no","options":[]}],"genderId":[],"ethnicityId":[],"veteranStatusId":[],"disabilityId":[]}}} \ No newline at end of file diff --git a/tests/fixtures/ats/bamboohr-detail-37.json b/tests/fixtures/ats/bamboohr-detail-37.json new file mode 100644 index 0000000..b0969dc --- /dev/null +++ b/tests/fixtures/ats/bamboohr-detail-37.json @@ -0,0 +1 @@ +{"meta":{},"result":{"jobOpening":{"jobOpeningShareUrl":"https:\/\/configit.bamboohr.com\/careers\/37","jobOpeningName":"Demand Generation Specialist - 12-Month Maternity Cover","jobOpeningStatus":"Open","jobCategoryId":null,"departmentId":"18571","departmentLabel":"Marketing","employmentStatusLabel":"Full-Time","employmentType":null,"location":{"city":"K\u00f8benhavn \u00d8","state":null,"postalCode":"2100","addressCountry":"Denmark"},"atsLocation":{"country":null,"countryId":null,"state":null,"city":null},"description":"

      Our Global Marketing Team is looking for a driven, creative, and passionate individual to join us for a 12-month fixed-term maternity cover. You\u2019ll help drive pipeline growth through impactful inbound and outbound campaigns that build awareness, generate demand, and deliver high-quality leads. If you\u2019re a hands-on marketer who enjoys turning strategy into results, we\u2019d love to hear from you<\/span>!<\/span><\/em><\/p>\n


      <\/p>\n

      Configit is an ambitious and growing SaaS company working in the domain of complex product and sales configuration. We help large international corporations optimize their processes and drive cross-functional innovation through our Configuration Lifecycle Management approach. \u00a0<\/span>
      <\/p>\n


      <\/p>\n

      Within our dedicated Marketing Team, you will focus on refining existing marketing channels and developing new integrated digital campaigns with effective messaging to generate a qualified pipeline, to accelerate deals, and to grow our revenue.<\/span><\/p>\n

      \u00a0<\/span><\/p>\n

      Your Responsibilities<\/span><\/span><\/p>\n

        \n
      • Create new and optimize existing inbound and outbound demand and lead generation programs across email and web.<\/span><\/li>\n
      • Develop, plan, and execute campaigns for paid search, retargeting, paid social channels, and email marketing.<\/span><\/li>\n
      • Execute and optimize ABM and ABS campaigns.<\/span><\/li>\n
      • Experiment with generative AI and other emerging marketing technologies to identify opportunities to improve marketing effectiveness and efficiency.<\/span><\/li>\n
      • Identify most effective marketing messages, value propositions, material, channels, and calls to action for target accounts.<\/span><\/li>\n
      • Measure, analyze, and report on the impact of marketing campaigns.<\/span><\/li>\n
      • Manage projects like the creation of campaign landing pages, creatives, and other digital marketing assets.<\/span><\/li>\n
      • Use intelligence from our intent data sources like 6sense and Dreamdata.<\/span><\/li>\n
      • Closely collaborate with core Sales, Marketing, Product Marketing, and Product Management functions.<\/span><\/li>\n<\/ul>\n

        \u00a0<\/span><\/p>\n

        Your Skills & Experience<\/span><\/span><\/p>\n

          \n
        • Bachelor\u2019s or Master\u2019s degree in Marketing, Business, or a related field.<\/span><\/li>\n
        • 3+ years of experience in digital marketing.<\/span><\/li>\n
        • Proficiency with marketing automation platforms, preferably Pardot.<\/span><\/li>\n
        • Familiarity with digital advertising platforms such as Google Ads, Google Analytics, Bing, LinkedIn Campaign Manager.<\/span><\/li>\n
        • Comfortable using generative AI tools in day-to-day marketing work and curious about identifying new ways to apply AI to improve quality, speed, personalization, and performance.<\/span><\/li>\n
        • Ability to critically evaluate AI-generated output and combine AI capabilities with strong marketing judgment, brand understanding, and human creativity.<\/span><\/li>\n
        • Experience building or improving AI-assisted workflows, prompts, or marketing automations is an advantage.<\/span><\/li>\n
        • Proven project management skills with attention to detail and ability to multitask.<\/span><\/li>\n
        • Strong analytical skills with the ability to interpret data, identify trends, and make data-driven decisions.<\/span><\/li>\n
        • Excellent communicator who enjoys collaborating across functions and geographies.<\/span><\/li>\n
        • Full English proficiency.<\/span><\/li>\n<\/ul>\n

          \u00a0<\/span><\/p>\n

          What you'll find with us<\/span><\/span><\/p>\n

            \n
          • We provide a unique opportunity to work in a dynamic, ambitious, international company.<\/span><\/li>\n
          • We live our values * Business Focus * One Team * Can-do Attitude * Knowledge * Move Fast *.<\/span><\/li>\n
          • You will be based in our Danish office\u00a0but also work with colleagues in the US and Germany.<\/span><\/li>\n
          • Our HQ in Copenhagen has been recently renovated \u2013 we have beautiful views of the water and a great link to public transportation.<\/span><\/li>\n
          • We offer a flexible working policy.<\/span><\/li>\n
          • We work closely together in an international environment and across all professional disciplines.<\/span><\/li>\n
          • We have an informal and open culture with direct communication on all levels.<\/span><\/li>\n
          • We offer lots\u00a0of opportunities to socialize and get to know your colleagues better.<\/span><\/li>\n<\/ul>\n

            \u00a0<\/span><\/p>\n

            At Configit, we are committed to creating a diverse and inclusive workplace where our employees can thrive. We are proud to employ people of all backgrounds, and your unique talents and experiences will be welcomed. Be a part of an exciting team!<\/em><\/p>\n


            <\/p>\n

            #LI-CONFIGIT, #LI-HYBRID<\/span><\/p>","compensation":null,"datePosted":"2026-09-23","minimumExperience":"Mid-level","locationType":"2","seekPromoted":false,"aiProcessingDisclosureEnabled":false},"formFields":{"firstName":{"isRequired":true,"value":"","label":"First Name"},"lastName":{"isRequired":true,"value":"","label":"Last Name"},"email":{"isRequired":true,"value":"","label":"Email"},"phone":{"isRequired":true,"value":"","label":"Phone"},"streetAddress":{"isRequired":true,"value":"","label":"Address"},"city":{"isRequired":true,"value":"","label":"City"},"state":{"isRequired":true,"value":"","label":"State","options":[]},"zip":{"isRequired":true,"value":"","label":"ZIP"},"countryId":{"isRequired":true,"value":"57","label":"Country","options":[{"id":"1","text":"United States"},{"id":"2","text":"Canada"},{"id":"3","text":"Australia"},{"id":"4","text":"Afghanistan"},{"id":"5","text":"Albania"},{"id":"6","text":"Algeria"},{"id":"7","text":"American Samoa"},{"id":"8","text":"Andorra"},{"id":"9","text":"Anguilla"},{"id":"10","text":"Angola"},{"id":"11","text":"Antarctica"},{"id":"12","text":"Antigua and Barbuda"},{"id":"13","text":"Argentina"},{"id":"14","text":"Armenia"},{"id":"15","text":"Aruba"},{"id":"16","text":"Austria"},{"id":"17","text":"Azerbaijan"},{"id":"18","text":"Bahamas"},{"id":"19","text":"Bahrain"},{"id":"20","text":"Bangladesh"},{"id":"21","text":"Barbados"},{"id":"22","text":"Belgium"},{"id":"23","text":"Belize"},{"id":"24","text":"Benin"},{"id":"25","text":"Bermuda"},{"id":"26","text":"Bhutan"},{"id":"27","text":"Bolivia"},{"id":"28","text":"Bosnia and Herzegovina"},{"id":"29","text":"Botswana"},{"id":"30","text":"Bouvet Island"},{"id":"31","text":"Brazil"},{"id":"32","text":"British Indian Ocean Territory"},{"id":"33","text":"Brunei Darussalam"},{"id":"34","text":"Bulgaria"},{"id":"35","text":"Burkina Faso"},{"id":"36","text":"Burundi"},{"id":"37","text":"Cambodia"},{"id":"38","text":"Cameroon"},{"id":"39","text":"Cape Verde"},{"id":"40","text":"Cayman Islands"},{"id":"41","text":"Central African Republic"},{"id":"42","text":"Chad"},{"id":"43","text":"Chile"},{"id":"44","text":"China"},{"id":"45","text":"Christmas Island"},{"id":"46","text":"Cocos (Keeling Islands)"},{"id":"47","text":"Colombia"},{"id":"48","text":"Comoros"},{"id":"49","text":"Congo"},{"id":"50","text":"Cook Islands"},{"id":"51","text":"Costa Rica"},{"id":"52","text":"Cote D'Ivoire (Ivory Coast)"},{"id":"53","text":"Croatia (Hrvatska)"},{"id":"54","text":"Cuba"},{"id":"55","text":"Cyprus"},{"id":"56","text":"Czech Republic"},{"id":"57","text":"Denmark"},{"id":"58","text":"Djibouti"},{"id":"59","text":"Dominica"},{"id":"60","text":"Dominican Republic"},{"id":"61","text":"East Timor"},{"id":"62","text":"Egypt"},{"id":"63","text":"El Salvador"},{"id":"64","text":"Ecuador"},{"id":"65","text":"Equatorial Guinea"},{"id":"66","text":"Eritrea"},{"id":"67","text":"Estonia"},{"id":"68","text":"Ethiopia"},{"id":"69","text":"Falkland Islands (Malvinas)"},{"id":"70","text":"Faroe Islands"},{"id":"71","text":"Fiji"},{"id":"72","text":"Finland"},{"id":"73","text":"France"},{"id":"74","text":"France, Metropolitan"},{"id":"75","text":"French Guiana"},{"id":"76","text":"French Polynesia"},{"id":"77","text":"French Southern Territories"},{"id":"78","text":"French West Indies"},{"id":"79","text":"Gabon"},{"id":"80","text":"Gambia"},{"id":"81","text":"Georgia"},{"id":"82","text":"Germany"},{"id":"83","text":"Ghana"},{"id":"84","text":"Gibraltar"},{"id":"85","text":"Greece"},{"id":"86","text":"Greenland"},{"id":"87","text":"Grenada"},{"id":"88","text":"Guadeloupe"},{"id":"89","text":"Guam"},{"id":"90","text":"Guatemala"},{"id":"91","text":"Guinea"},{"id":"92","text":"Guinea-Bissau"},{"id":"93","text":"Guyana"},{"id":"94","text":"Haiti"},{"id":"95","text":"Heard and McDonald Islands"},{"id":"96","text":"Honduras"},{"id":"97","text":"Hong Kong"},{"id":"98","text":"Hungary"},{"id":"99","text":"Iceland"},{"id":"100","text":"India"},{"id":"101","text":"Indonesia"},{"id":"102","text":"Iran"},{"id":"103","text":"Iraq"},{"id":"104","text":"Ireland"},{"id":"105","text":"Israel"},{"id":"106","text":"Italy"},{"id":"107","text":"Jamaica"},{"id":"108","text":"Japan"},{"id":"109","text":"Jordan"},{"id":"110","text":"Kazakhstan"},{"id":"111","text":"Kenya"},{"id":"112","text":"Kiribati"},{"id":"113","text":"Korea (North)"},{"id":"114","text":"Korea (South)"},{"id":"115","text":"Kuwait"},{"id":"116","text":"Kyrgyzstan"},{"id":"117","text":"Laos"},{"id":"118","text":"Latvia"},{"id":"119","text":"Lebanon"},{"id":"120","text":"Lesotho"},{"id":"121","text":"Liberia"},{"id":"122","text":"Libya"},{"id":"123","text":"Liechtenstein"},{"id":"124","text":"Lithuania"},{"id":"125","text":"Luxembourg"},{"id":"126","text":"Macao"},{"id":"127","text":"Macedonia"},{"id":"128","text":"Madagascar"},{"id":"129","text":"Malawi"},{"id":"130","text":"Malaysia"},{"id":"131","text":"Maldives"},{"id":"132","text":"Mali"},{"id":"133","text":"Malta"},{"id":"134","text":"Marshall Islands"},{"id":"135","text":"Martinique"},{"id":"136","text":"Mauritania"},{"id":"137","text":"Mauritius"},{"id":"138","text":"Mayotte"},{"id":"139","text":"Mexico"},{"id":"140","text":"Micronesia"},{"id":"141","text":"Moldova"},{"id":"142","text":"Monaco"},{"id":"143","text":"Mongolia"},{"id":"144","text":"Montenegro"},{"id":"145","text":"Montserrat"},{"id":"146","text":"Morocco"},{"id":"147","text":"Mozambique"},{"id":"148","text":"Namibia"},{"id":"149","text":"Nauru"},{"id":"150","text":"Nepal"},{"id":"151","text":"Netherlands"},{"id":"152","text":"Netherlands Antilles"},{"id":"153","text":"New Caledonia"},{"id":"154","text":"New Zealand"},{"id":"155","text":"Nicaragua"},{"id":"156","text":"Niger"},{"id":"157","text":"Nigeria"},{"id":"158","text":"Niue"},{"id":"159","text":"Norfolk Island"},{"id":"160","text":"Northern Mariana Islands"},{"id":"161","text":"Norway"},{"id":"162","text":"Oman"},{"id":"163","text":"Pakistan"},{"id":"164","text":"Palau"},{"id":"165","text":"Panama"},{"id":"166","text":"Papua New Guinea"},{"id":"167","text":"Paraguay"},{"id":"168","text":"Peru"},{"id":"169","text":"Philippines"},{"id":"170","text":"Pitcairn"},{"id":"171","text":"Poland"},{"id":"172","text":"Portugal"},{"id":"173","text":"Puerto Rico"},{"id":"174","text":"Qatar"},{"id":"175","text":"Rwanda"},{"id":"176","text":"Reunion"},{"id":"177","text":"Romania"},{"id":"178","text":"Russian Federation"},{"id":"179","text":"Samoa"},{"id":"180","text":"San Marino"},{"id":"181","text":"Sao Tome and Principe"},{"id":"182","text":"Saudi Arabia"},{"id":"183","text":"Senegal"},{"id":"184","text":"Serbia"},{"id":"185","text":"Seychelles"},{"id":"186","text":"Sierra Leone"},{"id":"187","text":"Singapore"},{"id":"188","text":"Slovakia"},{"id":"189","text":"Slovenia"},{"id":"190","text":"Solomon Islands"},{"id":"191","text":"South Africa"},{"id":"192","text":"Spain"},{"id":"193","text":"Sri Lanka"},{"id":"194","text":"St. Helena"},{"id":"195","text":"Saint Kitts and Nevis"},{"id":"196","text":"Saint Lucia"},{"id":"197","text":"St. Pierre and Miquelon"},{"id":"198","text":"Saint Vincent and the Grenadines"},{"id":"199","text":"Sudan"},{"id":"200","text":"Suriname"},{"id":"201","text":"Svalbard"},{"id":"202","text":"Swaziland"},{"id":"203","text":"Sweden"},{"id":"204","text":"Switzerland"},{"id":"205","text":"Syria"},{"id":"206","text":"Taiwan"},{"id":"207","text":"Tajikistan"},{"id":"208","text":"Tanzania"},{"id":"209","text":"Thailand"},{"id":"210","text":"Togo"},{"id":"211","text":"Tokelau"},{"id":"212","text":"Tonga"},{"id":"213","text":"Trinidad and Tobago"},{"id":"214","text":"Tunisia"},{"id":"215","text":"Turkey"},{"id":"216","text":"Turkmenistan"},{"id":"217","text":"Turks and Caicos Islands"},{"id":"218","text":"Tuvalu"},{"id":"219","text":"Uganda"},{"id":"220","text":"Ukraine"},{"id":"221","text":"United Arab Emirates"},{"id":"222","text":"United Kingdom"},{"id":"223","text":"US Minor Outlying Islands"},{"id":"224","text":"Uruguay"},{"id":"225","text":"Uzbekistan"},{"id":"226","text":"Vanuatu"},{"id":"227","text":"Vatican City State"},{"id":"228","text":"Venezuela"},{"id":"229","text":"Viet Nam"},{"id":"230","text":"Virgin Islands (British)"},{"id":"231","text":"Virgin Islands, U.S."},{"id":"232","text":"Wallis and Futuna Islands"},{"id":"233","text":"Western Sahara"},{"id":"234","text":"Yemen"},{"id":"235","text":"Yugoslavia"},{"id":"236","text":"Zaire"},{"id":"237","text":"Zambia"},{"id":"238","text":"\u00c5land Islands"},{"id":"239","text":"Saint Barth\u00e9lemy"},{"id":"240","text":"Bonaire, Sint Eustatius and Saba"},{"id":"241","text":"Belarus"},{"id":"242","text":"Congo, the Democratic Republic of the"},{"id":"243","text":"Cura\u00e7ao"},{"id":"244","text":"Guernsey"},{"id":"245","text":"South Georgia and the South Sandwich Islands"},{"id":"246","text":"Isle of Man"},{"id":"247","text":"Jersey"},{"id":"248","text":"Myanmar"},{"id":"249","text":"Palestinian Territories"},{"id":"250","text":"Somalia"},{"id":"251","text":"South Sudan"},{"id":"252","text":"Sint Maarten (Dutch part)"},{"id":"253","text":"Zimbabwe"},{"id":"254","text":"Kosovo"},{"id":"255","text":"Kurdistan"},{"id":"256","text":"Saint Martin (French part)"}]},"linkedinUrl":{"isRequired":false,"value":"","label":"LinkedIn URL"},"coverLetterFileId":{"isRequired":true,"value":"","label":"Cover Letter"},"resumeFileId":{"isRequired":true,"value":"","label":"Resume"},"customQuestions":[{"id":"70","isRequired":false,"question":"By submitting my application, I agree that: \u2022 Configit A\/S (Data Controller) may process my personal data for recruitment purposes, as described in the Privacy Policy (go.configit.com\/privacy-policy-bamboohr). \u2022 My data will be stored securely in the Applicant Tracking System (ATS) provided by BambooHR (Data Processor). \u2022 My data will be retained for 6 months after the recruitment process has been closed, unless I consent to longer storage in a talent pool.","type":"checkbox","value":"","isValueOther":false,"hasOther":"no","options":[]}],"genderId":[],"ethnicityId":[],"veteranStatusId":[],"disabilityId":[]}}} \ No newline at end of file diff --git a/tests/fixtures/ats/bamboohr.json b/tests/fixtures/ats/bamboohr.json new file mode 100644 index 0000000..071f476 --- /dev/null +++ b/tests/fixtures/ats/bamboohr.json @@ -0,0 +1 @@ +{"meta":{"totalCount":2},"result":[{"id":"26","jobOpeningName":"Unsolicited application - All Configit locations","departmentId":null,"departmentLabel":null,"employmentStatusLabel":"Full-Time","employmentType":null,"location":{"city":"K\u00f8benhavn \u00d8","state":null},"atsLocation":{"country":null,"state":null,"province":null,"city":null},"isRemote":null,"locationType":"2"},{"id":"37","jobOpeningName":"Demand Generation Specialist - 12-Month Maternity Cover","departmentId":"18571","departmentLabel":"Marketing","employmentStatusLabel":"Full-Time","employmentType":null,"location":{"city":"K\u00f8benhavn \u00d8","state":null},"atsLocation":{"country":null,"state":null,"province":null,"city":null},"isRemote":null,"locationType":"2"}]} \ No newline at end of file diff --git a/tests/test_ats_bamboohr.py b/tests/test_ats_bamboohr.py new file mode 100644 index 0000000..c5f1170 --- /dev/null +++ b/tests/test_ats_bamboohr.py @@ -0,0 +1,185 @@ +"""The BambooHR host module against Configit's saved listing and two saved +role pages. No network.""" + +from __future__ import annotations + +import json +import sys +from datetime import UTC, datetime +from pathlib import Path +from typing import Any + +import httpx +import pytest + +ROOT = Path(__file__).resolve().parents[1] +if str(ROOT) not in sys.path: + sys.path.insert(0, str(ROOT)) + +from app.jobs import discover # noqa: E402 +from plugins import ats, atshosts # noqa: E402 +from plugins.atshosts import bamboohr # noqa: E402 + +FIXTURES = ROOT / "tests" / "fixtures" / "ats" + + +def _read(name: str) -> bytes: + return (FIXTURES / name).read_bytes() + + +def _get_of(answers: dict[str, bytes | Exception], asked: list[tuple[str, Any]]) -> Any: + def get(url: str, *, method: str = "GET", payload: Any = None, + headers: dict[str, str] | None = None) -> bytes: + asked.append((url, headers)) + answer = answers[url] + if isinstance(answer, Exception): + raise answer + return answer + return get + + +def test_a_listing_becomes_rows() -> None: + rows = bamboohr.parse(_read("bamboohr.json"), "configit") + assert [r["source_id"] for r in rows] == ["26", "37"] + # The standing invitation to apply without a role is a role like any other. + assert rows[0]["title"] == "Unsolicited application - All Configit locations" + second = rows[1] + assert second["title"] == "Demand Generation Specialist - 12-Month Maternity Cover" + assert second["url"] == "https://configit.bamboohr.com/careers/37" + assert second["department"] == "Marketing" and rows[0]["department"] == "" + assert second["location"] == "København Ø" + assert second["remote"] == "hybrid" + assert (second["posted"], second["description"], second["salary_text"]) == (None, "", "") + + +@pytest.mark.parametrize(("flag", "kind", "remote"), [ + (True, "0", "remote"), (None, "0", "onsite"), (None, "1", "remote"), (None, "2", "hybrid"), + (None, None, None), (False, "7", None)]) +def test_remote_is_the_flag_then_the_location_type( + flag: bool | None, kind: str | None, remote: str | None) -> None: + body = json.loads(_read("bamboohr.json")) + body["result"][0] |= {"isRemote": flag, "locationType": kind} + assert bamboohr.parse(json.dumps(body).encode(), "configit")[0]["remote"] == remote + + +def test_the_location_reads_the_state_and_the_ats_location_too() -> None: + body = json.loads(_read("bamboohr.json")) + body["result"][0]["location"] = {"city": "Austin", "state": "Texas"} + body["result"][1]["location"] = {"city": None, "state": None} + body["result"][1]["atsLocation"] = {"city": "Lyon", "state": None, "country": "France"} + rows = bamboohr.parse(json.dumps(body).encode(), "configit") + assert [r["location"] for r in rows] == ["Austin, Texas", "Lyon, France"] + + +def test_a_list_shorter_than_its_count_is_refused_not_read_as_the_board() -> None: + body = json.loads(_read("bamboohr.json")) + body["meta"]["totalCount"] = 3 + with pytest.raises(ValueError, match="2 of 3"): + bamboohr.parse(json.dumps(body).encode(), "configit") + + +def test_a_page_that_is_not_a_listing_raises_and_an_empty_board_is_no_rows() -> None: + assert bamboohr.parse(b'{"meta": {"totalCount": 0}, "result": []}', "configit") == [] + for body in (b"", b"[]", b'{"result": null}'): + with pytest.raises(ValueError): + bamboohr.parse(body, "configit") + + +def test_a_role_without_a_title_or_an_id_is_left_out() -> None: + body = json.loads(_read("bamboohr.json")) + body["result"][0]["jobOpeningName"] = " " + body["result"][1]["id"] = None + assert bamboohr.parse(json.dumps(body).encode(), "configit") == [] + + +def test_detail_reads_the_text_the_date_and_the_country() -> None: + row = bamboohr.parse(_read("bamboohr.json"), "configit")[1] + asked: list[tuple[str, Any]] = [] + url = "https://configit.bamboohr.com/careers/37/detail" + found = bamboohr.detail(_get_of({url: _read("bamboohr-detail-37.json")}, asked), + "configit", row) + assert asked == [(url, {"Accept": "application/json"})] + assert set(found) <= set(ats.DETAIL_FIELDS) + assert found["posted"] == datetime(2026, 9, 23, tzinfo=UTC) + assert found["location"] == "København Ø, Denmark" + assert found["remote"] == "hybrid" + text = found["description"] + assert text.startswith("Our Global Marketing Team is looking for") + assert "Skills & Experience" in text and "&" not in text and "<" not in text + + +def test_detail_of_the_standing_invitation() -> None: + row = bamboohr.parse(_read("bamboohr.json"), "configit")[0] + url = "https://configit.bamboohr.com/careers/26/detail" + found = bamboohr.detail(_get_of({url: _read("bamboohr-detail-26.json")}, []), "configit", row) + assert found["posted"] == datetime(2025, 10, 10, tzinfo=UTC) + assert found["description"].startswith("Hi, If there is currently no vacant position") + assert "UK (remote)" in found["description"] + + +def test_detail_refuses_an_answer_that_is_not_a_role() -> None: + url = "https://configit.bamboohr.com/careers/37/detail" + row = {"source_id": "37"} + for body in (b"", b'{"result": {}}', b"[]"): + with pytest.raises(ValueError): + bamboohr.detail(_get_of({url: body}, []), "configit", row) + + +def test_the_board_and_its_details_are_read_through_the_app( + monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.setattr(ats, "PAGE_DELAY", 0) + base = "https://configit.bamboohr.com/careers" + seen: list[str] = [] + + def handler(request: httpx.Request) -> httpx.Response: + seen.append(str(request.url)) + if request.url.path == "/careers/list": + return httpx.Response(200, content=_read("bamboohr.json")) + if request.url.path == "/careers/26/detail": + return httpx.Response(404) + assert request.headers["accept"] == "application/json" + return httpx.Response(200, content=_read("bamboohr-detail-37.json")) + + with httpx.Client(transport=httpx.MockTransport(handler)) as client: + rows, complete = ats._fetch_rows(client, "bamboohr:configit") + assert complete and len(rows) == 2 and seen == [f"{base}/list"] + filled, done, failed = ats._read_details(client, "bamboohr:configit", rows, complete, + set(), set()) + assert seen[1:] == [f"{base}/26/detail", f"{base}/37/detail"] + # A 404 counts as read; the other role is filled from its own page. + assert done == {"bamboohr:configit:26", "bamboohr:configit:37"} and failed == set() + assert filled[0]["description"] == "" and filled[1]["location"] == "København Ø, Denmark" + assert filled[1]["posted"] == datetime(2026, 9, 23, tzinfo=UTC) + + +def test_the_slug_the_urls_and_the_allow_list() -> None: + assert bamboohr.slug_ok("configit") and bamboohr.slug_ok("Configit") + assert bamboohr.careers_url("configit") == "https://configit.bamboohr.com/careers" + assert bamboohr.robots_page("configit") == "https://configit.bamboohr.com/careers" + assert bamboohr.feed_url("Configit") == "https://configit.bamboohr.com/careers/list" + allow = bamboohr.allowed("Configit") + assert allow("configit.bamboohr.com") and allow("CONFIGIT.bamboohr.com") + assert not allow("bamboohr.com") and not allow("other.bamboohr.com") + assert not allow("configit.bamboohr.com.evil.example") and not allow("localhost") + assert atshosts.HOSTS["bamboohr"] is bamboohr and ats.HOSTS["bamboohr"] == "BambooHR" + + +@pytest.mark.parametrize("slug", [ + "", "a@b", "a#b", "a?b", "..", "a/b", "a%2fb", "a:443", "a b", " a", "a\n", "a\r\n", + "a.b", "127.0.0.1", "[::1]", "a_b", "2130706433.evil"]) +def test_a_hostile_slug_is_refused(slug: str) -> None: + assert not bamboohr.slug_ok(slug) + assert not ats.is_known_target(f"bamboohr:{slug}") + + +def test_a_local_word_as_a_slug_only_reaches_bamboohrs_own_host() -> None: + allow = bamboohr.allowed("localhost") + assert allow("localhost.bamboohr.com") and not allow("localhost") + + +def test_discovery_finds_the_subdomain_and_not_bamboohrs_own_hosts() -> None: + page = ('' + 'xy' + 'z') + assert [(h, s) for h, s, _ in discover.boards_in(page)] == [("bamboohr", "configit")] + assert "bamboohr" not in {h for h, _ in discover._UNREADABLE if h not in atshosts.HOSTS} From 1fc96681106bb35c3eb30415a7a0aed96f25b6ff Mon Sep 17 00:00:00 2001 From: Wolf Date: Tue, 29 Sep 2026 20:05:04 +0200 Subject: [PATCH 3/5] Read Gem boards through the job board's GraphQL API Co-Authored-By: Claude Sonnet 5.5 --- plugins/atshosts/gem.py | 152 ++++++++++++++++++++++ tests/fixtures/ats/gem-detail-1.json | 1 + tests/fixtures/ats/gem-detail-2.json | 1 + tests/fixtures/ats/gem.json | 1 + tests/test_ats_gem.py | 180 +++++++++++++++++++++++++++ 5 files changed, 335 insertions(+) create mode 100644 plugins/atshosts/gem.py create mode 100644 tests/fixtures/ats/gem-detail-1.json create mode 100644 tests/fixtures/ats/gem-detail-2.json create mode 100644 tests/fixtures/ats/gem.json create mode 100644 tests/test_ats_gem.py diff --git a/plugins/atshosts/gem.py b/plugins/atshosts/gem.py new file mode 100644 index 0000000..e57db05 --- /dev/null +++ b/plugins/atshosts/gem.py @@ -0,0 +1,152 @@ +"""Gem: `gem:` for jobs.gem.com/, one GraphQL POST for the +whole board and one more for a role's text and date. The board is the path +after `jobs.gem.com/`, and it is case-sensitive (`Productboard` is an empty +board where `productboard` is not). + +The two queries below were read out of Gem's page scripts +(`static.gem.com/scripts/jobBoards.*.js` and `ExternalJobBoardList.*.js`) on +2026-09-29 and run against Productboard's and sennder's boards; the schema is +Gem's own and not documented, so a new bundle can rename a field. Each query is +one constant, and an answer that lacks the shape read here fails with an error +that says which part is missing rather than reading as an empty board. The +endpoint answered with no Origin and no Referer header, so none is sent. An +unknown board answers 200 with an empty list, like a board with no role open. + +The listing has no description and no date; both are on the role's page. +""" + +from __future__ import annotations + +import html +import json +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 + +NAME = "gem" +LABEL = "Gem" +KEEP_CASE = True +PATTERNS = (r"jobs\.gem\.com/([A-Za-z0-9_-]+)",) + +_HOST = "jobs.gem.com" +_API = f"https://{_HOST}/api/public/graphql" + +#: A board is one path segment of letters, digits, `-` and `_`. It travels as a +#: GraphQL variable and never into a host name, so the host stays Gem's. +_BOARD = re.compile(r"[A-Za-z0-9_-]+") + +#: Every role of a board in one answer, with no paging and no total. +LIST_QUERY = ( + "query JobBoardList($boardId: String!) { oatsExternalJobPostings(boardId: $boardId) " + "{ jobPostings { id extId title locations { id name city isoCountry isRemote extId } " + "job { id department { id name extId } locationType employmentType } } } }") + +#: One role's description and the date it was first published. +DETAIL_QUERY = ( + "query ExternalJobPosting($boardId: String!, $extId: String!) " + "{ oatsExternalJobPosting(boardId: $boardId, extId: $extId) " + "{ id title descriptionHtml extId firstPublishedTsSec " + "locations { id extId name city isoCountry isRemote } " + "job { id locationType employmentType requisitionId teamDisplayName " + "department { id extId name } } compensationHtml } }") + +#: `job.locationType` -> `store._remote`'s words. +_REMOTE = {"IN_OFFICE": "onsite", "HYBRID": "hybrid", "REMOTE": "remote"} + + +def slug_ok(slug: str) -> bool: + return bool(_BOARD.fullmatch(slug)) + + +def allowed(slug: str) -> Callable[[str], bool]: + return only(_HOST) + + +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.`. An + `errors` list or a `data` without the key is Gem's schema having moved (or + a refused query), and is raised as such; a `null` at the key is returned.""" + answer = json.loads(get(_API, method="POST", payload={ + "operationName": operation, "variables": variables, "query": query})) + if not isinstance(answer, dict): + raise ValueError(f"not a Gem answer: {type(answer).__name__}") + if answer.get("errors"): + first = answer["errors"][0] + message = first.get("message") if isinstance(first, dict) else first + raise ValueError(f"Gem's {operation} query was refused: {message}") + data = answer.get("data") + if not isinstance(data, dict) or path not in data: + raise ValueError(f"Gem's {operation} answer has no {path}; the query may be out of date") + return data[path] + + +def page(get: Get, slug: str, cursor: Any) -> 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 + if not isinstance(postings, list): + raise ValueError("Gem's JobBoardList answer has no jobPostings list; " + "the query may be out of date") + return postings, [{"id": p.get("extId") or p.get("id") or ""} for p in postings], None, None + + +def rows(postings: list[dict[str, Any]], slug: str) -> list[Row]: + """A role has `extId` (a number from a synced Greenhouse, else an opaque + string; the role's page is `jobs.gem.com//`), `title`, + `locations` (`name`, `city`, `isoCountry` as ISO alpha-3, `isRemote`) and + `job` (`department`, `locationType`, `employmentType`). No pay is stated + in the list.""" + out = [] + for p in postings: + title = (p.get("title") or "").strip() + ext_id = str(p.get("extId") or "") + if not title or not ext_id: + continue + locations = p.get("locations") or [] + places: list[str] = [] + 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) + 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({ + "source_id": ext_id, + "title": title, + "location": "; ".join(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": "", + }) + return out + + +def detail(get: Get, slug: str, row: Row) -> dict[str, Any]: + """`oatsExternalJobPosting` of the role: `descriptionHtml` and + `firstPublishedTsSec` (epoch seconds). `compensationHtml` was null on the + roles read and is left alone.""" + role = _ask(get, "ExternalJobPosting", DETAIL_QUERY, + {"boardId": slug, "extId": row["source_id"]}, "oatsExternalJobPosting") + if not isinstance(role, dict): + raise ValueError(f"Gem has no role {row['source_id']} on {slug}") + text = html.unescape(strip_html(role.get("descriptionHtml") or "")) + return {"description": " ".join(text.split()), + "posted": parse_dt(role.get("firstPublishedTsSec"))} diff --git a/tests/fixtures/ats/gem-detail-1.json b/tests/fixtures/ats/gem-detail-1.json new file mode 100644 index 0000000..9589805 --- /dev/null +++ b/tests/fixtures/ats/gem-detail-1.json @@ -0,0 +1 @@ +{"data":{"oatsExternalJobPosting":{"id":"T2F0c0pvYlBvc3Q6MTA0NDAzNA==","title":"Staff AI Product Engineer (Prague/Brno/Remote EU)","descriptionHtml":"

            Only the best engineers are being built here.
            At Productboard, we are defining AI-first Product Engineering. Not as a one-time achievement, but as a baseline we raise every time we reach it. We remove every bottleneck as it surfaces and rebuild how product teams work from first principles, not just adding AI to existing workflows.
            AI tools are everywhere now. Agents can write code. That\u2019s today\u2019s baseline.What we're building is the environment where the baseline makes you better: focused on outcomes, writing specs that agents build from, leveling up with every feature you ship.
            We are defining what AI-native product development becomes. We're all in.

            What you will build

            You'd lead the architectural work that makes our codebase AI-native. Specifically:
            • Agent-native architecture standards. Clear API contracts, semantic naming, well-defined module boundaries. The patterns that keep AI effective as our systems grow.
            • A context infrastructure layer. Repo-versioned guidance that AI tools load automatically \u2014 improving the output of Cursor, Claude Code, and Codex simultaneously.
            • Self-healing workflows for incidents. Agents that triage alerts, pull logs, surface relevant history, suggest remediation. Humans intervene where judgment matters.
            • Agent workflows that go beyond chat. Multi-step reasoning, tool use, autonomous task execution with human-gated checkpoints \u2014 for product features, not internal demos.
            • Systematic optimization of AI code review. Earlier detection of correctness, security, and maintainability issues, with the noise filtered out before it reaches a human reviewer.

            The opportunity

            The first shift in our teams has already happened: agents write code. That\u2019s the baseline everywhere. Now we\u2019re building an AI-first Product Engineering organization where learning matters as much as shipping.
            Only a few companies build a product that makes them better. What we\u2019re building next is a single place where work lives. Specs, plans, and full product context live in Productboard. There\u2019s a seamless loop between Spark, our AI agent, and the coding agents. Engineers can steer from anywhere and focus on directing the work instead of typing it all out.
            Our own teams run on Productboard and Spark, so the feedback loop isn't a survey next quarter. It's the next conversation you overhear.
            Imagine you ship a feature before lunch and by the afternoon, half the floor is working with it. Not in a demo, not on a roadmap slide: in our real work, minutes after you merged.
            We feel the gaps our customers feel, and we close them first. Every feature goes straight to real product teams solving real problems, starting with ours.
            We are looking for a Staff AI Engineer who wants to build this from the inside.

            Why this matters for your career

            Engineers own more. Not just the code: the outcome it drives.
            You won't just use AI tools. You will shape the architecture that makes agents effective, define the workflows that make them reliable, and build the evaluation systems that make them trustworthy.
            This is where you become a pure product engineer. Someone who owns the problem, the trade-offs, and the result, not just the implementation. Every maker has an orchestra. The craft is knowing what it should play. And we never outsource our thinking.
            The skills you build here (designing codebases agents can work in confidently, writing specs that carry your judgment into every build, building evaluations that catch what AI misses) will define senior engineering for the next decade. What you learn here doesn't just make you faster today. It makes you more valuable for years to come.

            What you will do

            We're hiring a Staff AI Engineer to own the architectural layer that makes this real, working alongside our engineers, PMs, and designers shipping AI-first product features end-to-end. You'd ship code, set technical direction, and shape decisions about what's worth building. Your north star here will be: get from idea to validated learning twice as fast.

            How we work

            We've moved away from process and toward judgment. The shift looks like this:
            • One named driver per initiative. End-to-end ownership of the outcome, the path, the decisions, and the learnings. No approval chains. The driver decides; leadership unblocks.
            • One-page pre-reads as the unit of decision. Big work starts with a brief covering the problem, expected outcome, risks, and effort. Leadership reads it and decides. No 30-slide decks. No two-week alignment cycles.
            • Continuous delivery, no quarterly planning. Roadmap committed one month out. Beyond that, AI moves too fast for longer cycles to mean anything. We ship to internal first, then beta, then GA. Validation comes from real usage.
            • PMs and designers ship to production. Not just specs and Figma. They prototype with AI tools and ship alongside engineers. PMs own what gets built and when. Engineers own how.
            If you've been a founding engineer or founder, this should feel familiar. If you've been waiting for a place that operates like that at scale, this is one.

            About you

            • 6-10+ years of production software engineering experience
            • Strong backend skills in Python, Kotlin, or Java, with experience evolving service-level logic and infrastructure
            • Hands-on LLM experience in real products: prompt design, context management, evaluation, real understanding of trade-offs (hallucinations, latency, cost, reliability)
            • Comfort with distributed systems and event-driven architectures (queues, async processing, service-to-service communication)
            • Daily use of AI coding tools as a core part of your workflow \u2014 pushing them, refining prompts, knowing where they break
            • Strong fit: Former founding engineer or founder. A 0-to-1 engineer who turns business insights into prototypes to validate ideas quickly. Someone who's built agentic systems in production, or done deep work with multi-step LLM workflows (tool use, memory, orchestration).

            Our tech stack

            • AI layer: Python, Pydantic AI, Braintrust
            • Frontend: TypeScript, React, Relay, GraphQL
            • Backend: Kotlin, Ruby (legacy services we're modernizing), with new services built in Kotlin
            • Storage: PostgreSQL, MongoDB, Elastic, Redis
            • Data pipeline: Python, Keboola, Looker, Snowflake
            • Infrastructure: AWS, Cloudflare, Kubernetes, Terraform

            Our Compensation

            Salary range: 2,295,000\u20133,305,000 CZK annually
            • Where most of our L4s sit:
              • Q1 (2.3M\u20132.55M) \u00b7 33%
              • Q2 (2.55M\u20132.8M) \u00b7 27%
              • Q3 (2.8M\u20133.05M) \u00b7 33%
              • Q4 (3.05M\u20133.3M) \u00b7 7%

            Our benefits include

            • Stock options
            • MacBook + 34\u2033 monitor
            • Work from home stipend to support your home office setup
            • 5 weeks of vacation + 9 sick days
            • Flexible working hours and home office
            • Budget for online courses, books, and conferences
            • 2 weeks of fully paid parental leave
            • Fertility & Family-Building Support with Carrot
            • Mental Wellness Program with Soulmio to support your well-being and self-care
            • 1 Volunteer Day per year to support causes close to your heart, plus donation matching from Productboard
            • Free snacks, drinks, and yummy catered lunches from White Circus at the office every day
            • Free MultiSport card
            • On-site bouldering wall, boxing bag, and workout mats
            • Team events, such as happy hours, off-sites, and retreats
            • Free year-round access to Prague Zoo

            Relocation Opportunities

            If joining us means making a move, we're here to help make that transition easier.
            Candidates must have the legal right to work in the EU. While we are unable to provide visa sponsorship for this role, we're happy to support relocation to Prague for candidates already authorized to work in the EU.
            Relocation Support
            We offer a one-time relocation bonus ranging from $6,000 to $13,000 USD, depending on your personal situation, whether you're moving on your own or with a partner or family.
            This bonus is intended to help offset moving expenses and support your transition into your new city. While it may not cover every cost, it provides meaningful financial support as you get settled.
            If you're thinking about relocating and want to explore what this could look like for you, we'd be happy to have that conversation.

            About Productboard

            Productboard is the leading intelligent product management platform, used by 6,000+ companies including Salesforce, SAP, Autodesk, and Kroger. Headquartered in San Francisco, with engineering hubs in Prague and Brno. Backed by Index Ventures, Kleiner Perkins, Sequoia Capital, Bessemer, Tiger Global, and Dragoneer.
            We've spent the last decade building the foundation for how product teams work. We're now in our 0-to-1 moment again, building Productboard Spark \u2014 the AI-first, agentic experience that turns raw feedback and signals into clear problems, strong specs, and faster execution. Spark is what powers everything you'd be working on.
            Are you building with us?
            If the work above is what you want to spend the next chapter of your career on, apply below!
            Equal Opportunity
            Productboard is an equal opportunity employer. We are committed to an inclusive hiring process and consider all qualified applicants without discrimination based on characteristics protected by applicable law. If you require an accommodation during the hiring process, please contact peopleops@productboard.com.
            By applying you agree to Productboard's Global Candidate Privacy Policy
            ","extId":"8080046002","firstPublishedTsSec":1753349342,"locations":[{"id":"38771","extId":"4029634002","name":"Prague (Hybrid)","city":"Prague","isoCountry":"CZE","isRemote":false}],"job":{"id":"T2F0c0pvYjo2MDYxMDY=","locationType":"HYBRID","employmentType":"FULL_TIME","requisitionId":"E-003","teamDisplayName":"Productboard","department":{"id":"37338","extId":"4065161002","name":"Product Engineering"}},"compensationHtml":null}}} \ No newline at end of file diff --git a/tests/fixtures/ats/gem-detail-2.json b/tests/fixtures/ats/gem-detail-2.json new file mode 100644 index 0000000..d1fc4b4 --- /dev/null +++ b/tests/fixtures/ats/gem-detail-2.json @@ -0,0 +1 @@ +{"data":{"oatsExternalJobPosting":{"id":"T2F0c0pvYlBvc3Q6NzU5NjA4Mg==","title":"Staff Fullstack DevX Engineer (Prague/Brno/Remote EU)","descriptionHtml":"
            Only the best engineers are being built here.
            At Productboard, we are defining AI-first Product Engineering. Not as a one-time achievement, but as a baseline we raise every time we reach it. We remove every bottleneck as it surfaces and rebuild how product teams work from first principles, not just adding AI to existing workflows.
            AI tools are everywhere now. Agents can write code. That\u2019s today\u2019s baseline.What we're building is the environment where the baseline makes you better: focused on outcomes, writing specs that agents build from, leveling up with every feature you ship.
            We are defining what AI-native product development becomes. We're all in.

            What you will build

            You'd lead the architectural work that makes our codebase AI-native. Specifically:
            • Agent-native architecture standards. Clear API contracts, semantic naming, well-defined module boundaries. The patterns that keep AI effective as our systems grow.
            • A context infrastructure layer. Repo-versioned guidance that AI tools load automatically \u2014 improving the output of Cursor, Claude Code, and Codex simultaneously.
            • Self-healing workflows for incidents. Agents that triage alerts, pull logs, surface relevant history, suggest remediation. Humans intervene where judgment matters.
            • Agent workflows that go beyond chat. Multi-step reasoning, tool use, autonomous task execution with human-gated checkpoints \u2014 for product features, not internal demos.
            • Systematic optimization of AI code review. Earlier detection of correctness, security, and maintainability issues, with the noise filtered out before it reaches a human reviewer.

            The opportunity

            The first shift in our teams has already happened: agents write code. That\u2019s the baseline everywhere. Now we\u2019re building an AI-first Product Engineering organization where learning matters as much as shipping.
            Only a few companies build a product that makes them better. What we\u2019re building next is a single place where work lives. Specs, plans, and full product context live in Productboard. There\u2019s a seamless loop between Spark, our AI agent, and the coding agents. Engineers can steer from anywhere and focus on directing the work instead of typing it all out.
            Our own teams run on Productboard and Spark, so the feedback loop isn't a survey next quarter. It's the next conversation you overhear.
            Imagine you ship a feature before lunch and by the afternoon, half the floor is working with it. Not in a demo, not on a roadmap slide: in our real work, minutes after you merged.
            We feel the gaps our customers feel, and we close them first. Every feature goes straight to real product teams solving real problems, starting with ours.
            We are looking for a Staff Full-stack DevX Engineer who wants to build this from the inside.

            Why this matters for your career

            Engineers own more. Not just the code: the outcome it drives.
            You won't just use AI tools. You will shape the architecture that makes agents effective, define the workflows that make them reliable, and build the evaluation systems that make them trustworthy.
            This is where you become a pure product engineer. Someone who owns the problem, the trade-offs, and the result, not just the implementation. Every maker has an orchestra. The craft is knowing what it should play. And we never outsource our thinking.
            The skills you build here (designing codebases agents can work in confidently, writing specs that carry your judgment into every build, building evaluations that catch what AI misses) will define senior engineering for the next decade. What you learn here doesn't just make you faster today. It makes you more valuable for years to come.

            What you will do

            • Build and evolve Kotlin services and frameworks that streamline the inner loop (APIs, build/test tooling, automation, paved paths).
            • Maintain and improve our internal developer tool written in Golang.
            • Accelerate CI/CD: improve caching/parallelism, increase test reliability, and shorten feedback cycles.
            • Partner across teams to standardise workflows, enable self-serve integrations, and reduce cross-team friction.
            • Instrument and improve: define DX metrics (lead time, build time, flakiness), run experiments, and iterate based on data.
            • Improve reliability and safety with sensible defaults\u2014observability, guardrails, and secure-by-default patterns.
            • Make our codebase AI-ready: define clear module boundaries, improve API contracts, add semantic context, and build the structured documentation that makes AI agents more effective across every repo.
            • Design and implement agent workflows that go beyond chat: multi-step reasoning, tool use, autonomous task execution, and human-gated checkpoints.
            • Run experiments, validate with real users, and iterate based on evidence. We measure learning velocity, not just output
            • Collaborate closely with product managers and designers to shape what we build, not just how we build it. We expect a product mindset, not just technical execution.
            • Act as a knowledge multiplier, sharing what you learn across and beyond your team to raise the bar for everyone.

            About you

            • 6-10+ years of professional engineering experience.
            • Experience with Kotlin/Java in production (JVM performance, testing, dependency management).
            • Solid grasp of cloud-native engineering (containers, Kubernetes; AWS/IaC a plus).
            • Pragmatic approach to developer platforms, internal tooling, and CI/CD at scale.
            • Nice to have: exposure to Go and interest in multi-language ecosystems.
            • Previous experience with working on developer or internal tooling.
            • Contributing to open source.
            • Strong communication skills and collaborative mindset.
            • Curiosity, adaptability, and a proactive, startup-friendly attitude.
            • Bring product thinking to engineering work. You can articulate why something matters for users, not just how it works technically.
            • Embrace AI as a daily tool in your own workflow. You use AI coding assistants, iterate on prompts, and constantly look for ways to move faster.
            • Are curious about what agent native architecture looks like: how to structure codebases, APIs, and documentation so AI agents can operate effectively at scale.

            Our tech stack

            • Python for ML code
            • Celery and Kubernetes for pipeline orchestration
            • AWS, Docker, Helm, Kafka, Git, and CI/CD for real time services
            • LangGraph for agent orchestration, Braintrust for observability and evaluation
            • GraphQL, Postgres, Datadog, Sentry, and Looker
            • Business tools: Slack, Jira, Google suite, Zoom, Notion
            • Full Tech Stack

            Our Compensation

            Salary range: 2,295,000\u20133,305,000 CZK annually
            • Where most of our L4s sit:
              • Q1 (2.3M\u20132.55M) \u00b7 33%
              • Q2 (2.55M\u20132.8M) \u00b7 27%
              • Q3 (2.8M\u20133.05M) \u00b7 33%
              • Q4 (3.05M\u20133.3M) \u00b7 7%

            Our benefits include

            • Stock options
            • MacBook + 34\u2033 monitor
            • Work from home stipend to support your home office setup
            • 5 weeks of vacation + 9 sick days
            • Flexible working hours and home office
            • Budget for online courses, books, and conferences
            • 2 weeks of fully paid parental leave
            • Fertility & Family-Building Support with Carrot
            • Mental Wellness Program with Soulmio to support your well-being and self-care
            • 1 Volunteer Day per year to support causes close to your heart, plus donation matching from Productboard
            • Free snacks, drinks, and yummy catered lunches from White Circus at the office every day
            • Free MultiSport card
            • On-site bouldering wall, boxing bag, and workout mats
            • Team events, such as happy hours, off-sites, and retreats
            • Free year-round access to Prague Zoo

            Relocation Opportunities

            If joining us means making a move, we're here to help make that transition easier.
            Candidates must have the legal right to work in the EU. While we are unable to provide visa sponsorship for this role, we're happy to support relocation to Prague for candidates already authorized to work in the EU.
            Relocation Support
            We offer a one-time relocation bonus ranging from $6,000 to $13,000 USD, depending on your personal situation, whether you're moving on your own or with a partner or family.
            This bonus is intended to help offset moving expenses and support your transition into your new city. While it may not cover every cost, it provides meaningful financial support as you get settled.
            If you're thinking about relocating and want to explore what this could look like for you, we'd be happy to have that conversation.

            About Productboard

            Productboard is the leading intelligent product management platform, used by 6,000+ companies including Salesforce, SAP, Autodesk, and Kroger. Headquartered in San Francisco, with engineering hubs in Prague and Brno. Backed by Index Ventures, Kleiner Perkins, Sequoia Capital, Bessemer, Tiger Global, and Dragoneer.
            We've spent the last decade building the foundation for how product teams work. We're now in our 0-to-1 moment again, building Productboard Spark \u2014 the AI-first, agentic experience that turns raw feedback and signals into clear problems, strong specs, and faster execution. Spark is what powers everything you'd be working on.
            Are you building with us?
            If the work above is what you want to spend the next chapter of your career on, apply below!
            Equal Opportunity
            Productboard is an equal opportunity employer. We are committed to an inclusive hiring process and consider all qualified applicants without discrimination based on characteristics protected by applicable law. If you require an accommodation during the hiring process, please contact peopleops@productboard.com.
            By applying you agree to Productboard's Global Candidate Privacy Policy
            ","extId":"am9icG9zdDq5-IOakBvxHzWhMPnTzoPp","firstPublishedTsSec":1787574069,"locations":[{"id":"38771","extId":"4029634002","name":"Prague (Hybrid)","city":"Prague","isoCountry":"CZE","isRemote":false},{"id":"38772","extId":"4030754002","name":"Remote Europe","city":"Remote Europe","isoCountry":"CZE","isRemote":true},{"id":"38781","extId":"4051723002","name":"Brno (Hybrid)","city":"Brno","isoCountry":"CZE","isRemote":false}],"job":{"id":"T2F0c0pvYjo2NjA4ODU3","locationType":"HYBRID","employmentType":"FULL_TIME","requisitionId":"27-037","teamDisplayName":"Productboard","department":{"id":"37338","extId":"4065161002","name":"Product Engineering"}},"compensationHtml":null}}} \ No newline at end of file diff --git a/tests/fixtures/ats/gem.json b/tests/fixtures/ats/gem.json new file mode 100644 index 0000000..b7347cb --- /dev/null +++ b/tests/fixtures/ats/gem.json @@ -0,0 +1 @@ +{"data":{"oatsExternalJobPostings":{"jobPostings":[{"id":"T2F0c0pvYlBvc3Q6MTA0NDAzNA==","extId":"8080046002","title":"Staff AI Product Engineer (Prague/Brno/Remote EU)","locations":[{"id":"38771","name":"Prague (Hybrid)","city":"Prague","isoCountry":"CZE","isRemote":false,"extId":"4029634002"}],"job":{"id":"T2F0c0pvYjo2MDYxMDY=","department":{"id":"37338","name":"Product Engineering","extId":"4065161002"},"locationType":"HYBRID","employmentType":"FULL_TIME"}},{"id":"T2F0c0pvYlBvc3Q6NTY0ODcxMw==","extId":"am9icG9zdDpS7XehojHQK_NnncgSKWoQ","title":"Staff Full-stack Product Engineer (Prague/Brno/Remote EU)","locations":[{"id":"38771","name":"Prague (Hybrid)","city":"Prague","isoCountry":"CZE","isRemote":false,"extId":"4029634002"}],"job":{"id":"T2F0c0pvYjo2NjEyMTk=","department":{"id":"37338","name":"Product Engineering","extId":"4065161002"},"locationType":"HYBRID","employmentType":"FULL_TIME"}},{"id":"T2F0c0pvYlBvc3Q6NTY0ODcxNg==","extId":"am9icG9zdDqWC1V_RM7U6ORvTd1Iu64r","title":"Staff Backend Product Engineer (Prague/Brno/Remote EU)","locations":[{"id":"38771","name":"Prague (Hybrid)","city":"Prague","isoCountry":"CZE","isRemote":false,"extId":"4029634002"},{"id":"38772","name":"Remote Europe","city":"Remote Europe","isoCountry":"CZE","isRemote":true,"extId":"4030754002"},{"id":"38781","name":"Brno (Hybrid)","city":"Brno","isoCountry":"CZE","isRemote":false,"extId":"4051723002"}],"job":{"id":"T2F0c0pvYjoyMDg5NTcx","department":{"id":"37338","name":"Product Engineering","extId":"4065161002"},"locationType":"HYBRID","employmentType":"FULL_TIME"}},{"id":"T2F0c0pvYlBvc3Q6NzU2OTA5MQ==","extId":"am9icG9zdDpfq1dHcevndHGSzK_aYE1g","title":"Marketing Systems Operations Lead","locations":[{"id":"38780","name":"San Francisco","city":"San Francisco","isoCountry":"USA","isRemote":false,"extId":"4030598002"}],"job":{"id":"T2F0c0pvYjo2NTkyMzYy","department":{"id":"37379","name":"GTM Ops","extId":"4068217002"},"locationType":"HYBRID","employmentType":"FULL_TIME"}},{"id":"T2F0c0pvYlBvc3Q6NzU5NjA4Mg==","extId":"am9icG9zdDq5-IOakBvxHzWhMPnTzoPp","title":"Staff Fullstack DevX Engineer (Prague/Brno/Remote EU)","locations":[{"id":"38771","name":"Prague (Hybrid)","city":"Prague","isoCountry":"CZE","isRemote":false,"extId":"4029634002"},{"id":"38772","name":"Remote Europe","city":"Remote Europe","isoCountry":"CZE","isRemote":true,"extId":"4030754002"},{"id":"38781","name":"Brno (Hybrid)","city":"Brno","isoCountry":"CZE","isRemote":false,"extId":"4051723002"}],"job":{"id":"T2F0c0pvYjo2NjA4ODU3","department":{"id":"37338","name":"Product Engineering","extId":"4065161002"},"locationType":"HYBRID","employmentType":"FULL_TIME"}},{"id":"T2F0c0pvYlBvc3Q6NzYwMjE1NA==","extId":"am9icG9zdDoaMPkCxlUbsYDApcWCdyCP","title":"Staff Frontend Product Engineer (Prague/Brno/Remote EU)","locations":[{"id":"38771","name":"Prague (Hybrid)","city":"Prague","isoCountry":"CZE","isRemote":false,"extId":"4029634002"}],"job":{"id":"T2F0c0pvYjo2NjA4ODU4","department":{"id":"37338","name":"Product Engineering","extId":"4065161002"},"locationType":"HYBRID","employmentType":"FULL_TIME"}},{"id":"T2F0c0pvYlBvc3Q6NzYwMzc4Mg==","extId":"am9icG9zdDpGGIKW-IlxhJ2EnwVAtLRB","title":"Staff Full-stack Product Engineer, Growth (Prague/Brno/Remote EU) ","locations":[{"id":"38771","name":"Prague (Hybrid)","city":"Prague","isoCountry":"CZE","isRemote":false,"extId":"4029634002"}],"job":{"id":"T2F0c0pvYjo2NjEyMTk=","department":{"id":"37338","name":"Product Engineering","extId":"4065161002"},"locationType":"HYBRID","employmentType":"FULL_TIME"}},{"id":"T2F0c0pvYlBvc3Q6NzcyNzc0Ng==","extId":"am9icG9zdDq9ZHg3x3sdBTy6feA4MZ9f","title":"Digital Marketing Manager","locations":[{"id":"38780","name":"San Francisco","city":"San Francisco","isoCountry":"USA","isRemote":false,"extId":"4030598002"}],"job":{"id":"T2F0c0pvYjo2NjkyOTAw","department":{"id":"37358","name":"Digital Marketing","extId":"4076635002"},"locationType":"HYBRID","employmentType":"FULL_TIME"}},{"id":"T2F0c0pvYlBvc3Q6Nzk0NDYyMA==","extId":"am9icG9zdDp906RvIzQmjA9funJO3zB1","title":"AI Data Engineer","locations":[{"id":"38771","name":"Prague (Hybrid)","city":"Prague","isoCountry":"CZE","isRemote":false,"extId":"4029634002"},{"id":"38781","name":"Brno (Hybrid)","city":"Brno","isoCountry":"CZE","isRemote":false,"extId":"4051723002"}],"job":{"id":"T2F0c0pvYjo2ODE0MzAz","department":{"id":"37352","name":"Data","extId":"4076631002"},"locationType":"HYBRID","employmentType":"FULL_TIME"}},{"id":"T2F0c0pvYlBvc3Q6ODAzMTI0MQ==","extId":"am9icG9zdDqzuJaiLLHinwNQLMZuqlux","title":"Digital Marketing Specialist ","locations":[{"id":"38780","name":"San Francisco","city":"San Francisco","isoCountry":"USA","isRemote":false,"extId":"4030598002"}],"job":{"id":"T2F0c0pvYjo2NjkyOTAw","department":{"id":"37358","name":"Digital Marketing","extId":"4076635002"},"locationType":"HYBRID","employmentType":"FULL_TIME"}},{"id":"T2F0c0pvYlBvc3Q6ODA1NTY3NQ==","extId":"am9icG9zdDrYRR2Ri8264a07xF_f9eI3","title":"AI Customer Success Engineer ","locations":[{"id":"38780","name":"San Francisco","city":"San Francisco","isoCountry":"USA","isRemote":false,"extId":"4030598002"}],"job":{"id":"T2F0c0pvYjo2ODc3MjM2","department":{"id":"37347","name":"Customer Success","extId":"4071103002"},"locationType":"HYBRID","employmentType":"FULL_TIME"}}]}}} \ No newline at end of file diff --git a/tests/test_ats_gem.py b/tests/test_ats_gem.py new file mode 100644 index 0000000..d42e617 --- /dev/null +++ b/tests/test_ats_gem.py @@ -0,0 +1,180 @@ +"""The Gem host module against Productboard's saved listing and two saved role +answers. No network.""" + +from __future__ import annotations + +import json +import sys +from datetime import UTC, datetime +from pathlib import Path +from typing import Any + +import httpx +import pytest + +ROOT = Path(__file__).resolve().parents[1] +if str(ROOT) not in sys.path: + sys.path.insert(0, str(ROOT)) + +from app.jobs import discover # noqa: E402 +from plugins import ats, atshosts # noqa: E402 +from plugins.atshosts import gem # noqa: E402 + +FIXTURES = ROOT / "tests" / "fixtures" / "ats" +API = "https://jobs.gem.com/api/public/graphql" + + +def _read(name: str) -> bytes: + return (FIXTURES / name).read_bytes() + + +def _get_of(answers: dict[str, bytes | Exception], asked: list[dict[str, Any]]) -> Any: + """A `get` that answers a GraphQL call by its operation name.""" + def get(url: str, *, method: str = "GET", payload: Any = None, + headers: dict[str, str] | None = None) -> bytes: + assert url == API and method == "POST" + asked.append(payload | {"headers": headers}) + answer = answers[payload["operationName"]] + if isinstance(answer, Exception): + raise answer + return answer + return get + + +def _listing() -> dict[str, bytes | Exception]: + return {"JobBoardList": _read("gem.json")} + + +def test_a_listing_becomes_rows() -> None: + asked: list[dict[str, Any]] = [] + decoded, results, total, cursor = gem.page(_get_of(_listing(), asked), "productboard", None) + assert asked == [{"operationName": "JobBoardList", "variables": {"boardId": "productboard"}, + "query": gem.LIST_QUERY, "headers": None}] + assert (total, cursor) == (None, None) and len(results) == 11 + rows = gem.rows(decoded, "productboard") + assert len(rows) == 11 + first, backend = rows[0], rows[2] + assert first["source_id"] == "8080046002" # numeric, from a synced Greenhouse + assert first["title"] == "Staff AI Product Engineer (Prague/Brno/Remote EU)" + assert first["url"] == "https://jobs.gem.com/productboard/8080046002" + assert first["department"] == "Product Engineering" and first["remote"] == "hybrid" + assert first["location"] == "Prague" + assert (first["posted"], first["description"], first["salary_text"]) == (None, "", "") + assert backend["source_id"] == "am9icG9zdDqWC1V_RM7U6ORvTd1Iu64r" # opaque + assert backend["location"] == "Prague; Remote Europe; Brno" + assert len({r["source_id"] for r in rows}) == 11 + + +@pytest.mark.parametrize(("kind", "flags", "remote"), [ + ("IN_OFFICE", [False], "onsite"), ("HYBRID", [True], "hybrid"), ("REMOTE", [False], "remote"), + (None, [True, True], "remote"), (None, [True, False], None), (None, [], None), + ("SOMETHING_NEW", [False], None)]) +def test_remote_is_the_location_type_then_the_locations( + kind: str | None, flags: list[bool], remote: str | None) -> None: + posting = {"extId": "1", "title": "Role", "job": {"locationType": kind}, + "locations": [{"city": "X", "isRemote": f} for f in flags]} + assert gem.rows([posting], "acme")[0]["remote"] == remote + + +def test_a_posting_without_a_title_or_an_ext_id_is_left_out() -> None: + assert gem.rows([{"extId": "1", "title": " "}, {"extId": "", "title": "Role"}], "acme") == [] + + +def test_the_board_is_read_through_the_app_without_origin_or_referer() -> None: + seen: list[httpx.Request] = [] + + def handler(request: httpx.Request) -> httpx.Response: + seen.append(request) + return httpx.Response(200, content=_read("gem.json")) + + with httpx.Client(transport=httpx.MockTransport(handler)) as client: + rows, complete = ats._fetch_rows(client, "gem:productboard") + assert len(rows) == 11 and complete + (request,) = seen + assert str(request.url) == API and request.method == "POST" + assert json.loads(request.content)["variables"] == {"boardId": "productboard"} + assert "origin" not in request.headers and "referer" not in request.headers + assert request.headers["content-type"] == "application/json" + + +def test_an_empty_board_is_complete_at_zero() -> None: + body = b'{"data":{"oatsExternalJobPostings":{"jobPostings":[]}}}' + with httpx.Client(transport=httpx.MockTransport( + lambda request: httpx.Response(200, content=body))) as client: + assert ats._fetch_rows(client, "gem:nobody") == ([], True) + + +@pytest.mark.parametrize(("body", "message"), [ + (b'{"errors":[{"message":"Cannot query field \\"extId\\""}]}', "refused: Cannot query field"), + (b'{"data":{"somethingElse":{}}}', "no oatsExternalJobPostings"), + (b'{"data":null}', "no oatsExternalJobPostings"), + (b'{"data":{"oatsExternalJobPostings":{"postings":[]}}}', "no jobPostings list"), + (b'{"data":{"oatsExternalJobPostings":null}}', "no jobPostings list"), + (b'[]', "not a Gem answer"), +]) +def test_an_answer_of_another_shape_fails_with_a_clear_error(body: bytes, message: str) -> None: + with pytest.raises(ValueError, match=message): + gem.page(_get_of({"JobBoardList": body}, []), "productboard", None) + + +def test_detail_reads_the_text_and_the_date() -> None: + row = {"source_id": "am9icG9zdDq5-IOakBvxHzWhMPnTzoPp"} + asked: list[dict[str, Any]] = [] + found = gem.detail(_get_of({"ExternalJobPosting": _read("gem-detail-2.json")}, asked), + "productboard", row) + assert asked[0]["operationName"] == "ExternalJobPosting" + assert asked[0]["variables"] == {"boardId": "productboard", "extId": row["source_id"]} + assert asked[0]["query"] == gem.DETAIL_QUERY + assert set(found) <= set(ats.DETAIL_FIELDS) + assert found["posted"] == datetime.fromtimestamp(1787574069, tz=UTC) + assert found["description"].startswith("Only the best engineers are being built here.") + assert "<" not in found["description"] and "&" not in found["description"] + + +def test_detail_of_a_role_that_is_not_there_raises() -> None: + body = b'{"data":{"oatsExternalJobPosting":null}}' + with pytest.raises(ValueError, match="no role gone on acme"): + gem.detail(_get_of({"ExternalJobPosting": body}, []), "acme", {"source_id": "gone"}) + + +def test_detail_reads_the_numeric_role_too() -> None: + found = gem.detail(_get_of({"ExternalJobPosting": _read("gem-detail-1.json")}, []), + "productboard", {"source_id": "8080046002"}) + assert found["posted"] == datetime.fromtimestamp(1753349342, tz=UTC) + assert found["description"] + + +def test_the_slug_the_urls_and_the_allow_list() -> None: + assert gem.KEEP_CASE + for slug in ("productboard", "Productboard", "senndertechnologies-gmbh", "a_b", "1"): + assert gem.slug_ok(slug) + assert gem.careers_url("Productboard") == "https://jobs.gem.com/Productboard" + assert gem.robots_page("productboard") == "https://jobs.gem.com/productboard" + allow = gem.allowed("productboard") + assert allow("jobs.gem.com") and allow("JOBS.gem.com") + assert not allow("gem.com") and not allow("productboard.gem.com") + assert not allow("jobs.gem.com.evil.example") and not allow("localhost") + assert atshosts.HOSTS["gem"] is gem and ats.HOSTS["gem"] == "Gem" + + +@pytest.mark.parametrize("slug", [ + "", "a@b", "a#b", "a?b", "..", ".", "a/b", "a%2fb", "a:443", "a b", " a", "a\n", "a\r\n", + "a.b", "127.0.0.1", "[::1]", "localhost.", "a\\b", "a\"b"]) +def test_a_hostile_slug_is_refused(slug: str) -> None: + assert not gem.slug_ok(slug) + assert not ats.is_known_target(f"gem:{slug}") + + +def test_a_local_word_as_a_slug_still_reaches_gems_host_only() -> None: + assert ats.is_known_target("gem:localhost") + allow = gem.allowed("localhost") + assert allow("jobs.gem.com") and not allow("localhost") + + +def test_discovery_finds_the_board_keeping_its_case() -> None: + page = ('Jobs' + 'x' + 'y') + assert [(h, s) for h, s, _ in discover.boards_in(page)] == [ + ("gem", "Productboard"), ("gem", "sennder-gmbh")] + assert "gem" not in {h for h, _ in discover._UNREADABLE if h not in atshosts.HOSTS} From bd4121be912d8c766a435c88739eba55f952759e Mon Sep 17 00:00:00 2001 From: Wolf Date: Tue, 29 Sep 2026 20:08:35 +0200 Subject: [PATCH 4/5] Read Jibe career sites from their jobs API Co-Authored-By: Claude Sonnet 5.5 --- plugins/atshosts/jibe.py | 132 ++++++++++++ tests/fixtures/ats/jibe.json | 403 +++++++++++++++++++++++++++++++++++ tests/test_ats_jibe.py | 173 +++++++++++++++ 3 files changed, 708 insertions(+) create mode 100644 plugins/atshosts/jibe.py create mode 100644 tests/fixtures/ats/jibe.json create mode 100644 tests/test_ats_jibe.py diff --git a/plugins/atshosts/jibe.py b/plugins/atshosts/jibe.py new file mode 100644 index 0000000..b285e6a --- /dev/null +++ b/plugins/atshosts/jibe.py @@ -0,0 +1,132 @@ +"""Jibe (iCIMS Jibe): `jibe:`, the career site's own host name, for +example `jibe:jobs.booking.com`. A JSON API on that host, paged by page number +at 100 roles a page, with the total stated. + +Written from Booking.com's site on 2026-09-29 (145 roles, two pages), the only +Jibe site read. Unverified: that another Jibe site serves `/api/jobs` with the +same parameters and answer, and what one that does not gives. A host that is +not a Jibe site fails as a board that is not a listing. + +`GET /api/jobs?limit=100&page=N` answers `{"jobs": [{"data": {...}}], "totalCount"}` +with each role's full description, so the roles need no `detail`; `limit=200` is +a 422. The findings used `brand=Booking.com`, which is not needed: without it +the site's whole board is read, 145 roles, of which the filter keeps the 97 of +brand "Booking.com" and drops the 48 of brand "Booking Holdings", the parent's +own roles (finance, legal and data teams in Bucharest, listed and applied for +on the same site). The board is read whole, as the site shows it, and `brand` +is not in the target. + +A role's page is `/jobs/` on the host, which redirects to the site's own +path (`/booking/jobs/` on Booking's), so no site's path prefix is built +in. The site's robots.txt asks for `crawl-delay: 5`, which the shared reader +does not honour (`ats.PAGE_DELAY` is 0.5 s); a board is two requests. + +Discovery can name Jibe (a site loads its assets from `jibecdn.com` or applies +on `jibeapply.com`) but not the host, since a Jibe site's own links look like +any other site's, so the host is given by hand. +""" + +from __future__ import annotations + +import html +import json +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 + +NAME = "jibe" +LABEL = "Jibe" +PATTERNS = ( + # No slug: the host is the company's own, which no URL on the page names. + r"jibeapply\.com|jibecdn\.com/prod", +) + +#: The page size asked for, which is also the most the host serves (200 is a 422). +PAGE_SIZE = 100 + +#: A whole host name (two labels or more, the last one letters), so neither an +#: address (`127.0.0.1`), a bare word (`localhost`) nor a port names a site. +#: `ats._get` refuses every host but this one, redirects included, and a local +#: name or an address in any case. +_HOST = re.compile(r"[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*\.[a-z]{2,}") + + +#: Names a private network uses, never a company's career site; `ats._get` +#: refuses them too, and a slug that names one is not a board at all. +_LOCAL = (".localhost", ".local", ".internal", ".lan", ".home.arpa") + + +def slug_ok(slug: str) -> bool: + host = slug.lower() + return bool(_HOST.fullmatch(host)) and not host.endswith(_LOCAL) + + +def allowed(slug: str) -> Callable[[str], bool]: + return only(slug) + + +def careers_url(slug: str) -> str: + return f"https://{slug.lower()}/jobs" + + +def robots_page(slug: str) -> str: + return careers_url(slug) + + +def page(get: Get, slug: str, cursor: Any) -> Page: + """One page of `/api/jobs`; the next is the following number, and an empty + page ends the read.""" + number = int(cursor or 1) + data = json.loads(get(f"https://{slug.lower()}/api/jobs?limit={PAGE_SIZE}&page={number}")) + jobs = data.get("jobs") if isinstance(data, dict) else None + if not isinstance(jobs, list): + raise ValueError("not a Jibe listing: no jobs list") + total = data.get("totalCount") + results = [{"id": (j.get("data") or {}).get("slug") or ""} for j in jobs] + return data, results, total if isinstance(total, int) else None, \ + number + 1 if jobs else None + + +def parse(body: bytes, slug: str) -> list[Row]: + return rows(json.loads(body), slug) + + +def _plain(markup: Any) -> str: + return " ".join(html.unescape(strip_html(str(markup or ""))).split()) + + +def rows(data: dict[str, Any], slug: str) -> list[Row]: + """One page: each `jobs[].data` has `slug` (equal to `req_id`), `title`, + the HTML `description` and, on some, `qualifications`, `full_location` + ("Amsterdam, Netherlands; Manchester, United Kingdom" for several), + `city` and `country`, `categories`, `posted_date` and `apply_url`, on the + iCIMS site. The `salary_*` fields were 0 on every role and there is no + currency, so no pay is read; nothing says remote (`location_type` is a + kind of coordinates).""" + out = [] + for job in data.get("jobs") or []: + j = job.get("data") or {} + title = (j.get("title") or "").strip() + role = str(j.get("slug") or j.get("req_id") or "") + if not title or not role: + continue + categories = j.get("categories") or [] + text = "\n\n".join(p for p in (_plain(j.get("description")), + _plain(j.get("qualifications"))) if p) + out.append({ + "source_id": role, + "title": title, + "location": (j.get("full_location") + or ", ".join(p for p in (j.get("city"), j.get("country")) if p)).strip(), + "url": f"https://{slug.lower()}/jobs/{role}", + "posted": parse_dt(j.get("posted_date")), + "department": str((categories[0] if categories else {}).get("name") or "").strip(), + "description": text, + "remote": None, + "salary_text": "", + }) + return out diff --git a/tests/fixtures/ats/jibe.json b/tests/fixtures/ats/jibe.json new file mode 100644 index 0000000..d6dbae1 --- /dev/null +++ b/tests/fixtures/ats/jibe.json @@ -0,0 +1,403 @@ +{ + "jobs": [ + { + "data": { + "slug": "30413", + "language": "en-us", + "languages": [ + "en-us" + ], + "client_code": "workingatbooking", + "req_id": "30413", + "title": "Booking Holdings Romania - Team Leader Regulatory Data Releases (2 years contract - maternity cover)", + "description": "

            Booking Holdings Romania is a Center of Excellence based in Bucharest, Romania and was created to support the increasing business demands of the Booking Holdings Brands. The Center of Excellence provides access to specialized and highly skilled talent, leading industry best practices, and collaboration opportunities across all of our Brands.

            As part of our Booking Holdings Romania team, you will have the opportunity to be a part of the world’s leading provider of online travel, with a mission of making it easier for everyone to experience the world through five-primary consumer facing brands: Booking.com, Priceline, Agoda, KAYAK and OpenTable.

             

             

            This role provides a hybrid way of working with an onsite presence of 2 days/week.

             

             

            Role description

             

            The Team Lead - DSR proactively identifies, manages, and mitigates privacy risks across the organization. This role supports and develops their team to drive operational excellence, innovation, and adaptability in a constantly evolving regulatory landscape, while elevating the business's overall privacy maturity to the next level.

             

            ", + "location_name": "Bucharest - BH", + "street_address": "U-Center (3rd floor) 206 Calea Șerban Vodă, district 4,", + "city": "Bucharest", + "state": "Bucureşti", + "country": "Romania", + "country_code": "RO", + "postal_code": "040215", + "location_type": "LAT_LNG", + "latitude": 44.43225, + "longitude": 26.10626, + "categories": [ + { + "name": "Legal & Public Affairs" + } + ], + "tags1": [ + "Booking Holdings COE Company Hierarchy" + ], + "brand": "Booking Holdings", + "department": "", + "recruiter_gateway_id": "104", + "salary_value": 0, + "salary_min_value": 0, + "salary_max_value": 0, + "employment_type": "FULL_TIME", + "hiring_organization": "Booking Holdings", + "hiring_organization_logo": "https://www.bookingholdings.com/wp-content/themes/booking-group/img/svg/bkng_global-desktop-logowhite.svg", + "source": "Booking Holdings", + "posted_date": "2026-09-29T12:55:00+0000", + "apply_url": "https://careers-holdings-workingatbooking.icims.com/jobs/30413/login", + "internal": false, + "external": false, + "searchable": true, + "applyable": true, + "li_easy_applyable": true, + "ats_code": "icims", + "hiring_flow_name": "iCIMS ATS Hiring Flow", + "isFrontLineAIJob": false, + "isApplyFlowJob": false, + "update_date": "2026-09-29T13:10:15+0000", + "create_date": "2026-09-29T12:57:13+0000", + "category": [ + " Legal & Public Affairs" + ], + "full_location": "Bucharest, Romania", + "short_location": "Bucharest, Romania", + "multipleLocations": false + } + }, + { + "data": { + "slug": "30262", + "language": "en-us", + "languages": [ + "en-us" + ], + "client_code": "workingatbooking", + "req_id": "30262", + "title": "Treasury Risk Specialist", + "description": "

            About Booking Holdings 

            Booking Holdings (NASDAQ:BKNG) is the world's leading provider of online travel and related services, provided to consumers and local partners in more than 220 countries and territories through five primary consumer-facing brands: Booking.com, Priceline, Agoda, KAYAK and OpenTable. The mission of Booking Holdings is to make it easier for everyone to experience the world. For more information, visit BookingHoldings.com and follow us on X (formerly known as Twitter) @BookingHoldings. 

             

            The Role: Booking Holdings BV’s global treasury team is looking for a Treasury risk management professional to join our growing team. The Treasury Risk Specialist is responsible for performing financial analysis and operating processes relating to the identification, quantification, management and reporting of credit, counterparty, liquidity and other Treasury risk typologies that attach to Booking’s evolving business models, strategic initiatives and third party relationships.  

            ", + "location_name": "Amsterdam BH", + "street_address": "Oosterdokskade 163", + "city": "Amsterdam", + "state": "North Holland", + "country": "Netherlands", + "country_code": "NL", + "postal_code": "1011 DL", + "location_type": "LAT_LNG", + "latitude": 52.37403, + "longitude": 4.88969, + "categories": [ + { + "name": "Finance" + } + ], + "tags1": [ + "Booking Holdings Company Hierarchy" + ], + "brand": "Booking.com", + "department": "", + "recruiter_gateway_id": "103", + "salary_value": 0, + "salary_min_value": 0, + "salary_max_value": 0, + "employment_type": "FULL_TIME", + "hiring_organization": "Booking.com", + "hiring_organization_logo": "https://www.google.com/imgres?imgurl=https%3A%2F%2Fcdn.worldvectorlogo.com%2Flogos%2Fbookingcom-1.svg&tbnid=aYVSXTru4-zj2M&vet=12ahUKEwjpxpKWs7CCAxXtKt4AHa19CdkQMygEegQIARBw..i&imgrefurl=https%3A%2F%2Fworldvectorlogo.com%2Flogo%2Fbookingcom-1&docid=8rsjzthSju2GyM&w=2500&h=2445&q=booking.com%20logo&ved=2ahUKEwjpxpKWs7CCAxXtKt4AHa19CdkQMygEegQIARBw", + "source": "Booking.com", + "posted_date": "2026-09-29T12:50:00+0000", + "apply_url": "https://external-workingatbooking.icims.com/jobs/30262/login", + "internal": false, + "external": false, + "searchable": true, + "applyable": true, + "li_easy_applyable": true, + "ats_code": "icims", + "hiring_flow_name": "iCIMS ATS Hiring Flow", + "isFrontLineAIJob": false, + "isApplyFlowJob": false, + "update_date": "2026-09-29T12:54:14+0000", + "create_date": "2026-09-29T12:51:12+0000", + "category": [ + " Finance" + ], + "full_location": "Amsterdam, Netherlands", + "short_location": "Amsterdam, Netherlands", + "multipleLocations": false + } + }, + { + "data": { + "slug": "30320", + "language": "en-us", + "languages": [ + "en-us" + ], + "client_code": "workingatbooking", + "req_id": "30320", + "title": "Data Analytics Engineer I - Treasury Data Science & Analytics", + "description": "

            About Booking Holdings 

            Booking Holdings (NASDAQ:BKNG) is the world's leading provider of online travel and related services, provided to consumers and local partners in more than 220 countries and territories through five primary consumer-facing brands: Booking.com, Priceline, Agoda, KAYAK and OpenTable. The mission of Booking Holdings is to make it easier for everyone to experience the world. For more information, visit BookingHoldings.com and follow us on X (formerly known as Twitter) @BookingHoldings. 

            About the team:

            The Treasury Data Science & Analytics team develops trusted, scalable and reusable analytical products that enable cash flow forecasting, liquidity optimization, risk modelling, reporting and self-service analytics for the Booking Holdings Group Treasury team. 

            ", + "location_name": "Amsterdam BH", + "street_address": "Oosterdokskade 163", + "city": "Amsterdam", + "state": "North Holland", + "country": "Netherlands", + "country_code": "NL", + "postal_code": "1011 DL", + "location_type": "LAT_LNG", + "latitude": 52.37403, + "longitude": 4.88969, + "categories": [ + { + "name": "Finance" + } + ], + "tags1": [ + "Booking Holdings Company Hierarchy" + ], + "brand": "Booking.com", + "department": "", + "recruiter_gateway_id": "103", + "salary_value": 0, + "salary_min_value": 0, + "salary_max_value": 0, + "employment_type": "FULL_TIME", + "hiring_organization": "Booking.com", + "hiring_organization_logo": "https://www.google.com/imgres?imgurl=https%3A%2F%2Fcdn.worldvectorlogo.com%2Flogos%2Fbookingcom-1.svg&tbnid=aYVSXTru4-zj2M&vet=12ahUKEwjpxpKWs7CCAxXtKt4AHa19CdkQMygEegQIARBw..i&imgrefurl=https%3A%2F%2Fworldvectorlogo.com%2Flogo%2Fbookingcom-1&docid=8rsjzthSju2GyM&w=2500&h=2445&q=booking.com%20logo&ved=2ahUKEwjpxpKWs7CCAxXtKt4AHa19CdkQMygEegQIARBw", + "source": "Booking.com", + "posted_date": "2026-09-29T12:39:00+0000", + "apply_url": "https://external-workingatbooking.icims.com/jobs/30320/login", + "internal": false, + "external": false, + "searchable": true, + "applyable": true, + "li_easy_applyable": true, + "ats_code": "icims", + "hiring_flow_name": "iCIMS ATS Hiring Flow", + "isFrontLineAIJob": false, + "isApplyFlowJob": false, + "update_date": "2026-09-29T13:00:13+0000", + "create_date": "2026-09-29T12:40:11+0000", + "category": [ + " Finance" + ], + "full_location": "Amsterdam, Netherlands", + "short_location": "Amsterdam, Netherlands", + "multipleLocations": false + } + }, + { + "data": { + "slug": "30204", + "language": "en-us", + "languages": [ + "en-us" + ], + "client_code": "workingatbooking", + "req_id": "30204", + "title": "Senior Director Engineering - Connected Trip Experience & Data", + "description": "

            About Marketplace

            Booking.com's Marketplace unit turns travel goals into travel realities. Our purpose? To create frictionless experiences at each and every stage of the trip. From browsing to booking and beyond, our focus is on building the connected experiences which make journeys smoother, faster and more enjoyable. Think of us as travel matchmakers, ensuring seamless integration across our product verticals to effortlessly and intuitively connect traveler preferences and actions.

             

            ", + "location_name": "Amsterdam Campus", + "street_address": "Oosterdokskade 163,", + "city": "Amsterdam", + "state": "North Holland", + "country": "Netherlands", + "country_code": "NL", + "postal_code": "1011 DL", + "location_type": "LAT_LNG", + "latitude": 52.37403, + "longitude": 4.88969, + "additional_locations": [ + { + "location_name": "Manchester Campus (non-Transport)", + "street_address": "The Goods Yard Building 6 Goods Yard Street", + "city": "Manchester", + "state": "Greater Manchester", + "country": "United Kingdom", + "country_code": "GB", + "postal_code": "M3 3BG", + "latitude": 53.48095, + "longitude": -2.23743 + } + ], + "categories": [ + { + "name": "Leadership" + } + ], + "tags1": [ + "Booking.com Company Hierarchy" + ], + "brand": "Booking.com", + "department": "", + "recruiter_gateway_id": "103", + "salary_value": 0, + "salary_min_value": 0, + "salary_max_value": 0, + "employment_type": "FULL_TIME", + "hiring_organization": "Booking.com", + "hiring_organization_logo": "https://www.google.com/imgres?imgurl=https%3A%2F%2Fcdn.worldvectorlogo.com%2Flogos%2Fbookingcom-1.svg&tbnid=aYVSXTru4-zj2M&vet=12ahUKEwjpxpKWs7CCAxXtKt4AHa19CdkQMygEegQIARBw..i&imgrefurl=https%3A%2F%2Fworldvectorlogo.com%2Flogo%2Fbookingcom-1&docid=8rsjzthSju2GyM&w=2500&h=2445&q=booking.com%20logo&ved=2ahUKEwjpxpKWs7CCAxXtKt4AHa19CdkQMygEegQIARBw", + "source": "Booking.com", + "posted_date": "2026-09-10T13:46:00+0000", + "apply_url": "https://external-workingatbooking.icims.com/jobs/30204/login", + "internal": false, + "external": false, + "searchable": true, + "applyable": true, + "li_easy_applyable": true, + "ats_code": "icims", + "hiring_flow_name": "iCIMS ATS Hiring Flow", + "isFrontLineAIJob": false, + "isApplyFlowJob": false, + "update_date": "2026-09-21T18:17:45+0000", + "create_date": "2026-09-10T13:49:45+0000", + "category": [ + " Leadership" + ], + "full_location": "Amsterdam, Netherlands; Manchester, United Kingdom", + "short_location": "Amsterdam, Netherlands", + "multipleLocations": true + } + }, + { + "data": { + "slug": "30222", + "language": "en-us", + "languages": [ + "en-us" + ], + "client_code": "workingatbooking", + "req_id": "30222", + "title": "Key Account Manager", + "description": "

            About Us: At Booking.com, data drives our decisions. Technology is at our core. And innovation is everywhere. But our company is more than datasets, lines of code or A/B tests. We’re the thrill of the first night in a new place. The excitement of the next morning. The friends you encounter. The journeys you take. The sights you see. And the memories you make. Through our products, partners and people, we make it easier for everyone to experience the world.

             

            Role Description:

            ", + "location_name": "Osaka", + "street_address": "WeWork LINKS UMEDA Office number 08-103 1-1 Ofukacho Kita-Ku", + "city": "Osaka", + "state": "Osaka", + "country": "Japan", + "country_code": "JP", + "postal_code": "530-0011", + "location_type": "LAT_LNG", + "latitude": 34.7043, + "longitude": 135.4955, + "additional_locations": [ + { + "location_name": "Tokyo", + "street_address": "Shibuya Scramble Square 38F, 2-24-12 Shibuya", + "city": "Tokyo", + "state": "Tokyo", + "country": "Japan", + "country_code": "JP", + "postal_code": "150-6138", + "latitude": 35.68113, + "longitude": 139.76706 + } + ], + "categories": [ + { + "name": "Business Development & Support" + } + ], + "tags1": [ + "Booking.com Company Hierarchy" + ], + "brand": "Booking.com", + "department": "", + "recruiter_gateway_id": "103", + "salary_value": 0, + "salary_min_value": 0, + "salary_max_value": 0, + "employment_type": "FULL_TIME", + "hiring_organization": "Booking.com", + "hiring_organization_logo": "https://www.google.com/imgres?imgurl=https%3A%2F%2Fcdn.worldvectorlogo.com%2Flogos%2Fbookingcom-1.svg&tbnid=aYVSXTru4-zj2M&vet=12ahUKEwjpxpKWs7CCAxXtKt4AHa19CdkQMygEegQIARBw..i&imgrefurl=https%3A%2F%2Fworldvectorlogo.com%2Flogo%2Fbookingcom-1&docid=8rsjzthSju2GyM&w=2500&h=2445&q=booking.com%20logo&ved=2ahUKEwjpxpKWs7CCAxXtKt4AHa19CdkQMygEegQIARBw", + "source": "Booking.com", + "posted_date": "2026-09-10T03:32:00+0000", + "posting_expiry_date": "2026-10-30T16:00:00+0000", + "apply_url": "https://external-workingatbooking.icims.com/jobs/30222/login", + "internal": false, + "external": false, + "searchable": true, + "applyable": true, + "li_easy_applyable": true, + "ats_code": "icims", + "hiring_flow_name": "iCIMS ATS Hiring Flow", + "isFrontLineAIJob": false, + "isApplyFlowJob": false, + "update_date": "2026-09-11T13:03:47+0000", + "create_date": "2026-09-10T03:38:45+0000", + "category": [ + " Business Development & Support" + ], + "full_location": "Osaka, Japan; Tokyo, Japan", + "short_location": "Osaka, Japan", + "multipleLocations": true + } + }, + { + "data": { + "slug": "13402", + "language": "en-us", + "languages": [ + "en-us" + ], + "client_code": "workingatbooking", + "req_id": "13402", + "title": "Full Stack Software Engineer II", + "description": "

            At Booking.com, data drives our decisions. Technology is at our core. And innovation is everywhere. But our company is more than datasets, lines of code or A/B tests. We’re the thrill of the first night in a new place. The excitement of the next morning. The friends you make. The journeys you take. The sights you see. And the food you sample. Through our products, partners and people, we can empower everyone to experience the world.

            We’re a truly global e-commerce company, with business operations in nearly every country and city on the planet. And we want to make it easy for everyone, anywhere in the world, to pay for their travel or do business with our platform – whenever and however it’s convenient for them.

            ", + "location_name": "Amsterdam Campus", + "street_address": "Oosterdokskade 163,", + "city": "Amsterdam", + "state": "North Holland", + "country": "Netherlands", + "country_code": "NL", + "postal_code": "1011 DL", + "location_type": "LAT_LNG", + "latitude": 52.37403, + "longitude": 4.88969, + "categories": [ + { + "name": "Engineering" + } + ], + "tags1": [ + "Booking.com Company Hierarchy" + ], + "brand": "Booking.com", + "department": "", + "recruiter_gateway_id": "103", + "salary_value": 0, + "salary_min_value": 0, + "salary_max_value": 0, + "employment_type": "FULL_TIME", + "qualifications": "

            Java 

            Python

            Javascript

            React
            ReactJS

            ", + "hiring_organization": "Booking.com", + "hiring_organization_logo": "https://www.google.com/imgres?imgurl=https%3A%2F%2Fcdn.worldvectorlogo.com%2Flogos%2Fbookingcom-1.svg&tbnid=aYVSXTru4-zj2M&vet=12ahUKEwjpxpKWs7CCAxXtKt4AHa19CdkQMygEegQIARBw..i&imgrefurl=https%3A%2F%2Fworldvectorlogo.com%2Flogo%2Fbookingcom-1&docid=8rsjzthSju2GyM&w=2500&h=2445&q=booking.com%20logo&ved=2ahUKEwjpxpKWs7CCAxXtKt4AHa19CdkQMygEegQIARBw", + "source": "Booking.com", + "posted_date": "2026-09-23T14:16:00+0000", + "apply_url": "https://external-workingatbooking.icims.com/jobs/13402/login", + "internal": false, + "external": false, + "searchable": true, + "applyable": true, + "li_easy_applyable": true, + "ats_code": "icims", + "hiring_flow_name": "iCIMS ATS Hiring Flow", + "isFrontLineAIJob": false, + "isApplyFlowJob": false, + "update_date": "2026-09-24T10:08:45+0000", + "create_date": "2026-09-23T14:27:43+0000", + "category": [ + " Engineering" + ], + "full_location": "Amsterdam, Netherlands", + "short_location": "Amsterdam, Netherlands", + "multipleLocations": false + } + } + ], + "locations": [], + "totalCount": 145, + "request_id": false, + "meta_data": false, + "count": 145, + "languageCounts": { + "en-us": { + "displayName": "English", + "count": 145 + } + } +} \ No newline at end of file diff --git a/tests/test_ats_jibe.py b/tests/test_ats_jibe.py new file mode 100644 index 0000000..0d91086 --- /dev/null +++ b/tests/test_ats_jibe.py @@ -0,0 +1,173 @@ +"""The Jibe host module against a saved page of Booking.com's listing (six of +its 145 roles, descriptions cut). No network.""" + +from __future__ import annotations + +import json +import sys +from datetime import UTC, datetime +from pathlib import Path +from typing import Any + +import httpx +import pytest + +ROOT = Path(__file__).resolve().parents[1] +if str(ROOT) not in sys.path: + sys.path.insert(0, str(ROOT)) + +from app.jobs import discover # noqa: E402 +from plugins import ats, atshosts # noqa: E402 +from plugins.atshosts import jibe # noqa: E402 + +FIXTURES = ROOT / "tests" / "fixtures" / "ats" +SITE = "jobs.booking.com" + + +def _saved() -> dict[str, Any]: + return json.loads((FIXTURES / "jibe.json").read_text()) + + +def _board(total: int) -> dict[int, dict[str, Any]]: + """`total` roles as the site pages them: 100 to a page, the saved roles + repeated under new slugs.""" + template = _saved()["jobs"] + jobs = [] + for n in range(total): + data = dict(template[n % len(template)]["data"]) | {"slug": str(1000 + n)} + jobs.append({"data": data}) + return {page + 1: {"jobs": jobs[start:start + 100], "totalCount": total} + for page, start in enumerate(range(0, total, 100))} + + +def test_a_page_becomes_rows() -> None: + rows = jibe.rows(_saved(), SITE) + assert [r["source_id"] for r in rows] == ["30413", "30262", "30320", "30204", "30222", + "13402"] + first, several = rows[0], rows[3] + assert first["title"].startswith("Booking Holdings Romania - Team Leader") + assert first["url"] == "https://jobs.booking.com/jobs/30413" + assert first["location"] == "Bucharest, Romania" + assert first["department"] == "Legal & Public Affairs" + assert first["posted"] == datetime(2026, 9, 29, 12, 55, tzinfo=UTC) + assert (first["remote"], first["salary_text"]) == (None, "") + assert several["location"] == "Amsterdam, Netherlands; Manchester, United Kingdom" + assert all(r["description"] and "<" not in r["description"] and " " not in r["description"] + for r in rows) + + +def test_qualifications_follow_the_description() -> None: + text = jibe.rows(_saved(), SITE)[-1]["description"] + assert "\n\n" in text and text.split("\n\n")[-1].startswith("Java") + + +def test_the_location_falls_back_to_city_and_country() -> None: + role = {"slug": "1", "title": "Role", "city": "Riga", "country": "Latvia"} + assert jibe.rows({"jobs": [{"data": role}]}, SITE)[0]["location"] == "Riga, Latvia" + + +def test_a_role_without_a_title_or_a_slug_is_left_out() -> None: + jobs = [{"data": {"slug": "1", "title": " "}}, {"data": {"title": "Role"}}, {}] + assert jibe.rows({"jobs": jobs}, SITE) == [] + + +def test_a_page_states_its_total_and_the_cursor_is_the_next_number() -> None: + asked: list[str] = [] + board = _board(145) + + def get(url: str, **_: Any) -> bytes: + asked.append(url) + return json.dumps(board[int(url.rsplit("=", 1)[1])]).encode() + + decoded, results, total, cursor = jibe.page(get, SITE, None) + assert asked == ["https://jobs.booking.com/api/jobs?limit=100&page=1"] + assert (len(results), total, cursor) == (100, 145, 2) + assert len(jibe.rows(decoded, SITE)) == 100 + assert jibe.page(get, SITE, 2)[2:] == (145, 3) + assert asked[-1].endswith("&page=2") + + +def test_the_board_is_read_to_its_total_through_the_app(monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.setattr(ats, "PAGE_DELAY", 0) + board = _board(145) + seen: list[str] = [] + + def handler(request: httpx.Request) -> httpx.Response: + seen.append(str(request.url)) + return httpx.Response(200, json=board[int(request.url.params["page"])]) + + with httpx.Client(transport=httpx.MockTransport(handler)) as client: + rows, complete = ats._fetch_rows(client, f"jibe:{SITE}") + assert (len(rows), complete) == (145, True) + assert seen == [f"https://jobs.booking.com/api/jobs?limit=100&page={n}" for n in (1, 2)] + + +def test_a_board_that_ends_short_of_its_total_is_incomplete( + monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.setattr(ats, "PAGE_DELAY", 0) + board = _board(145) + board[2]["totalCount"] = board[1]["totalCount"] = 150 # five roles the site never sends + board[3] = {"jobs": [], "totalCount": 150} + + def handler(request: httpx.Request) -> httpx.Response: + return httpx.Response(200, json=board[int(request.url.params["page"])]) + + with httpx.Client(transport=httpx.MockTransport(handler)) as client: + rows, complete = ats._fetch_rows(client, f"jibe:{SITE}") + assert (len(rows), complete) == (145, False) + + +def test_an_empty_board_is_complete_at_zero() -> None: + body = {"jobs": [], "totalCount": 0} + with httpx.Client(transport=httpx.MockTransport( + lambda request: httpx.Response(200, json=body))) as client: + assert ats._fetch_rows(client, f"jibe:{SITE}") == ([], True) + + +@pytest.mark.parametrize("body", [b"Not found", b"[]", b'{"jobs": null}', + b'{"error": "no"}']) +def test_an_answer_that_is_not_a_listing_raises(body: bytes) -> None: + with pytest.raises(ValueError): + jibe.page(lambda url, **_: body, SITE, None) + + +def test_a_422_and_a_429_reach_the_shared_code_as_status_errors() -> None: + """A module lets them through: 429 after the first page ends the read.""" + request = httpx.Request("GET", f"https://{SITE}/api/jobs") + + def get(url: str, **_: Any) -> bytes: + raise httpx.HTTPStatusError("422", request=request, + response=httpx.Response(422, request=request)) + + with pytest.raises(httpx.HTTPStatusError): + jibe.page(get, SITE, None) + + +def test_the_slug_the_urls_and_the_allow_list() -> None: + for slug in (SITE, "Jobs.Booking.com", "careers.acme.co.uk", "acme.com", "a-b.c-d.example"): + assert jibe.slug_ok(slug) and ats.is_known_target(f"jibe:{slug}") + assert jibe.careers_url("Jobs.Booking.com") == "https://jobs.booking.com/jobs" + assert jibe.robots_page(SITE) == "https://jobs.booking.com/jobs" + allow = jibe.allowed("Jobs.Booking.com") + assert allow("jobs.booking.com") and allow("JOBS.BOOKING.COM") + assert not allow("booking.com") and not allow("evil.example") + assert not allow("jobs.booking.com.evil.example") and not allow("localhost") + assert atshosts.HOSTS["jibe"] is jibe and ats.HOSTS["jibe"] == "Jibe" + + +@pytest.mark.parametrize("slug", [ + "", "booking", "localhost", "a@b.com", "a.com#x", "a.com?x", "..", "a.com/x", "a.com%2fx", + "a.com:443", "a.com:8443", " a.com", "a.com ", "a.com\n", "a.com\r\n", "127.0.0.1", + "2130706433", "[::1]", "0x7f.0x0.0x0.0x1", "a.b", "-a.com", "a-.com", "a..com", "a.com.", + "app.localhost", "printer.local", "meta.internal", "nas.home.arpa", "router.lan", + "user@jobs.booking.com", "a_b.com", "évil.com"]) +def test_a_hostile_slug_is_refused(slug: str) -> None: + assert not jibe.slug_ok(slug) + assert not ats.is_known_target(f"jibe:{slug}") + + +def test_discovery_names_jibe_from_its_assets_but_gives_no_host() -> None: + page = ('' + 'apply') + assert [(h, s) for h, s, _ in discover.boards_in(page)] == [("jibe", "")] + assert "jibe" not in {h for h, _ in discover._UNREADABLE} From 85bfe62fec8b538f43ff0f13b8987677d6ed9d20 Mon Sep 17 00:00:00 2001 From: Wolf Date: Tue, 29 Sep 2026 20:11:18 +0200 Subject: [PATCH 5/5] Read Eightfold career sites through the PCSX search Co-Authored-By: Claude Sonnet 5.5 --- plugins/atshosts/eightfold.py | 169 ++++++++++++++++++++ tests/fixtures/ats/eightfold-detail.json | 41 +++++ tests/fixtures/ats/eightfold.json | 145 +++++++++++++++++ tests/test_ats_eightfold.py | 195 +++++++++++++++++++++++ 4 files changed, 550 insertions(+) create mode 100644 plugins/atshosts/eightfold.py create mode 100644 tests/fixtures/ats/eightfold-detail.json create mode 100644 tests/fixtures/ats/eightfold.json create mode 100644 tests/test_ats_eightfold.py diff --git a/plugins/atshosts/eightfold.py b/plugins/atshosts/eightfold.py new file mode 100644 index 0000000..de23555 --- /dev/null +++ b/plugins/atshosts/eightfold.py @@ -0,0 +1,169 @@ +"""Eightfold: `eightfold:/`, for example +`eightfold:infineon.eightfold.ai/infineon.com` or, for a career site on the +company's own host, `eightfold:jobs.ericsson.com/ericsson.com`. The public +PCSX search, paged by offset at ten roles a page with the total stated, and a +role's text on its own request. + +Written from Ericsson's site on 2026-09-29 (637 roles), with Infineon's and +Microsoft's read the same day in the findings. Unverified on a tenant other +than those three: that the search takes the same parameters and answers with +the same fields. + +The `domain` is the tenant's own name for the company, usually the company's +domain, and it is not the host: the site's page carries it as `domain=` in its +links. `/api/apply/v2/jobs` answers 403 "Not authorized for PCSX" on the sites +tried, so it is not used. + +The search ignores `num` and answers ten roles a page, so a board costs one +request per ten roles, and `ats.MAX_PAGES` (100) stops a read at 1,000 roles: a +larger board (Infineon's 1,292, Microsoft's 2,319) is read incomplete every pull, +and an incomplete read never closes the roles it did not list. The rows are +sorted newest first (`sort_by=timestamp`) so that what the cap keeps is the +newest thousand and the pages do not shuffle between two requests, unlike the +default order, which puts hot roles first. The search does take a `location` +free text (Ericsson's "Sweden" found 157 of 637), which could bring a read +under the cap, but a target names no filter and none is built here. + +Discovery names Eightfold from an `eightfold.ai` link, and the host and the +domain from one that carries `domain=`. +""" + +from __future__ import annotations + +import html +import json +import re +from collections.abc import Callable +from typing import Any + +from desk.sources import strip_html + +from ._shared import Get, Page, Row, is_web_url, only, parse_dt + +NAME = "eightfold" +LABEL = "Eightfold" +PATTERNS = ( + # Both parts, from a link to a tenant's site that says its domain. + r"https?://([a-z0-9-]+\.eightfold\.ai)/[^\s\"'<>]*?[?&]domain=([a-z0-9.-]+\.[a-z]{2,})", + # No slug: a link to a tenant's site that does not. + r"[a-z0-9-]+\.eightfold\.ai", +) + +#: A whole host name: two labels or more, the last one letters, so neither an +#: address, a bare word nor a port names a site. `ats._get` refuses every host +#: but the tenant's, redirects included. +_NAME = re.compile(r"[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*\.[a-z]{2,}") + +#: Names a private network uses, never a company's career site. +_LOCAL = (".localhost", ".local", ".internal", ".lan", ".home.arpa") + +#: `workLocationOption` -> `store._remote`'s words. Only "onsite" and "hybrid" +#: were seen; the other spellings are the obvious ones. +_REMOTE = {"onsite": "onsite", "on_site": "onsite", "hybrid": "hybrid", "remote": "remote"} + + +def parts(slug: str) -> tuple[str, str]: + """`(host, domain)` of a slug, lowercased.""" + host, _, domain = slug.lower().partition("/") + return host, domain + + +def _name_ok(name: str) -> bool: + return bool(_NAME.fullmatch(name)) and not name.endswith(_LOCAL) + + +def slug_ok(slug: str) -> bool: + host, sep, domain = slug.lower().partition("/") + return bool(sep) and _name_ok(host) and _name_ok(domain) + + +def allowed(slug: str) -> Callable[[str], bool]: + return only(parts(slug)[0]) + + +def careers_url(slug: str) -> str: + return f"https://{parts(slug)[0]}/careers" + + +def robots_page(slug: str) -> str: + return careers_url(slug) + + +def page(get: Get, slug: str, cursor: Any) -> Page: + """One page of `/api/pcsx/search` -> `{"status": 200, "data": {"positions": + [...], "count": n}}`; the next starts at the offset after this page's + positions, and an empty page ends the read.""" + host, domain = parts(slug) + start = int(cursor or 0) + answer = json.loads(get(f"https://{host}/api/pcsx/search?domain={domain}" + f"&sort_by=timestamp&start={start}")) + data = answer.get("data") if isinstance(answer, dict) else None + positions = data.get("positions") if isinstance(data, dict) else None + if not isinstance(positions, list): + raise ValueError("not an Eightfold search answer: no data.positions" + + (f" (status {answer.get('status')})" if isinstance(answer, dict) else "")) + count = data.get("count") + results = [{"id": str(p.get("id") or "")} for p in positions] + return (positions, results, count if isinstance(count, int) else None, + start + len(positions) if positions else None) + + +def _place(locations: Any) -> str: + """The role's places, "; " apart. Eightfold writes each as "city,region, + country" with no space and repeats the name when a city is its own region + ("Mexico City,Mexico City,Mexico"), so the repeats go.""" + out: list[str] = [] + for loc in locations if isinstance(locations, list) else []: + names: list[str] = [] + for name in str(loc).split(","): + name = name.strip() + if name and name not in names: + names.append(name) + if names and ", ".join(names) not in out: + out.append(", ".join(names)) + return "; ".join(out) + + +def rows(positions: list[dict[str, Any]], slug: str) -> list[Row]: + """A position has `id` (a number, kept as a string), `displayJobId`, + `name`, `locations`, `postedTs` (epoch seconds), `department`, + `workLocationOption` and `positionUrl`, the path of the role's page on the + tenant's host. The list has no text, and no pay is stated anywhere.""" + host = parts(slug)[0] + out = [] + for p in positions: + title = (p.get("name") or "").strip() + source_id = str(p.get("id") or "") + path = str(p.get("positionUrl") or "").strip() + url = f"https://{host}{path}" if path.startswith("/") and path[1:2] != "/" else "" + if not title or not source_id or not is_web_url(url): + continue + out.append({ + "source_id": source_id, + "title": title, + "location": _place(p.get("locations") or p.get("standardizedLocations")), + "url": url, + "posted": parse_dt(p.get("postedTs")), + "department": str(p.get("department") or "").strip(), + "description": "", + "remote": _REMOTE.get(str(p.get("workLocationOption") or "").strip().lower()), + "salary_text": "", + }) + return out + + +def detail(get: Get, slug: str, row: Row) -> dict[str, Any]: + """`/api/pcsx/position_details` of the role -> `data.jobDescription`, the + HTML text of the ad. The same answer repeats the listing's fields, and + `publicUrl`, none of which is needed.""" + host, domain = parts(slug) + role = str(row["source_id"]) + if not role.isdigit(): + raise ValueError(f"not an Eightfold position id: {role!r}") + answer = json.loads(get(f"https://{host}/api/pcsx/position_details" + f"?position_id={role}&domain={domain}&hl=en")) + data = answer.get("data") if isinstance(answer, dict) else None + if not isinstance(data, dict) or "jobDescription" not in data: + raise ValueError("not an Eightfold position: no data.jobDescription") + text = html.unescape(strip_html(data["jobDescription"] or "")) + return {"description": " ".join(text.split())} diff --git a/tests/fixtures/ats/eightfold-detail.json b/tests/fixtures/ats/eightfold-detail.json new file mode 100644 index 0000000..c9d3f44 --- /dev/null +++ b/tests/fixtures/ats/eightfold-detail.json @@ -0,0 +1,41 @@ +{ + "status": 200, + "error": { + "message": "", + "body": "" + }, + "data": { + "id": 563121777283313, + "displayJobId": "791521", + "name": "Sr. Demand and S&OP Manager", + "locations": [ + "Plano,Texas,United States", + "Boise,Idaho,United States" + ], + "standardizedLocations": [ + "Plano, TX, US", + "Boise, ID, US" + ], + "postedTs": 1790365020, + "stars": 0, + "department": "83 Supply & Logistics", + "creationTs": 1789917546, + "jobDescription": "

            Join our Team

            \r

            About this opportunity:

             

            • Job Locations: Plano, TX or Boise, ID
            • Ericsson Enterprise Wireless Solutions Inc. does not sponsor U.S work authorizations for this job positionincluding U.S. immigration filings for initial and/or change of employer paperwork for H-1’s, H-1B1’s, E-3’s, O-1’s, and TN’s. Ericsson also does not hire F-1’s working on CPT or EAD for this position. 

             

            Ericsson Enterprise Wireless Solutions is a team of authentic, hard-working, and innovative peopledriven by a shared vision to Connect Beyond the limits of wired networks. We help customers —big and small, across industries and around the world — utilize LTE and 5G cellular technology toconnect people, places, and things, anywhere. We’re at the forefront of the Wireless WAN and 5G —the next big waves in networking — and we remain as hungry and humble as the day we started. Ifyou’re hungry to be part of something big, come join us. 

             

            How Will You Contribute to the Company? 

            The Sr. Demand Architect is responsible for creating an accurate and achievable collaborativeconsensus plan in close partnership with Sales, Product Management, and Finance. This keyposition must be able to facilitate and drive results in a fast-paced and demanding growthenvironment, leveraging his/her strong interpersonal and leadership skills. Additionally, theDemand Planner plays a critical role in the monthly S&OP process and will be the key resource forall demand-related issues. This role will be challenged to continue the development of bestpractices and standardized processes.

            What you will do

            \r

            Forecasting

            • Manage demand planning and forecasting for purchasing to ensure an uninterrupted supply ofproducts for global customers
            • Partner with Sales and Marketing to understand historical sales, market trends, seasonality,product mix, sales events, marketing promotions, and other factors which influence theforecast
            • Manage key stakeholders by communicating realistic and accurate demand plans based onstatistical modeling
            • Drive consensus between cross-functional groups and leaders.
            • Effectively identify demand patterns, changes in trend, and drivers of product demand
            • Develop and drive continuous improvements to forecasting models, demand forecastingtechniques, and methods by performing root-cause analysis
            • Successfully identify risks and opportunities in the demand plan, escalates and communicatesappropriately
            • Work with Supply Planning and Sales stakeholders to shape demand and optimize businessperformance
            • Provide quantitative analysis that drives forecast and volatility improvements across thebusiness
            • Facilitate regular reviews of forecast accuracy results across the business
            • Effectively adapt communication of data, insights, statistical modeling, and market trends tovarious audiences
            • Utilize best practices in technology and processes to enable an effective demand planningfunction 

            S&OP

            \r
            • Manage the global S&OP demand process for all products in collaboration with Sales, Finance &Supply Chain
            • Collaborate across the organization to ensure that the appropriate data is available andaccurate to be reviewed at the S&OP process meetings
            • Prepare all data and metrics for demand-related S&OP meetings and reviews. Identify gapsand scenarios that will be presented. Guide final decision-making on open items includingtrade-offs and risk mitigation proposals
            • Provide ad hoc analysis to support decision-making by Supply Chain, Operations, Finance,Sales, Marketing, and Executive leadership 

            NPI

            • SKU level demand planning to incorporate weekly and monthly reporting of key performanceindicators for the product transitions by collaborating with Product Management, Engineering,and Supply Planning leadership
            • Collaborate with cross-functional teams, and monitor progress of product milestones for on-time completion. Drive continuous improvement in processes
            • Develop internal tools to make SKU transition demand planning models sustainable andscalable
            • Manage the analysis of hardware lifecycle information to create a HW ramp up/ramp down planto optimize inventory & fulfill customer requirements
            • Support the analysis for Excess & Obsolete inventory, root causes, and process improvements 

             

            Business Process 

            • Will play a key role in identifying, implementing, and integrating systems, solutions, andprocesses to improve business and operational processes, reduce costs, improve businessKPIs, and achieve organizational targets
            • Proficient at creating and analyzing business information and defining key businessresults/metrics with a proficiency in data tools such as Excel, SFDC, and Tableau
            • Document and share best practice methods, processes, and ideas across the business's supplychain operations to drive continuous improvements in all aspects of business operations

            The skills you bring

            \r
            • Bachelor’s Degree in Industrial Engineering, Supply Chain or related experience
            • 5+ years professional experience in statistical forecasting and consensus demand planning
            • 5+ years’ experience leading S&OP process
            • 2+ years of experience in data analytics and implementing AI soluition across supply chain functions
            • In-depth knowledge of the components of Demand Management and how forecasting, supply planning, demand analysis, and sales and operations work cohesively and successfully
            • Excellent communication (verbal and written) and interpersonal skills with an ability toeffectively communicate with both business and technical teams
            • Proficient at leveraging statistical forecasting methodologies to derive accurate and consistentdemand forecasts, understanding when to deviate based on market inputs
            • Entrepreneurial spirit and drive to create and build tools, processes and standardize acrossbusiness functions
            • Demand planning prowess, significant experience challenging the status quo, uncoveringhidden trends, and highlighting risk areas 

            Why join Ericsson?

            At Ericsson, you´ll have an outstanding opportunity. The chance to use your skills and imagination to push the boundaries of what´s possible. To build solutions never seen before to some of the world’s toughest problems. You´ll be challenged, but you won’t be alone. You´ll be joining a team of diverse innovators, all driven to go beyond the status quo to craft what comes next.

             

            What happens once you apply?
            Click Here to find all you need to know about what our typical hiring process looks like.

             

            Ericsson uses a merit-based hiring approach that values people with different experiences, perspectives and skillsets. We truly believe this approach drives innovation, which is essential for our future growth. We encourage people from all backgrounds to apply and realize their full potential as part of our Ericsson team.  Ericsson is proud to be an Equal Opportunity employer, learn more.

             

            If you need assistance or to request an accommodation due to a disability, please contact Ericsson at hr.direct.americas@ericsson.com. 

             

            DISCLAIMER: The above statements are intended to describe the general nature and level of work being performed by employees in this position. They are not an exhaustive list of all responsibilities, duties and skills required for this position, and you may be required to perform additional job tasks as assigned.

             

            Primary country and city: United States (US) || Boise (ID) (Country/ City)

             

            Job details: Supply Chain Planner

             

            Compensation and Benefits at Ericsson
            At Ericsson, we know that our people are the key to our success. We offer a competitive package to help with your individual needs and goals.

             

            Your Pay
            The salary range for this position is dependent on various factors including, but not limited to, location, and the candidate’s combination of job-related knowledge, qualifications, skills, education, training, and experience.

             

            Short-Term Variable Compensation Plan : Your pay also includes the opportunity for an annual bonus. Actual bonus payouts are based on performance of the business against the unit’s objectives, individual performance, and the individual bonus target. Certain eligibility and pro-ration rules apply.  

             

            Your Health 
            Ericsson Enterprise Wireless Solutions offers excellent, competitive employee benefits, such as: subsidized, nationwide PPO medical benefit options including a low-deductible Point of Service Plan and a qualifying High Deductible Health Plan (HDHP), with a generous company-provided HSA contribution. For California employees, we offer a subsidized HMO option through Kaiser. Ericsson Enterprise Wireless Solutions also offers subsidized dental and vision coverage. 

             

            Your Financial Security 
            We invest in both your short and long-term financial wellbeing. Our 401(k) plan has a 4% company match and immediate vesting. Employees will also receive company-paid employee basic life and AD&D insurance and company-paid disability benefits. 

             

            Your Time 
            Your work-life balance is important to us. New employees are provided a minimum of 15 days of accrued vacation, up to 3 personal days per year, 11 annual holidays, 8 hours of volunteer time, and 80 hours of sick time annually. Please note paid time off is pro-rated based on the employee’s start date. Furthermore, Ericsson provides up to 16 weeks of paid maternity leave and 6 weeks of parental or adoption leave at 100% of pay.

             

            Additional Benefits 
            Ericsson Enterprise Wireless Solutions offers other company-paid benefits such as a comprehensive Employee Assistance Program, mobile therapy, and volunteer paid time off. 

            ", + "location": "Plano,Texas,United States", + "isHot": 1, + "workLocationOption": "onsite", + "locationFlexibility": null, + "atsJobId": "791521", + "positionUrl": "/careers/job/563121777283313", + "publicUrl": "https://jobs.ericsson.com/careers/job/563121777283313", + "jdHighlight": [], + "positionUserActions": { + "isSaved": false, + "applyAction": { + "status": "link_off", + "applyUrl": "https://career2.successfactors.eu/career?company=Ericsson&career_ns=job_application&src=Eightfold&career_job_req_id=791521" + } + } + }, + "metadata": null +} \ No newline at end of file diff --git a/tests/fixtures/ats/eightfold.json b/tests/fixtures/ats/eightfold.json new file mode 100644 index 0000000..9c17361 --- /dev/null +++ b/tests/fixtures/ats/eightfold.json @@ -0,0 +1,145 @@ +{ + "status": 200, + "error": { + "message": "", + "body": "" + }, + "data": { + "positions": [ + { + "id": 563121777024688, + "displayJobId": "788936", + "name": "Systems Architect - RAN Semantic Data", + "locations": [ + "Stockholm,Stockholm,Sweden" + ], + "standardizedLocations": [ + "Stockholm, Stockholm County, SE" + ], + "postedTs": 1790703782, + "solrScore": null, + "stars": 0, + "department": "76 Product Development", + "creationTs": 1785822052, + "isHot": 0, + "workLocationOption": "onsite", + "locationFlexibility": null, + "atsJobId": "788936", + "positionUrl": "/careers/job/563121777024688", + "efcustomTextJobfuntionAdvancefilterpcs": [ + "Product Development" + ] + }, + { + "id": 563121777269700, + "displayJobId": "791400", + "name": "Director of Operations Excellence", + "locations": [ + "Mexico City,Mexico City,Mexico" + ], + "standardizedLocations": [ + "México D.F., CDMX, MX" + ], + "postedTs": 1790703449, + "solrScore": null, + "stars": 0, + "department": "82 Service Delivery", + "creationTs": 1789700838, + "isHot": 0, + "workLocationOption": "onsite", + "locationFlexibility": null, + "atsJobId": "791400", + "positionUrl": "/careers/job/563121777269700", + "efcustomTextJobfuntionAdvancefilterpcs": [ + "Service Delivery" + ] + }, + { + "id": 563121776511927, + "displayJobId": "786802", + "name": "SMA Production Quality Engineer", + "locations": [ + "Lewisville,Texas,United States" + ], + "standardizedLocations": [ + "Lewisville, TX, US" + ], + "postedTs": 1790701576, + "solrScore": null, + "stars": 0, + "department": "83 Supply & Logistics", + "creationTs": 1781768740, + "isHot": 0, + "workLocationOption": "onsite", + "locationFlexibility": null, + "atsJobId": "786802", + "positionUrl": "/careers/job/563121776511927", + "efcustomTextJobfuntionAdvancefilterpcs": [ + "Supply & Logistics" + ] + }, + { + "id": 563121776553428, + "displayJobId": "786911", + "name": "Product Quality Leader", + "locations": [ + "Lewisville,Texas,United States" + ], + "standardizedLocations": [ + "Lewisville, TX, US" + ], + "postedTs": 1790701145, + "solrScore": null, + "stars": 0, + "department": "83 Supply & Logistics", + "creationTs": 1782032961, + "isHot": 0, + "workLocationOption": "onsite", + "locationFlexibility": "flexible_within_country", + "atsJobId": "786911", + "positionUrl": "/careers/job/563121776553428", + "efcustomTextJobfuntionAdvancefilterpcs": [ + "Supply & Logistics" + ] + }, + { + "id": 563121776667313, + "displayJobId": "787350", + "name": "PMO Intern", + "locations": [ + "Tecnoparque,Mexico City,Mexico", + "Santa Fe,Mexico City,Mexico", + "Mexico City,Mexico City,Mexico", + "Tlalnepantla,Estado de México,Mexico" + ], + "standardizedLocations": [ + "México D.F., CDMX, MX", + "México D.F., CDMX, MX", + "México D.F., CDMX, MX", + "Tlalnepantla de Baz, Méx., MX" + ], + "postedTs": 1790699151, + "solrScore": null, + "stars": 0, + "department": "82 Service Delivery", + "creationTs": 1782910047, + "isHot": 0, + "workLocationOption": "onsite", + "locationFlexibility": null, + "atsJobId": "787350", + "positionUrl": "/careers/job/563121776667313", + "efcustomTextJobfuntionAdvancefilterpcs": [ + "Service Delivery" + ] + } + ], + "count": 637, + "sortBy": "timestamp", + "appliedFilters": {}, + "resultsMetaData": { + "usedFuzzSearch": false, + "mocTitle": null + } + }, + "metadata": null +} \ No newline at end of file diff --git a/tests/test_ats_eightfold.py b/tests/test_ats_eightfold.py new file mode 100644 index 0000000..398639a --- /dev/null +++ b/tests/test_ats_eightfold.py @@ -0,0 +1,195 @@ +"""The Eightfold host module against a saved page of Ericsson's search (five +of its roles) and one saved role answer. No network.""" + +from __future__ import annotations + +import json +import sys +from datetime import UTC, datetime +from pathlib import Path +from typing import Any + +import httpx +import pytest + +ROOT = Path(__file__).resolve().parents[1] +if str(ROOT) not in sys.path: + sys.path.insert(0, str(ROOT)) + +from app.jobs import discover # noqa: E402 +from plugins import ats, atshosts # noqa: E402 +from plugins.atshosts import eightfold # noqa: E402 + +FIXTURES = ROOT / "tests" / "fixtures" / "ats" +SLUG = "jobs.ericsson.com/ericsson.com" + + +def _saved() -> dict[str, Any]: + return json.loads((FIXTURES / "eightfold.json").read_text()) + + +def _position(n: int) -> dict[str, Any]: + return {"id": 5000 + n, "displayJobId": str(n), "name": f"Role {n}", + "locations": ["Lund,Skane,Sweden"], "postedTs": 1790000000 - n, + "department": "76 Product Development", "workLocationOption": "hybrid", + "positionUrl": f"/careers/job/{5000 + n}"} + + +def _search(total: int, seen: list[str] | None = None) -> httpx.MockTransport: + """A search that ignores `num` and answers ten roles from `start`.""" + def handler(request: httpx.Request) -> httpx.Response: + if seen is not None: + seen.append(str(request.url)) + start = int(request.url.params["start"]) + positions = [_position(n) for n in range(start, min(start + 10, total))] + return httpx.Response(200, json={"status": 200, "data": { + "positions": positions, "count": total}}) + return httpx.MockTransport(handler) + + +def test_a_page_becomes_rows() -> None: + rows = eightfold.rows(_saved()["data"]["positions"], SLUG) + assert len(rows) == 5 + first, mexico, many = rows[0], rows[1], rows[4] + assert first["source_id"] == "563121777024688" + assert first["title"] == "Systems Architect - RAN Semantic Data" + assert first["url"] == "https://jobs.ericsson.com/careers/job/563121777024688" + assert first["location"] == "Stockholm, Sweden" # the city is its own region + assert first["department"] == "76 Product Development" + assert first["posted"] == datetime.fromtimestamp(1790703782, tz=UTC) + assert first["remote"] == "onsite" and (first["description"], first["salary_text"]) == ("", "") + assert mexico["location"] == "Mexico City, Mexico" + assert many["location"] == ("Tecnoparque, Mexico City, Mexico; Santa Fe, Mexico City, Mexico; " + "Mexico City, Mexico; Tlalnepantla, Estado de México, Mexico") + + +@pytest.mark.parametrize(("option", "remote"), [ + ("onsite", "onsite"), ("hybrid", "hybrid"), ("remote", "remote"), (None, None), ("odd", None)]) +def test_the_work_location_option_maps_to_the_remote_words( + option: str | None, remote: str | None) -> None: + assert eightfold.rows([_position(1) | {"workLocationOption": option}], SLUG)[0]["remote"] == remote + + +def test_a_position_without_a_name_an_id_or_a_path_is_left_out() -> None: + bad = [_position(1) | {"name": " "}, _position(2) | {"id": None}, + _position(3) | {"positionUrl": ""}, _position(4) | {"positionUrl": "//evil.example/x"}] + assert eightfold.rows(bad, SLUG) == [] + + +def test_the_standardized_location_stands_in_when_there_is_no_raw_one() -> None: + row = eightfold.rows([_position(1) | {"locations": [], "standardizedLocations": ["Lund, SE"]}], + SLUG)[0] + assert row["location"] == "Lund, SE" + + +def test_a_page_asks_for_the_newest_first_from_its_offset() -> None: + asked: list[str] = [] + + def get(url: str, **_: Any) -> bytes: + asked.append(url) + return json.dumps(_saved()).encode() + + decoded, results, total, cursor = eightfold.page(get, SLUG, None) + assert asked == ["https://jobs.ericsson.com/api/pcsx/search?domain=ericsson.com" + "&sort_by=timestamp&start=0"] + assert (len(decoded), len(results), total, cursor) == (5, 5, 637, 5) + assert eightfold.page(get, SLUG, 630)[3] == 635 + assert asked[-1].endswith("&start=630") + + +def test_a_board_is_read_ten_at_a_time_to_its_total(monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.setattr(ats, "PAGE_DELAY", 0) + seen: list[str] = [] + with httpx.Client(transport=_search(25, seen)) as client: + rows, complete = ats._fetch_rows(client, f"eightfold:{SLUG}") + assert (len(rows), complete) == (25, True) + assert [u.rsplit("=", 1)[1] for u in seen] == ["0", "10", "20"] + + +def test_a_board_over_the_page_cap_is_incomplete(monkeypatch: pytest.MonkeyPatch) -> None: + """The cap is 100 pages of ten: a board of 1,292 (Infineon's) or 2,319 + (Microsoft's) is read as its first thousand and never as the whole.""" + monkeypatch.setattr(ats, "PAGE_DELAY", 0) + seen: list[str] = [] + with httpx.Client(transport=_search(1292, seen)) as client: + rows, complete = ats._fetch_rows(client, "eightfold:infineon.eightfold.ai/infineon.com") + assert (len(rows), complete) == (1000, False) and len(seen) == ats.MAX_PAGES == 100 + + +def test_an_empty_board_is_complete_at_zero(monkeypatch: pytest.MonkeyPatch) -> None: + with httpx.Client(transport=_search(0)) as client: + assert ats._fetch_rows(client, f"eightfold:{SLUG}") == ([], True) + + +@pytest.mark.parametrize("body", [ + b"Not found", b"[]", b'{"status": 403, "message": "Not authorized for PCSX"}', + b'{"data": {"positions": null}}']) +def test_an_answer_that_is_not_a_search_raises(body: bytes) -> None: + with pytest.raises(ValueError): + eightfold.page(lambda url, **_: body, SLUG, None) + + +def test_detail_reads_the_text_of_the_ad() -> None: + asked: list[str] = [] + + def get(url: str, **_: Any) -> bytes: + asked.append(url) + return (FIXTURES / "eightfold-detail.json").read_bytes() + + found = eightfold.detail(get, SLUG, {"source_id": "563121777283313"}) + assert asked == ["https://jobs.ericsson.com/api/pcsx/position_details" + "?position_id=563121777283313&domain=ericsson.com&hl=en"] + assert set(found) <= set(ats.DETAIL_FIELDS) + text = found["description"] + assert text.startswith("Join our Team") + assert "<" not in text and "&" not in text and "\r" not in text and " " not in text + + +@pytest.mark.parametrize("body", [b"", b"[]", b'{"data": {}}']) +def test_detail_refuses_an_answer_that_is_not_a_position(body: bytes) -> None: + with pytest.raises(ValueError): + eightfold.detail(lambda url, **_: body, SLUG, {"source_id": "1"}) + + +@pytest.mark.parametrize("role", ["", "12a", "1&domain=evil.example", "../x", "1 2"]) +def test_detail_refuses_an_id_that_is_not_a_number(role: str) -> None: + def get(url: str, **_: Any) -> bytes: + raise AssertionError("no request may be made") + + with pytest.raises(ValueError): + eightfold.detail(get, SLUG, {"source_id": role}) + + +def test_the_slug_the_urls_and_the_allow_list() -> None: + for slug in (SLUG, "infineon.eightfold.ai/infineon.com", "Apply.Careers.Microsoft.com/microsoft.com"): + assert eightfold.slug_ok(slug) and ats.is_known_target(f"eightfold:{slug}") + assert eightfold.careers_url("Jobs.Ericsson.com/ericsson.com") == "https://jobs.ericsson.com/careers" + assert eightfold.robots_page(SLUG) == "https://jobs.ericsson.com/careers" + allow = eightfold.allowed("Jobs.Ericsson.com/ericsson.com") + assert allow("jobs.ericsson.com") and allow("JOBS.ERICSSON.COM") + assert not allow("ericsson.com") and not allow("evil.example") + assert not allow("jobs.ericsson.com.evil.example") and not allow("localhost") + assert atshosts.HOSTS["eightfold"] is eightfold and ats.HOSTS["eightfold"] == "Eightfold" + + +@pytest.mark.parametrize("slug", [ + "", "jobs.ericsson.com", "jobs.ericsson.com/", "/ericsson.com", "jobs.ericsson.com/ericsson", + "jobs.ericsson.com/ericsson.com/", "jobs.ericsson.com/ericsson.com/x", "a/b/c.com", + "a@b.com/ericsson.com", "a.com#x/ericsson.com", "a.com?x/ericsson.com", "../ericsson.com", + "a.com%2fx/b.com", "a.com:443/b.com", "a.com/b.com:80", " a.com/b.com", "a.com/b.com ", + "a.com/b.com\n", "a.com/b.com\r\n", "127.0.0.1/ericsson.com", "a.com/127.0.0.1", + "localhost/ericsson.com", "a.com/localhost", "a.com/b.com&start=9", "a.com/b.com?x=1", + "[::1]/a.com", "a.com/b.com#", "app.localhost/a.com", "printer.local/a.com", + "meta.internal/a.com", "a.com/x.internal", "a_b.com/c.com", "évil.com/a.com"]) +def test_a_hostile_slug_is_refused(slug: str) -> None: + assert not eightfold.slug_ok(slug) + assert not ats.is_known_target(f"eightfold:{slug}") + + +def test_discovery_reads_the_host_and_domain_from_a_link_that_has_both() -> None: + page = ('Jobs' + 'no domain') + found = [(h, s) for h, s, _ in discover.boards_in(page)] + assert ("eightfold", "infineon.eightfold.ai/infineon.com") in found + assert ("eightfold", "") in found + assert "eightfold" not in {h for h, _ in discover._UNREADABLE if h not in atshosts.HOSTS}