Pin that a Europe gate reads a town by its own country and a kept role through its copies' places
The OpenAI and Mistral roles agent 2 let through are not a gazetteer mix-up: Montréal resolves to Canada and San Francisco to the US. Each is the kept role of a posting folded with a copy in Dublin, Munich or Paris, and the gate reads every place of a kept role. Tests hold both, decisions.md says so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1d0a4c37f2
commit
c7e1921be8
3 files changed
+41
-1
No files matched your search
@@ -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