Merge tests and a decision on how a kept role's copies meet a scope (wp-scope)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
170ea948c9
3 files changed
+41
-1
No files matched your search
+1
-1
@@ -118,7 +118,7 @@ What was decided for roledesk and the one reason for each. The longer reasoning
|
||||
|
||||
**The agents set the reach of a pull.** `app/jobs/reach.py` computes it once per pull: the union of the enabled agents' `any` gates on country, town (as its country) and remote, or everything when one agent has none. Fetching has two filters, countries and role types, and a company has an override for each. A company set to **All countries** (`companies.all_countries`, migration 24) is read with the wide reach: the union of the enabled agents' `require` reach, Europe today, and the union of the `any` gates, so the override never reads less than the board would without it. An agent with no `require` gate on place makes the wide reach everywhere. For a company the owner cares about, a role in Freiburg may be open to remote, or worth asking about for Denmark, while Microsoft Germany is not wanted. The overrides are separate from favourite and liked, and global rather than per agent, because they decide what is fetched and fetching is shared. They matter only for a board of 300 roles or more on a host that filters, so a small company is affected once it grows past that. The Companies list states both halves per board, e.g. "follows agents: DK, SE, remote · all roles" or "all countries (Europe) · follows agents' terms: engineer, product, data", or why the board is read whole. Favourite (affinity 2) affects scoring only, where it skips the `any` gates; it used to widen the fetch to its agent's `require` reach, and migration 21 tagged every company that was a favourite of any agent so nothing read before is lost. That tag, first named All roles in `companies.all_roles`, also replaced a board's `{"reach": "all"}` param, which read everywhere: migration 21 tagged those companies and logged each such board, since no everywhere level is left. Migration 24 renamed the tag to All countries and gave its companies (Mistral AI and OpenAI on live) All roles as well, since the owner wanted their every role. A board's `params` override the agents' reach and All countries. Boards under 300 roles, and hosts with a one-country filter over more than 8 countries, are read whole. A board's size (`ats:size:<target>`, with `ats:sizechecked:<target>`) is set once, not by every read: `set_board` sizes a new board with `ats.board_size` (a stated total from one unfiltered page 1, else a whole read), a board with no size is sized in its batch before its reach is chosen, and Recheck on the Companies row, `app companies size <key>` and `--missing` size it again. Before, a new board had no size and was read whole on its first pull: Infineon read 999 roles worldwide and cut at page 100. A board whose reader cannot filter is sized by its whole read instead of a second request. On 2026-09-30 `--missing` sized 38 boards the old open-role fallback had sized, among them Bosch 4,830, Verisure 3,447, Microsoft 2,345 and NVIDIA at Workday's 2,000. For a Workday or Oracle site, which filters by its own location ids, the Companies line names a country the site does not list and a missing remote option ("follows agents: DK, remote · SE not on this site"), and "nothing asked" when it lists none, where it used to name what was meant to be asked. SmartRecruiters, Eightfold, SuccessFactors, Phenom, Workday and Oracle filter at the source; countries and remote go as separate series, because the hosts intersect two facets. A complete filtered read closes roles outside the filter, except roles with a vote or an application; a filtered read, or one from a host whose unknown slug answers empty, that lists under 10% of the last read with the same filter counts as failed.
|
||||
|
||||
**A role has a list of places, resolved against a gazetteer.** Readers kept one place of several, joined them, or the host posted a copy per place. A reader now returns every place and never multiplies a row. `places` (city, region, country, continent, with `place_includes` for Øresund across two countries) and `place_aliases` are seeded from the dictionaries that were in code; `role_places` links each place of a role, and an unknown text is listed by `unresolved_places` until an alias links it. The Place filter and the gates join over the tree, which halved their time and dropped the `EU` fallback. Copies of one posting per place, same host, company and title and texts at least 30% alike, fold into one role that keeps each copy's place and link; the rule applies to every host, since the 5,024 such roles came mostly from hosts that do not declare copies.
|
||||
**A role has a list of places, resolved against a gazetteer.** Readers kept one place of several, joined them, or the host posted a copy per place. A reader now returns every place and never multiplies a row. `places` (city, region, country, continent, with `place_includes` for Øresund across two countries) and `place_aliases` are seeded from the dictionaries that were in code; `role_places` links each place of a role, and an unknown text is listed by `unresolved_places` until an alias links it. The Place filter and the gates join over the tree, which halved their time and dropped the `EU` fallback. Copies of one posting per place, same host, company and title and texts at least 30% alike, fold into one role that keeps each copy's place and link; the rule applies to every host, since the 5,024 such roles came mostly from hosts that do not declare copies. A place text resolves by its own words (`Gazetteer.resolve`), never by the role's stated `country`, which names one country of a multi-place line: `San Francisco; London, UK` with `US` is in Europe through London. The gates and the Place filter read every place of a kept role, a folded copy's included, so OpenAI's San Francisco role with a Dublin copy meets a Europe gate although its `place` and `country` are San Francisco's; its row reads "San Francisco +1". On 2026-10-03 this kept 45 open roles in agent 2's feed that its own places alone would gate.
|
||||
|
||||
**A remote role has a remote area: the places a remote hire may live in** (migration 27, `role_remote`, `app/prep/area.py`). On 2026-09-30 the Place field listed "USA (Remote)", "Remote US" and "United States (Remote)" as three towns, and no filter said which of 3,177 remote roles someone in Denmark could take. Those lines came from a few whole-read Greenhouse and Ashby boards (Grafana Labs, Cloudflare, Monzo, Talkdesk), not from an ingest filter. Danish employers barely post remote roles (11 of 1,395 open Danish roles). The remote roles open to Denmark are the roughly 300 scoped to Europe or EMEA and the 210 scoped to anywhere. The area is the first of these that names a place: the model's `remote_where`, the parts of the place texts that say remote ("Germany (Remote)", "Home Based - EMEA"; "Worldwide" or "Global" in such a part is Anywhere), and the role's resolved places lifted to their countries. "Remote" alone names none, so such a role is remote with no stated area. Anywhere is a standalone place with no aliases and nothing under it, so the Place filter and `under` never reach every role through it, and it never counts as a place for a country gate's empty check. Remote lines are no longer suggested as towns.
|
||||
|
||||
|
||||
@@ -103,6 +103,23 @@ def test_berlin_and_munich_of_one_host_fold_into_one_role_with_two_places(
|
||||
assert (row.uid, row.place, row.copies) == (kept, f"{got.places[0].text} +1", 0)
|
||||
|
||||
|
||||
def test_a_place_copy_in_europe_meets_a_europe_gate_for_its_kept_role(store: Store) -> None:
|
||||
"""OpenAI posts one role in San Francisco and in Dublin. The kept role
|
||||
holds both places, so a Europe gate and the Place filter find it through
|
||||
Dublin, though `roles.place` and `roles.country` are San Francisco's."""
|
||||
from app import prep
|
||||
from app.models import Gate
|
||||
sf = role("sf", company="OpenAI", place="San Francisco", country="US", board="ashby")
|
||||
dublin = role("dub", company="OpenAI", place="Dublin, Ireland", country="IE", board="ashby")
|
||||
for item in (sf, dublin):
|
||||
store.upsert_role(item)
|
||||
prep.run(store)
|
||||
kept = kept_of(store, sf, dublin)
|
||||
agent = store.save_agent("A", gates=[Gate(field="country", values=["FR", "IE", "EU"])])
|
||||
assert {c.uid: c.gates for c in store.score_candidates(agent.id, agent.gates)} == {kept: [1]}
|
||||
assert {r.uid for r in store.roles(places=["country:IE"], by_score=False)} == {kept}
|
||||
|
||||
|
||||
def test_places_of_two_hosts_or_two_different_texts_stay_apart(store: Store) -> None:
|
||||
a = role("a", place="Berlin", body="Build payment services in Kotlin for our bank " * 5)
|
||||
b = role("b", place="Munich", body="Sell cloud contracts to enterprise buyers " * 5)
|
||||
|
||||
@@ -301,6 +301,29 @@ def test_the_eu_value_of_a_country_gate_is_europe(store: Store,
|
||||
assert found[several["ny"]] == 0
|
||||
|
||||
|
||||
#: Lines of OpenAI and Mistral roles that agent 2's Europe gate was thought to
|
||||
#: let through, with the country the board stated.
|
||||
STATED = {"montreal": ("Montréal", "CA"), "sf": ("San Francisco", "US"),
|
||||
"sf-ny": ("San Francisco; New York City", "US"),
|
||||
"sf-london": ("San Francisco; London, UK", "US"),
|
||||
"sf-seattle-london": ("San Francisco; Seattle; London, UK", "")}
|
||||
|
||||
|
||||
def test_a_town_outside_europe_does_not_meet_a_europe_gate(store: Store) -> None:
|
||||
"""Montréal is Canada's and San Francisco the US's, whatever the
|
||||
stated country; a line that also names London is in Europe through it,
|
||||
in the gate and in the Place filter alike."""
|
||||
for key, (line, country) in STATED.items():
|
||||
upsert(store, posting(key, place=line, country=country))
|
||||
uid = {key: posting(key).uid for key in STATED}
|
||||
found = gates(store, Gate(field="country", values=["DE", "FR", "GB", "IE", "EU"]))
|
||||
met = {"sf-london", "sf-seattle-london"}
|
||||
assert found == {uid[k]: int(k in met) for k in STATED}
|
||||
assert uids(store, "country:EU") == {uid[k] for k in met}
|
||||
assert uids(store, "country:CA") == {uid["montreal"]}
|
||||
assert uids(store, "country:FR") == set()
|
||||
|
||||
|
||||
def test_a_place_gate_matches_over_the_gazetteer(store: Store,
|
||||
several: dict[str, str]) -> None:
|
||||
found = gates(store, Gate(field="place", values=["Malmö", "Lund", "oberkochen"],
|
||||
|
||||
Reference in new issue
Block a user