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
+17
-10
@@ -72,7 +72,7 @@ def _board(store: Store, target: str, company: str, size: int | None = 1000,
|
||||
store.state[f"ats:size:{target}"] = str(size)
|
||||
if tagged:
|
||||
from app.models import company_key
|
||||
store.set_all_roles(company_key(company), True)
|
||||
store.set_all_countries(company_key(company), True)
|
||||
|
||||
|
||||
def _sub(store: Store, target: str) -> Any:
|
||||
@@ -123,12 +123,12 @@ def test_the_narrow_reach_takes_no_terms(store: Store) -> None:
|
||||
sub = _sub(store, "smartrecruiters:BoschGroup")
|
||||
ask = _runner.ask_for(smartrecruiters, sub.params, plan.for_subscription(sub))
|
||||
assert ask == Ask(countries=("DK", "SE"))
|
||||
assert reach.line(plan, sub) == "DK, SE · agents"
|
||||
assert reach.line(plan, sub) == "follows agents: DK, SE · all roles"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("size, params", [
|
||||
(299, {}), (None, {}), (5000, {"countries": ["DE"]}), (5000, {"terms": False}),
|
||||
], ids=["small", "never read whole", "own reach", "terms off"])
|
||||
(299, {}), (None, {}), (5000, {"countries": ["DE"]}),
|
||||
], ids=["small", "never read whole", "own reach"])
|
||||
def test_small_unknown_overridden_and_switched_off_boards_take_no_terms(
|
||||
store: Store, size: int | None, params: dict[str, object]) -> None:
|
||||
_wolf(store, TERMS)
|
||||
@@ -148,7 +148,13 @@ def test_the_agents_reach_takes_terms_once_it_is_too_many_countries_to_ask(
|
||||
sub = _sub(store, "smartrecruiters:BoschGroup")
|
||||
ask = _runner.ask_for(smartrecruiters, sub.params, plan.for_subscription(sub))
|
||||
assert ask == Ask(terms=("data", "engineer", "product"))
|
||||
assert reach.line(plan, sub) == "all places · agents · 3 terms"
|
||||
assert reach.line(plan, sub) == \
|
||||
"all places, too many countries to ask · follows agents' terms: data, engineer, product"
|
||||
# All roles drops them there too; the countries stay dropped.
|
||||
store.set_all_roles("bosch", True)
|
||||
plan = reach.plan(store)
|
||||
assert _runner.ask_for(smartrecruiters, sub.params, plan.for_subscription(sub)) == Ask()
|
||||
assert reach.line(plan, sub) == "too many countries to ask: read whole"
|
||||
|
||||
|
||||
# ------------------------------------------------------ terms times the reach
|
||||
@@ -234,16 +240,16 @@ def test_the_reach_line_counts_the_terms(store: Store) -> None:
|
||||
plan = reach.plan(store)
|
||||
philips = _sub(store, "phenom:www.careers.philips.com/global/en")
|
||||
assert reach.line(plan, philips) == \
|
||||
f"{len(plan.wide.countries)} countries · company tag · 3 terms"
|
||||
"all countries (Europe) · follows agents' terms: data, engineer, head of"
|
||||
assert reach.line(plan, _sub(store, "smartrecruiters:BoschGroup")) == \
|
||||
"all places · company tag · 3 terms"
|
||||
"all places, too many countries to ask · follows agents' terms: data, engineer, head of"
|
||||
|
||||
|
||||
def test_one_term_is_one_term(store: Store) -> None:
|
||||
_wolf(store, ["engineer"])
|
||||
_board(store, "smartrecruiters:BoschGroup", "Bosch")
|
||||
assert reach.line(reach.plan(store), _sub(store, "smartrecruiters:BoschGroup")) == \
|
||||
"all places · company tag · 1 term"
|
||||
"all places, too many countries to ask · follows agents' terms: engineer"
|
||||
|
||||
|
||||
# ------------------------------------------------------ each host's request
|
||||
@@ -431,7 +437,7 @@ def test_migration_23_gives_every_agent_no_terms(tmp_path: Path) -> None:
|
||||
conn.execute("ALTER TABLE agents DROP COLUMN fetch_terms")
|
||||
conn.execute("PRAGMA user_version = 22")
|
||||
migrated = Store(path)
|
||||
assert migrated.migrations_applied == [23]
|
||||
assert migrated.migrations_applied == [23, 24]
|
||||
assert migrated.agents()[0].fetch_terms == []
|
||||
|
||||
|
||||
@@ -469,4 +475,5 @@ def test_the_companies_list_says_the_terms(client: TestClient, app: FastAPI) ->
|
||||
_wolf(store, ["engineer", "data", "head of"])
|
||||
_board(store, "smartrecruiters:BoschGroup", "Bosch")
|
||||
row = next(c for c in client.get("/api/companies").json() if c["key"] == "bosch")
|
||||
assert row["reach"] == "all places · company tag · 3 terms"
|
||||
assert row["reach"] == \
|
||||
"all places, too many countries to ask · follows agents' terms: data, engineer, head of"
|
||||
Reference in new issue
Block a user