Raise the ats body cap to 96 MB, retry Greenhouse without content=true
openings.go's 8 MB cap was written against arbitrary URLs; every URL here is on a fixed allow-list of seven ATS hosts, and the real pull of 2026-09-23 refused Anduril, Anthropic, OpenAI, Databricks, Carvana, Axon and Airwallex for it. A board that still exceeds 96 MB now retries once without content=true (Greenhouse only), trading the description for the listing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
078fb8ff8f
commit
867ebe6405
3 files changed
+85
-8
No files matched your search
@@ -7,6 +7,8 @@ from __future__ import annotations
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
@@ -132,3 +134,42 @@ def test_careers_url_is_filled_per_host_and_empty_for_unknown() -> None:
|
||||
assert ats.careers_url("ashby:acme") == "https://jobs.ashbyhq.com/acme"
|
||||
assert ats.careers_url("recruitee:acme") == "https://acme.recruitee.com"
|
||||
assert ats.careers_url("workday:acme") == ""
|
||||
|
||||
|
||||
# --------------------------------------------------------------- body cap
|
||||
|
||||
def test_max_bytes_is_96_mb() -> None:
|
||||
"""Raised from openings.go's 8 MB: every URL here is on a fixed allow-list
|
||||
of ATS API hosts, not an arbitrary one, and the real run of 2026-09-23
|
||||
refused boards up to 41 MB under it."""
|
||||
assert ats.MAX_BYTES == 96 << 20
|
||||
|
||||
|
||||
def test_fetch_rows_retries_greenhouse_without_content_on_a_too_large_body(
|
||||
monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
calls = []
|
||||
|
||||
def fake_get(client, url, host, slug, *, method="GET"):
|
||||
calls.append(url)
|
||||
if "?content=true" in url:
|
||||
raise ats._TooLarge("response too large (100000000 bytes)")
|
||||
return (FIXTURES / "greenhouse.json").read_bytes()
|
||||
|
||||
monkeypatch.setattr(ats, "_get", fake_get)
|
||||
rows = ats._fetch_rows(object(), "greenhouse:acme") # type: ignore[arg-type]
|
||||
|
||||
assert calls == [
|
||||
"https://boards-api.greenhouse.io/v1/boards/acme/jobs?content=true",
|
||||
"https://boards-api.greenhouse.io/v1/boards/acme/jobs",
|
||||
]
|
||||
assert [r["source_id"] for r in rows] == ["1001", "1002"]
|
||||
|
||||
|
||||
def test_fetch_rows_does_not_retry_a_too_large_body_on_other_hosts(
|
||||
monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
def fake_get(client, url, host, slug, *, method="GET"):
|
||||
raise ats._TooLarge("response too large (100000000 bytes)")
|
||||
|
||||
monkeypatch.setattr(ats, "_get", fake_get)
|
||||
with pytest.raises(ats._TooLarge):
|
||||
ats._fetch_rows(object(), "lever:acme") # type: ignore[arg-type]
|
||||
Reference in new issue
Block a user