Keep a board's stated pay as salary_text, even when it does not normalise
Every ats parser now writes one human-readable pay line whether or not it
converts to yearly salary_min/salary_max/currency: hourly and daily rates,
Greenhouse's several pay zones, and a range with no currency all survive as
text instead of being dropped outright. Stored in roles.salary_text
(migration 12), replaced whole on every pull like title, so a board that
stops stating pay clears it rather than leaving a stale line. salary_state
is derived, not stored ('normalised', 'stated', or ''), and is what the
feed's new Pay filter and badge read; gates and scoring are unchanged, still
reading only the normalised columns.
Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
This commit is contained in:
1 parent
706b127bc0
commit
fa4e1a657f
18 files changed
+528
-57
No files matched your search
+65
-11
@@ -31,9 +31,9 @@ def _rows(host: str, slug: str = "acme") -> list[ats.Row]:
|
||||
|
||||
def test_greenhouse_parses_titles_locations_and_html_description() -> None:
|
||||
rows = _rows("greenhouse")
|
||||
# The javascript: and data: rows are refused, same as the two real ones
|
||||
# The javascript: and data: rows are refused, same as the four real ones
|
||||
# are kept: a feed is external content, never trusted as a URL.
|
||||
assert [r["source_id"] for r in rows] == ["1001", "1002"]
|
||||
assert [r["source_id"] for r in rows] == ["1001", "1002", "1005", "1006"]
|
||||
first = rows[0]
|
||||
assert first["title"] == "Senior Backend Engineer" # trimmed
|
||||
assert first["location"] == "Berlin, Germany"
|
||||
@@ -53,9 +53,22 @@ def test_greenhouse_reads_pay_input_ranges_and_skips_an_hourly_one() -> None:
|
||||
(None, None, "")
|
||||
|
||||
|
||||
def test_greenhouse_salary_text_covers_the_single_hourly_and_zoned_cases() -> None:
|
||||
"""`salary_text` is written whether or not the pay normalises: a single
|
||||
yearly range reads plainly, the hourly one that the columns dropped
|
||||
still reads as a line, several zones are joined and labelled with the
|
||||
board's own titles, and a range with no currency says so."""
|
||||
rows = _rows("greenhouse")
|
||||
assert rows[0]["salary_text"] == "EUR 65,000 to 85,000 per year"
|
||||
assert rows[1]["salary_text"] == "USD 30 to 45 per hour"
|
||||
assert rows[2]["salary_text"] == ("Zone 1: USD 180,000 to 220,000 per year; "
|
||||
"Zone 2: USD 160,000 to 200,000 per year")
|
||||
assert rows[3]["salary_text"] == "65,000 to 85,000 per year (no currency stated)"
|
||||
|
||||
|
||||
def test_lever_parses_categories_and_workplace_type() -> None:
|
||||
rows = _rows("lever")
|
||||
assert [r["source_id"] for r in rows] == ["2001", "2002"]
|
||||
assert [r["source_id"] for r in rows] == ["2001", "2002", "2003"]
|
||||
first = rows[0]
|
||||
assert first["department"] == "Engineering"
|
||||
assert first["remote"] == "remote"
|
||||
@@ -72,11 +85,18 @@ def test_lever_reads_salary_range_and_skips_an_hourly_wage() -> None:
|
||||
(None, None, "")
|
||||
|
||||
|
||||
def test_lever_salary_text_covers_the_hourly_and_no_currency_cases() -> None:
|
||||
rows = _rows("lever")
|
||||
assert rows[0]["salary_text"] == "EUR 90,000 to 120,000 per year"
|
||||
assert rows[1]["salary_text"] == "USD 25 to 35 per hour"
|
||||
assert rows[2]["salary_text"] == "80,000 to 100,000 per year (no currency stated)"
|
||||
|
||||
|
||||
def test_ashby_parses_is_remote_and_compensation() -> None:
|
||||
rows = _rows("ashby")
|
||||
assert [r["source_id"] for r in rows] == ["3001", "3002"]
|
||||
assert [r["source_id"] for r in rows] == ["3001", "3002", "3003", "3004"]
|
||||
assert rows[0]["remote"] is False
|
||||
assert rows[0]["salary"] == "70,000-90,000 EUR"
|
||||
assert rows[0]["salary_text"] == "EUR 70,000 to 90,000 per year"
|
||||
assert rows[1]["remote"] is True
|
||||
|
||||
|
||||
@@ -90,6 +110,20 @@ def test_ashby_reads_summary_components_only_with_includecompensation() -> None:
|
||||
(None, None, "")
|
||||
|
||||
|
||||
def test_ashby_salary_text_falls_back_to_prose_and_labels_several_components() -> None:
|
||||
"""No component with a bound at all (job 3): Ashby's own prose summary is
|
||||
what is left to show. An hourly Salary component beside a yearly Bonus
|
||||
one (job 4): neither normalises (`_ashby_salary` only reads a yearly or
|
||||
monthly `Salary` component), but both are stated, labelled since there
|
||||
is more than one."""
|
||||
rows = _rows("ashby")
|
||||
assert rows[2]["salary_text"] == "Competitive OTE, details on request"
|
||||
assert rows[3]["salary_text"] == \
|
||||
"Salary: USD 45 to 60 per hour; Bonus: USD 5,000 to 10,000 per year"
|
||||
assert (rows[3]["salary_min"], rows[3]["salary_max"], rows[3]["currency"]) == \
|
||||
(None, None, "")
|
||||
|
||||
|
||||
def test_workable_builds_the_job_url_and_reads_location_and_remote() -> None:
|
||||
rows = _rows("workable", slug="huggingface")
|
||||
assert [r["source_id"] for r in rows] == ["6125026", "6125041"]
|
||||
@@ -100,6 +134,7 @@ def test_workable_builds_the_job_url_and_reads_location_and_remote() -> None:
|
||||
assert rows[1]["location"] == "Berlin, Germany"
|
||||
assert rows[1]["remote"] is False
|
||||
assert rows[0]["description"] == "" # the list endpoint carries no text
|
||||
assert rows[0]["salary_text"] == "" # Workable's list endpoint states no pay at all
|
||||
|
||||
|
||||
def test_smartrecruiters_builds_the_job_url_from_id_and_slug() -> None:
|
||||
@@ -108,23 +143,31 @@ def test_smartrecruiters_builds_the_job_url_from_id_and_slug() -> None:
|
||||
assert rows[0]["url"] == "https://jobs.smartrecruiters.com/Acme/744000151326819"
|
||||
assert rows[0]["location"] == "Berlin, Germany"
|
||||
assert rows[1]["remote"] is True
|
||||
assert rows[0]["salary_text"] == "" # SmartRecruiters' list endpoint states no pay at all
|
||||
|
||||
|
||||
def test_recruitee_parses_salary_bounds_and_careers_url() -> None:
|
||||
rows = _rows("recruitee")
|
||||
assert [r["source_id"] for r in rows] == ["5001", "5002"]
|
||||
assert [r["source_id"] for r in rows] == ["5001", "5002", "5003"]
|
||||
assert rows[0]["url"] == "https://acme.example/o/player-support-agent-german-1"
|
||||
assert rows[0]["salary"] == "35000-45000 EUR"
|
||||
assert rows[1]["salary"] == ""
|
||||
assert rows[0]["salary_text"] == "EUR 35,000 to 45,000 per year"
|
||||
assert rows[1]["salary_text"] == ""
|
||||
assert (rows[0]["salary_min"], rows[0]["salary_max"], rows[0]["currency"]) == \
|
||||
(35000, 45000, "EUR")
|
||||
assert (rows[1]["salary_min"], rows[1]["salary_max"], rows[1]["currency"]) == \
|
||||
(None, None, "")
|
||||
|
||||
|
||||
def test_recruitee_salary_text_states_an_hourly_rate_with_no_currency() -> None:
|
||||
rows = _rows("recruitee")
|
||||
assert rows[2]["salary_text"] == "18 to 24 per hour (no currency stated)"
|
||||
assert (rows[2]["salary_min"], rows[2]["salary_max"], rows[2]["currency"]) == \
|
||||
(None, None, "")
|
||||
|
||||
|
||||
def test_personio_builds_the_job_url_and_reads_cdata_description() -> None:
|
||||
rows = _rows("personio", slug="acme")
|
||||
assert [r["source_id"] for r in rows] == ["6001", "6002"]
|
||||
assert [r["source_id"] for r in rows] == ["6001", "6002", "6003"]
|
||||
assert rows[0]["url"] == "https://acme.jobs.personio.de/job/6001"
|
||||
assert rows[0]["description"] == "Grow our pipeline."
|
||||
assert rows[0]["remote"] is True # "Remote - Germany"
|
||||
@@ -137,6 +180,17 @@ def test_personio_reads_salary_information_when_present() -> None:
|
||||
(42000, 55000, "EUR")
|
||||
assert (rows[1]["salary_min"], rows[1]["salary_max"], rows[1]["currency"]) == \
|
||||
(None, None, "")
|
||||
assert rows[0]["salary_text"] == "EUR 42,000 to 55,000 per year"
|
||||
assert rows[1]["salary_text"] == ""
|
||||
|
||||
|
||||
def test_personio_salary_text_states_a_monthly_rate_with_no_currency() -> None:
|
||||
rows = _rows("personio", slug="acme")
|
||||
assert rows[2]["salary_text"] == "3,000 to 3,600 per month (no currency stated)"
|
||||
# No currency: dropped from the columns like any other host's, even
|
||||
# though the interval itself (monthly) is one _yearly_amount knows.
|
||||
assert (rows[2]["salary_min"], rows[2]["salary_max"], rows[2]["currency"]) == \
|
||||
(None, None, "")
|
||||
|
||||
|
||||
# ------------------------------------------------------------ salary math
|
||||
@@ -265,7 +319,7 @@ def test_fetch_rows_retries_greenhouse_without_content_on_a_too_large_body(
|
||||
"https://boards-api.greenhouse.io/v1/boards/acme/jobs?content=true&pay_transparency=true",
|
||||
"https://boards-api.greenhouse.io/v1/boards/acme/jobs",
|
||||
]
|
||||
assert [r["source_id"] for r in rows] == ["1001", "1002"]
|
||||
assert [r["source_id"] for r in rows] == ["1001", "1002", "1005", "1006"]
|
||||
assert complete # a host that does not page answers with the whole board
|
||||
|
||||
|
||||
@@ -434,7 +488,7 @@ def test_an_answer_clears_the_failure_and_stamps_completeness(
|
||||
source = _source(monkeypatch, (_rows("greenhouse"), False))
|
||||
source.state["ats:failing:greenhouse:gone"] = json.dumps(
|
||||
{"since": "2026-09-01T00:00:00+00:00", "reason": "404 Not Found"})
|
||||
assert len(list(source.fetch())) == 2
|
||||
assert len(list(source.fetch())) == 4
|
||||
assert "ats:failing:greenhouse:gone" not in source.state
|
||||
assert source.state["ats:ok:greenhouse:gone"] == "run-1"
|
||||
assert source.state["ats:complete:greenhouse:gone"] == ""
|
||||
Reference in new issue
Block a user