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

+42 -2
View File
@@ -156,12 +156,52 @@ def test_a_require_gate_keeps_the_row_with_a_reason(
scores = store.scores(agent.id)
assert scores[berlin][1] == "" and scores[berlin][0] > 0
assert scores[munich] == (0.0, "place not Berlin")
assert scores[nowhere] == (0.0, "place unknown")
# An empty column is no evidence: the role ranks, and extract can reach it.
assert scores[nowhere][1] == "" and scores[nowhere][0] > 0
shown = store.roles(agent=agent.id)
assert [r.uid for r in shown] == [berlin]
assert {r.uid for r in shown} == {berlin, nowhere}
assert {r.uid for r in store.roles(agent=agent.id, gated=True)} == {berlin, munich, nowhere}
def test_any_gates_are_one_group_a_role_must_match_one_of(
store: Store, config: Config, fake: FakeEmbedder) -> None:
""""In Denmark, or remote": a role passes on either, is gated when it has
evidence against both, and ranks when both columns are empty."""
copenhagen = role(store, "1", place="Copenhagen, Denmark")
remote_de = role(store, "2", place="Berlin, Germany", remote="remote")
onsite_de = role(store, "3", place="Berlin, Germany", remote="onsite")
hybrid_nowhere = role(store, "4", place="Hybrid") # remote from place, no country
blank = role(store, "5")
agent = store.save_agent("Copenhagen or remote", "", [
Gate(field="country", values=["DK"], mode="any"),
Gate(field="remote", values=["remote"], mode="any")])
run(config, store, score.run_score)
scores = store.scores(agent.id)
assert scores[copenhagen][1] == "" and scores[remote_de][1] == ""
assert scores[onsite_de] == (0.0, "none of country DK, remote remote")
assert scores[blank][1] == ""
# "Hybrid" is a country-less line the remote lookup reads as hybrid, so
# the group has evidence against remote and none for country: gated.
assert scores[hybrid_nowhere][1].startswith("none of")
def test_failed_gates_reads_evidence_only() -> None:
gates = [Gate(field="country", values=["DK"]),
Gate(field="remote", values=["remote"], mode="any"),
Gate(field="seniority", values=["senior"], mode="any"),
Gate(field="function", values=["engineering"], mode="prefer")]
def cand(*states: int) -> Candidate:
return Candidate(uid="u", first_seen=NOW.isoformat(), affinity=0, gates=list(states))
assert score.failed_gates(cand(1, 1, 0, 0), gates) == []
assert score.failed_gates(cand(-1, -1, -1, 0), gates) == []
assert score.failed_gates(cand(0, 0, -1, 1), gates) == [
"country not DK", "none of remote remote, seniority senior"]
assert score.failed_gates(cand(1, 0, 0, 1), gates) == [
"none of remote remote, seniority senior"]
def test_a_prefer_gate_adds_its_weight_to_the_score(
store: Store, config: Config, fake: FakeEmbedder) -> None:
remote = role(store, "1", remote="remote")