Split the All tag into two company overrides: All countries and All roles (WP L)
Fetching has two filters, and a company now overrides each on its own.
All countries (companies.all_countries) is the old All roles tag: its big
boards are read with the agents' wide reach. All roles (companies.all_roles,
new meaning) drops the agents' fetch terms and any later role filter.
- Migration 24 copies the old tag to all_countries and keeps all_roles for
those companies, and moves a board's {"terms": false} to its company.
- The runner no longer reads {"terms": false}; the plan leaves the terms out
for a company set to All roles.
- POST /api/companies/{key}/all-countries and /all-roles, each queueing a
pull when turned on; CompanyOut carries both.
- Two toggles replace All on the Companies row, the reader and the Roles
strip; the reach line states countries and role types in plain words;
the filter select gets both options.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
795ca3628c
commit
e52857dea5
23 files changed
+602
-215
No files matched your search
+32
-15
@@ -53,7 +53,7 @@ def _row(client: TestClient) -> dict[str, object]:
|
||||
def test_a_company_row_says_what_its_board_is_asked_for(client: TestClient, bosch: int) -> None:
|
||||
row = _row(client)
|
||||
# SmartRecruiters cannot ask for remote, so only the country is asked.
|
||||
assert (row["reach"], row["reach_params"]) == ("DK · agents", {})
|
||||
assert (row["reach"], row["reach_params"]) == ("follows agents: DK · all roles", {})
|
||||
|
||||
|
||||
def test_a_boards_own_reach_is_kept_in_its_params_and_wins(
|
||||
@@ -61,14 +61,14 @@ def test_a_boards_own_reach_is_kept_in_its_params_and_wins(
|
||||
res = client.post(f"/api/sources/{bosch}/reach",
|
||||
json={"mode": "own", "countries": ["de", "se"], "remote": True})
|
||||
assert res.status_code == 200, res.text
|
||||
assert res.json()["reach"] == "DE, SE · set here"
|
||||
assert res.json()["reach"] == "set here: DE, SE · all roles"
|
||||
sub = store.subscription(bosch)
|
||||
assert sub is not None
|
||||
assert sub.params == {"note": "kept", "countries": ["DE", "SE"], "remote": True}
|
||||
assert _row(client)["reach_params"] == {"countries": ["DE", "SE"], "remote": True}
|
||||
|
||||
res = client.post(f"/api/sources/{bosch}/reach", json={"mode": "agents"})
|
||||
assert res.json()["reach"] == "DK · agents"
|
||||
assert res.json()["reach"] == "follows agents: DK · all roles"
|
||||
assert store.subscription(bosch).params == {"note": "kept"} # type: ignore[union-attr]
|
||||
|
||||
|
||||
@@ -97,30 +97,47 @@ def test_a_search_or_an_unknown_board_has_no_reach(client: TestClient, store: St
|
||||
_ANY_STATE = ("queued", "running", "done", "failed", "cancelled")
|
||||
|
||||
|
||||
def test_the_all_roles_tag_reads_the_wide_reach_and_on_queues_a_pull(
|
||||
def test_all_countries_reads_the_wide_reach_and_on_queues_a_pull(
|
||||
client: TestClient, app: FastAPI, store: Store, bosch: int) -> None:
|
||||
queue = app.state.queue
|
||||
res = client.post("/api/companies/bosch/all-roles", json={"on": True})
|
||||
res = client.post("/api/companies/bosch/all-countries", json={"on": True})
|
||||
assert res.status_code == 200, res.text
|
||||
assert res.json()["all_roles"] == 1
|
||||
assert (res.json()["all_countries"], res.json()["all_roles"]) == (1, 0)
|
||||
# On reopens roles, so it queues a pull as switching a board on does.
|
||||
assert queue.jobs.last("pull", states=_ANY_STATE) is not None
|
||||
row = _row(client)
|
||||
# Wolf requires no place, so the wide reach is everywhere.
|
||||
assert (row["all_roles"], row["reach"]) == (True, "all roles · company tag")
|
||||
# A board's own countries win over the tag.
|
||||
assert (row["all_countries"], row["all_roles"], row["reach"]) == (
|
||||
True, False, "all countries (everywhere): read whole")
|
||||
# A board's own countries win over it.
|
||||
client.post(f"/api/sources/{bosch}/reach", json={"mode": "own", "countries": ["DE"]})
|
||||
assert _row(client)["reach"] == "DE · set here"
|
||||
assert _row(client)["reach"] == "set here: DE · all roles"
|
||||
|
||||
|
||||
def test_turning_the_tag_off_queues_nothing(
|
||||
def test_all_roles_is_its_own_switch_and_on_queues_a_pull(
|
||||
client: TestClient, app: FastAPI, store: Store, bosch: int) -> None:
|
||||
store.set_all_roles("bosch", True)
|
||||
res = client.post("/api/companies/bosch/all-roles", json={"on": False})
|
||||
assert res.status_code == 200 and res.json()["all_roles"] == 0
|
||||
res = client.post("/api/companies/bosch/all-roles", json={"on": True})
|
||||
assert res.status_code == 200, res.text
|
||||
assert (res.json()["all_countries"], res.json()["all_roles"]) == (0, 1)
|
||||
assert app.state.queue.jobs.last("pull", states=_ANY_STATE) is not None
|
||||
row = _row(client)
|
||||
# The narrow reach takes no terms, so on its own it changes nothing today.
|
||||
assert (row["all_countries"], row["all_roles"], row["reach"]) == (
|
||||
False, True, "follows agents: DK · all roles")
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path, setter", [("all-countries", "set_all_countries"),
|
||||
("all-roles", "set_all_roles")])
|
||||
def test_turning_an_override_off_queues_nothing(
|
||||
client: TestClient, app: FastAPI, store: Store, bosch: int, path: str,
|
||||
setter: str) -> None:
|
||||
getattr(store, setter)("bosch", True)
|
||||
res = client.post(f"/api/companies/bosch/{path}", json={"on": False})
|
||||
assert res.status_code == 200
|
||||
assert (res.json()["all_countries"], res.json()["all_roles"]) == (0, 0)
|
||||
assert app.state.queue.jobs.last("pull", states=_ANY_STATE) is None
|
||||
assert _row(client)["reach"] == "DK · agents"
|
||||
assert client.post("/api/companies/nobody/all-roles", json={"on": True}).status_code == 404
|
||||
assert _row(client)["reach"] == "follows agents: DK · all roles"
|
||||
assert client.post(f"/api/companies/nobody/{path}", json={"on": True}).status_code == 404
|
||||
|
||||
|
||||
def test_the_readers_are_listed_with_what_they_declare(client: TestClient) -> None:
|
||||
|
||||
Reference in new issue
Block a user