Leave out titles by phrase: an exclude gate mode and a title gate field

A role whose title holds one of the agent's phrases as whole words is gated
with the phrase as its reason, a favourite's too. The agent form has a
Leave out titles line under Where. function = sales could not do it, since
the classifier files Solutions Engineer and pre-sales under sales.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 15:27:43 +02:00
1 parent 4e827665dd
commit 8c6ea0ffb6
8 files changed
+116 -21

No files matched your search

+50
View File
@@ -365,6 +365,56 @@ def test_failed_gates_reads_evidence_only() -> None:
"none of remote remote, seniority senior"]
def test_an_exclude_gate_on_title_gates_whole_words_and_names_the_value(
store: Store, config: Config, fake: FakeEmbedder) -> None:
"""The sales and data engineering titles the owner does not want: a
phrase matches whole words of the folded title, so "Data Engineering
Manager" and "Forward Deployed Engineer" stay, and the reason names the
phrase that matched."""
ae = role(store, "1", "Enterprise Account Executive, UK")
de = role(store, "2", "Senior MLOps/Data Engineer")
manager = role(store, "3", "Data Engineering Manager")
fde = role(store, "4", "Forward Deployed Engineer")
se = role(store, "5", "Sales Engineer (SE)")
agent = store.save_agent("No sales", "", [
Gate(field="title", values=["Account Executive", "data engineer"], mode="exclude")])
run(config, store, score.run_score)
scores = store.scores(agent.id)
assert scores[ae] == (0.0, "title Account Executive")
assert scores[de] == (0.0, "title data engineer")
assert all(scores[uid][1] == "" and scores[uid][0] > 0 for uid in (manager, fde, se))
def test_a_favourite_is_gated_by_an_exclude_gate_it_matches(
store: Store, config: Config, fake: FakeEmbedder) -> None:
"""A star skips the `any` group, not the titles the agent leaves out."""
store.add_company("Fave")
director = role(store, "1", "Account Director, Nordics", company="Fave")
engineer = role(store, "2", "Forward Deployed Engineer", company="Fave")
agent = store.save_agent("No sales", "", [
Gate(field="title", values=["account director"], mode="exclude")])
store.set_affinity(agent.id, "fave", 2)
run(config, store, score.run_score)
scores = store.scores(agent.id)
assert scores[director] == (0.0, "title account director")
assert scores[engineer][1] == ""
def test_failed_gates_names_the_value_an_exclude_gate_matched() -> None:
gates = [Gate(field="country", values=["DK"]),
Gate(field="title", values=["account executive", "rvp"], mode="exclude")]
def cand(*states: int) -> Candidate:
return Candidate(uid="u", posted_at=NOW.isoformat(), affinity=2, gates=list(states))
assert score.failed_gates(cand(1, 0), gates) == []
assert score.failed_gates(cand(1, -1), gates) == []
assert score.failed_gates(cand(1, 2), gates) == ["title rvp"]
assert score.failed_gates(cand(0, 1), gates) == ["country not DK", "title account executive"]
def test_a_prefer_gate_adds_its_weight_to_the_score(
store: Store, config: Config, fake: FakeEmbedder) -> None:
remote = role(store, "1", remote="remote")