Gates reject on evidence only, any gates are one group, remote is read off the location line

A require gate on an empty column gated the role ("country unknown"), and extract, the stage that fills the column, is bounded to the roles that rank, so 2,281 of 15,556 open roles could never come back: every board that writes "Remote", "Hybrid" or "Distributed" as its location. An empty column now neither passes nor fails a gate; the role ranks, extract reads it, the rescore decides.

`any` is a third gate mode: the any gates are one group a role must match one of, so a ranking can say "in Denmark, or remote", which require alone could not. The group is gated only when some member had evidence against it.

`remote_of(place)` fills `remote` from the location line the way `country_of` fills `country`, and the startup backfill does both, since Greenhouse writes "Hybrid" as the location and gives no flag.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Fable 5.1 committed 2026-09-28 19:30:06 +02:00
1 parent e602eb3388
commit fb83ae5099
10 files changed
+143 -28

No files matched your search

+16 -8
View File
@@ -22,7 +22,7 @@ import numpy as np
from desk.models import Item
from app.models import (
AFFINITY, REMOTE, STATUSES, Agent, Application, ApplicationEvent, Candidate,
Company, Gate, Role, ScoredRole, Subscription, Weights, company_key, country_of,
Company, Gate, Role, ScoredRole, Subscription, Weights, company_key, country_of, remote_of,
place_key, title_key,
)
from app.storage import schema
@@ -291,6 +291,7 @@ class Store:
}
row |= {name: str(raw.get(name) or "") for name in _RAW_TEXT}
row["country"] = row["country"] or country_of(place)
row["remote"] = row["remote"] or remote_of(place)
row |= {name: _int_or_none(raw.get(name)) for name in _RAW_INT}
keep_filled = ("company", "company_key", "place_key", "remote", "description",
@@ -608,14 +609,21 @@ class Store:
"UPDATE roles SET closed_at = ? WHERE subscription_id = ? AND closed_at IS NULL",
(self.now(), subscription_id))
def backfill_country(self) -> int:
"""Fill `country` from `place` on every role that has none, the way
`upsert_role` does for a new one. Returns how many it filled."""
rows = self._rows("SELECT uid, place FROM roles WHERE country = '' AND place != ''")
filled = [(code, r["uid"]) for r in rows if (code := country_of(r["place"]))]
def backfill_from_place(self) -> int:
"""Fill `country` and `remote` from `place` on every role that has
none, the way `upsert_role` does for a new one, so a word added to the
lookups reaches the roles already stored. Returns how many columns it
filled."""
rows = self._rows("SELECT uid, place FROM roles "
"WHERE place != '' AND (country = '' OR remote = '')")
countries = [(code, r["uid"]) for r in rows if (code := country_of(r["place"]))]
remotes = [(mode, r["uid"]) for r in rows if (mode := remote_of(r["place"]))]
with self.transaction() as conn:
conn.executemany("UPDATE roles SET country = ? WHERE uid = ?", filled)
return len(filled)
conn.executemany("UPDATE roles SET country = ? WHERE uid = ? AND country = ''",
countries)
conn.executemany("UPDATE roles SET remote = ? WHERE uid = ? AND remote = ''",
remotes)
return len(countries) + len(remotes)
# -------------------------------------------------------------- extract