Rank by the cut: fetch gate overrides in scoring, the cut per agent, stages read the cut, fetch text renamed from enrich, the feed kept to the fetch gate, and migration 32
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
060ccf66e6
commit
617356e60c
35 files changed
+1054
-751
No files matched your search
+23
-13
@@ -351,6 +351,7 @@ def test_a_vote_is_set_cleared_and_filtered_on(client: TestClient, store: Store)
|
||||
upsert(store, posting(sid))
|
||||
uid = {r.source_id: r.uid for r in store.roles()}
|
||||
agent = store.save_agent("A")
|
||||
store.replace_scores(agent.id, [(u, 0.5, "") for u in uid.values()])
|
||||
|
||||
# No `agent` in the body: the default agent's vote.
|
||||
res = client.post(f"/api/roles/{uid['liked']}/vote", json={"value": 1})
|
||||
@@ -394,6 +395,8 @@ def test_votes_are_per_agent_over_the_api(client: TestClient, store: Store) -> N
|
||||
uid = posting("1").uid
|
||||
one = store.save_agent("One")
|
||||
two = store.save_agent("Two")
|
||||
for agent in (one, two):
|
||||
store.replace_scores(agent.id, [(uid, 0.5, "")])
|
||||
|
||||
assert client.post(f"/api/roles/{uid}/vote", json={"value": 1, "agent": one.id}).json()["vote"] == 1
|
||||
assert client.post(f"/api/roles/{uid}/vote", json={"value": -1, "agent": two.id}).json()["vote"] == -1
|
||||
@@ -439,11 +442,15 @@ def test_roles_with_an_agent_can_be_ordered_newest_and_keep_the_votes(
|
||||
store.replace_scores(agent.id, [(uid["1"], 0.9, ""), (uid["2"], 0.1, "")]) # 3 unscored
|
||||
store.set_vote(agent.id, uid["1"], 1)
|
||||
|
||||
# Newest keeps to the agent's fetch gate: only what it scored and passed.
|
||||
page = client.get("/api/roles", params={"agent": agent.id, "order": "newest"}).json()
|
||||
assert [r["uid"] for r in page["items"]] == [uid["2"], uid["1"]]
|
||||
assert [r["score"] for r in page["items"]] == [None, None]
|
||||
assert [r["vote"] for r in page["items"]] == [None, 1]
|
||||
assert page["total"] == 2
|
||||
# Without an agent named, newest is every open role.
|
||||
page = client.get("/api/roles", params={"order": "newest"}).json()
|
||||
assert [r["uid"] for r in page["items"]] == [uid["3"], uid["2"], uid["1"]]
|
||||
assert [r["score"] for r in page["items"]] == [None, None, None]
|
||||
assert [r["vote"] for r in page["items"]] == [None, None, 1]
|
||||
assert page["total"] == 3
|
||||
scored = client.get("/api/roles", params={"agent": agent.id, "order": "score"}).json()
|
||||
assert [r["uid"] for r in scored["items"]] == [uid["1"], uid["2"]]
|
||||
assert client.get("/api/roles", params={"agent": agent.id,
|
||||
@@ -1086,7 +1093,9 @@ def test_agents_are_created_updated_listed_and_deleted(client: TestClient) -> No
|
||||
agent = created.json()
|
||||
assert agent["weights"] == {"fit": 0.6, "recency": 0.2, "affinity": 0.2, "taste": 0.2,
|
||||
"cv_skills": 30, "cv_experience": 25, "cv_career": 30}
|
||||
assert agent["gates"][0]["weight"] == 1.0
|
||||
assert agent["gates"] == body["gates"]
|
||||
prefer = {**body, "gates": [{"field": "remote", "values": ["hybrid"], "mode": "prefer"}]}
|
||||
assert client.post("/api/agents", json=prefer).status_code == 422
|
||||
|
||||
updated = client.post("/api/agents", json={**body, "id": agent["id"], "enabled": False,
|
||||
"weights": {"fit": 1, "recency": 0,
|
||||
@@ -1179,19 +1188,20 @@ def test_a_gate_on_an_unknown_field_is_refused(client: TestClient) -> None:
|
||||
|
||||
|
||||
def test_an_agents_limits_are_saved_listed_and_checked(client: TestClient) -> None:
|
||||
"""How deep the model stages read is the agent's own; a score outside
|
||||
0..1 is refused."""
|
||||
"""The cut and the depth of summarise are the agent's own; a minimum
|
||||
outside 0..1 and a key from before the cut are refused."""
|
||||
default = client.post("/api/agents", json={"name": "Wide"}).json()
|
||||
assert default["limits"] == {"extract_top": 500, "extract_min": 0.55,
|
||||
"summarise_top": 30, "summarise_min": 0.65,
|
||||
"judge_top": 150, "judge_min": 0.55, "judge_cv_top": 50}
|
||||
narrow = {"extract_top": 50, "extract_min": 0.6, "summarise_top": 5, "summarise_min": 0.7,
|
||||
"judge_top": 20, "judge_min": 0.6, "judge_cv_top": 10}
|
||||
assert default["limits"] == {"cut_fit_top": 500, "cut_fit_min": 0.6,
|
||||
"cut_cv_top": 150, "cut_cv_min": 0.6, "summarise_top": 50}
|
||||
narrow = {"cut_fit_top": 50, "cut_fit_min": 0.7, "cut_cv_top": 10, "cut_cv_min": 0.75,
|
||||
"summarise_top": 5}
|
||||
saved = client.post("/api/agents", json={"name": "Narrow", "limits": narrow})
|
||||
assert saved.status_code == 200 and saved.json()["limits"] == narrow
|
||||
assert [a["limits"]["extract_top"] for a in client.get("/api/agents").json()] == [50, 500]
|
||||
bad = client.post("/api/agents", json={"name": "Bad", "limits": {"extract_min": 2}})
|
||||
assert [a["limits"]["cut_fit_top"] for a in client.get("/api/agents").json()] == [50, 500]
|
||||
bad = client.post("/api/agents", json={"name": "Bad", "limits": {"cut_fit_min": 2}})
|
||||
assert bad.status_code == 422
|
||||
old = client.post("/api/agents", json={"name": "Old", "limits": {"extract_top": 5}})
|
||||
assert old.status_code == 422
|
||||
|
||||
|
||||
def test_roles_by_agent_are_ordered_by_score_and_hide_the_gated(
|
||||
|
||||
Reference in new issue
Block a user