Drop pruning boards by region: a fix for the US seed, and a wrong one
`app companies prune`, `/api/prune` and the Sources disclosure switched off every board with no open role in a region. It existed because the first seed was 186 US boards; the European seed makes it moot, and it was wrong on its own terms: a board with no European role today (a company between openings, or a fetch that timed out) was switched off for good. A company that hires nowhere near should not be in the list, and a ranking's country gate handles the rest. `EUROPE` in models had no other reader and goes with it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
3aee48997c
commit
e602eb3388
12 files changed
+11
-233
No files matched your search
@@ -18,7 +18,6 @@ if str(ROOT) not in sys.path:
|
||||
from desk.models import Item # noqa: E402
|
||||
from plugins import search # noqa: E402
|
||||
from plugins.search import SearchSource # noqa: E402
|
||||
from app import cli # noqa: E402
|
||||
from app.config import SearchSeed # noqa: E402
|
||||
from app.jobs import pull # noqa: E402
|
||||
from app.models import country_of # noqa: E402
|
||||
@@ -222,35 +221,6 @@ def test_seed_searches_imports_once(store: Store) -> None:
|
||||
|
||||
# -------------------------------------------------------------------- cli
|
||||
|
||||
def test_prune_unsubscribes_boards_with_no_role_in_the_region(
|
||||
store: Store, capsys: pytest.CaptureFixture[str]) -> None:
|
||||
def board(slug: str, *places: str) -> int:
|
||||
sub = store.add_subscription("ats", f"greenhouse:{slug}", label=slug, company=slug,
|
||||
board="greenhouse")
|
||||
for n, place in enumerate(places):
|
||||
it = Item(source_id=f"greenhouse:{slug}:{n}", location="https://x.example/1",
|
||||
title=f"Engineer {n}", body="", raw={"company": slug, "place": place})
|
||||
it.source = "ats"
|
||||
store.upsert_role(it, sub)
|
||||
return sub.id
|
||||
|
||||
us = board("usonly", "Boston, MA", "Remote - US")
|
||||
both = board("both", "San Francisco, CA", "London, UK")
|
||||
vague = board("vague", "Remote", "Hybrid")
|
||||
|
||||
cli.prune_companies(store, "europe", apply=False)
|
||||
assert "usonly" in capsys.readouterr().out
|
||||
assert len(store.subscriptions(source="ats", fetchable=True)) == 3
|
||||
|
||||
cli.prune_companies(store, "europe", apply=True)
|
||||
fetchable = {s.id for s in store.subscriptions(source="ats", fetchable=True)}
|
||||
assert fetchable == {both, vague}
|
||||
assert all(r.subscription_id != us for r in store.roles())
|
||||
|
||||
cli.prune_companies(store, "DK,EU", apply=True)
|
||||
assert {s.id for s in store.subscriptions(source="ats", fetchable=True)} == {vague}
|
||||
|
||||
|
||||
def test_search_source_stamps_complete_and_ids(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
_stub_search(monkeypatch, ["h1"], complete=True)
|
||||
source = SearchSource({"searches": [{"url": "jobindex:cph", "label": "Copenhagen",
|
||||
|
||||
Reference in new issue
Block a user