Bring the Python side to the ADR: the judge scores 0 to 10 with the cap at 4 and migration 33 clears every judgement, summarise reads the top 30 of the want and the match order, a hidden company's roles are never in the feed, and the company switch is called All locations.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6cad9713ac
commit
6d82287402
27 files changed
+390
-247
No files matched your search
+17
-17
@@ -65,8 +65,8 @@ def setup(store: Store) -> tuple[Any, dict[str, str]]:
|
||||
uid[sid] = posting(sid).uid
|
||||
store.replace_scores(owner.id, [(uid["a"], 0.9, ""), (uid["b"], 0.8, ""),
|
||||
(uid["c"], 0.7, ""), (uid["d"], 0.6, "gated")])
|
||||
store.set_judgement(owner.id, uid["c"], "k", 90, 90, 90, ["Leads data."], ["Small team."])
|
||||
store.set_judgement(owner.id, uid["b"], "k", 60, 60, 60, ["Data."], ["Junior."])
|
||||
store.set_judgement(owner.id, uid["c"], "k", 9, 9, 9, ["Leads data."], ["Small team."])
|
||||
store.set_judgement(owner.id, uid["b"], "k", 6, 6, 6, ["Data."], ["Junior."])
|
||||
with store.transaction() as conn:
|
||||
conn.execute("UPDATE roles SET languages_required = ? WHERE uid = ?", (json.dumps(
|
||||
[{"language": "sv", "level": "fluent", "kind": "required"}]), uid["a"]))
|
||||
@@ -94,22 +94,22 @@ def test_best_cv_match_puts_the_judged_first_by_cv_score(
|
||||
def test_a_broken_must_have_caps_career_in_the_order_and_the_reader(
|
||||
client: TestClient, store: Store) -> None:
|
||||
owner, uid = setup(store)
|
||||
# c: 90 on all three, but one must-have broken: career counts as 39.
|
||||
# c: 9 on all three, but one must-have broken: career counts as 4.
|
||||
musts = [{"id": "M1", "text": "Permanent", "verdict": "met"},
|
||||
{"id": "M2", "text": "Remote", "verdict": "broken"}]
|
||||
store.set_judgement(owner.id, uid["c"], "k", 90, 90, 90, [], [], musts)
|
||||
capped = round((30 * 90 + 25 * 90 + 30 * 39) / 85, 1)
|
||||
store.set_judgement(owner.id, uid["c"], "k", 9, 9, 9, [], [], musts)
|
||||
capped = round(10 * (30 * 9 + 25 * 9 + 30 * 4) / 85, 1)
|
||||
rows = client.get("/api/roles", params={"agent": owner.id, "order": "cv"}).json()["items"]
|
||||
assert [(r["uid"], r["cv_score"]) for r in rows[:2]] == [(uid["c"], capped), (uid["b"], 60.0)]
|
||||
# With career weighted up the capped value drops under b's 60.
|
||||
store.save_agent("Data", prompts=owner.prompts, agent_id=owner.id, cv_text=owner.cv_text,
|
||||
weights=Weights(cv_skills=0, cv_experience=0, cv_career=1))
|
||||
rows = client.get("/api/roles", params={"agent": owner.id, "order": "cv"}).json()["items"]
|
||||
assert [(r["uid"], r["cv_score"]) for r in rows[:2]] == [(uid["b"], 60.0), (uid["c"], 39.0)]
|
||||
assert [(r["uid"], r["cv_score"]) for r in rows[:2]] == [(uid["b"], 60.0), (uid["c"], 40.0)]
|
||||
one = client.get(f"/api/roles/{uid['c']}", params={"agent": owner.id}).json()
|
||||
j = one["judgement"]
|
||||
assert (j["career"], j["career_capped"], j["broken"]) == (90, 39, 1)
|
||||
assert j["musts"] == musts and one["cv_score"] == j["cv_score"] == 39.0
|
||||
assert (j["career"], j["career_capped"], j["broken"]) == (9, 4, 1)
|
||||
assert j["musts"] == musts and one["cv_score"] == j["cv_score"] == 40.0
|
||||
|
||||
|
||||
def test_a_met_or_unclear_must_have_leaves_career_as_the_model_gave_it(
|
||||
@@ -117,16 +117,16 @@ def test_a_met_or_unclear_must_have_leaves_career_as_the_model_gave_it(
|
||||
owner, uid = setup(store)
|
||||
musts = [{"id": "M1", "text": "Permanent", "verdict": "met"},
|
||||
{"id": "M2", "text": "Remote", "verdict": "unclear"}]
|
||||
store.set_judgement(owner.id, uid["c"], "k", 90, 90, 90, [], [], musts)
|
||||
store.set_judgement(owner.id, uid["c"], "k", 9, 9, 9, [], [], musts)
|
||||
j = client.get(f"/api/roles/{uid['c']}", params={"agent": owner.id}).json()["judgement"]
|
||||
assert (j["career"], j["career_capped"], j["broken"], j["cv_score"]) == (90, 90, 0, 90.0)
|
||||
assert (j["career"], j["career_capped"], j["broken"], j["cv_score"]) == (9, 9, 0, 90.0)
|
||||
|
||||
|
||||
def test_the_agents_weights_make_the_cv_score_at_read_time(
|
||||
client: TestClient, store: Store) -> None:
|
||||
owner, uid = setup(store)
|
||||
# c: skills 100, experience 0, career 0; b: 60 on all three.
|
||||
store.set_judgement(owner.id, uid["c"], "k", 100, 0, 0, ["Leads data."], ["Small team."])
|
||||
# c: skills 10, experience 0, career 0; b: 6 on all three.
|
||||
store.set_judgement(owner.id, uid["c"], "k", 10, 0, 0, ["Leads data."], ["Small team."])
|
||||
key_before = input_key(owner, "text")
|
||||
|
||||
def asked() -> tuple[list[tuple[str, float | None]], float | None]:
|
||||
@@ -150,7 +150,7 @@ def test_the_agents_weights_make_the_cv_score_at_read_time(
|
||||
assert [c for _, c in rows] == [None, None, None] and one is None
|
||||
assert [u for u, _ in rows] == [uid["a"], uid["b"], uid["c"]], "by score, as none is judged"
|
||||
assert client.get(f"/api/roles/{uid['c']}",
|
||||
params={"agent": owner.id}).json()["judgement"]["skills"] == 100
|
||||
params={"agent": owner.id}).json()["judgement"]["skills"] == 10
|
||||
refreshed = store.agent(owner.id)
|
||||
assert refreshed is not None and input_key(refreshed, "text") == key_before, \
|
||||
"the weights are no part of what the judge read"
|
||||
@@ -160,9 +160,9 @@ def test_the_weights_are_per_agent_json_with_the_old_values_as_default(store: St
|
||||
owner = store.save_agent("Data", prompts=[Prompt(name="Lead", text="Head of data")])
|
||||
assert (owner.weights.cv_skills, owner.weights.cv_experience,
|
||||
owner.weights.cv_career) == (30, 25, 30)
|
||||
assert cv_score(80, 60, 40, owner.weights) == round((2400 + 1500 + 1200) / 85, 1)
|
||||
assert cv_score(80, 60, 40, Weights(cv_skills=0, cv_experience=1, cv_career=1)) == 50.0
|
||||
assert cv_score(80, 60, 40, Weights(cv_skills=0, cv_experience=0, cv_career=0)) is None
|
||||
assert cv_score(8, 6, 4, owner.weights) == round(10 * (240 + 150 + 120) / 85, 1)
|
||||
assert cv_score(8, 6, 4, Weights(cv_skills=0, cv_experience=1, cv_career=1)) == 50.0
|
||||
assert cv_score(8, 6, 4, Weights(cv_skills=0, cv_experience=0, cv_career=0)) is None
|
||||
|
||||
|
||||
def test_a_row_carries_the_deadline_and_the_language_flag(
|
||||
@@ -199,7 +199,7 @@ def test_the_role_carries_its_judgement_and_languages(
|
||||
owner, uid = setup(store)
|
||||
role = client.get(f"/api/roles/{uid['c']}", params={"agent": owner.id}).json()
|
||||
judgement = role["judgement"]
|
||||
assert (judgement["skills"], judgement["cv_score"]) == (90, 90.0)
|
||||
assert (judgement["skills"], judgement["cv_score"]) == (9, 90.0)
|
||||
assert judgement["strengths"] == ["Leads data."] and judgement["gaps"] == ["Small team."]
|
||||
assert judgement["judged_at"]
|
||||
assert role["cv_score"] == 90.0 and role["lang_flag"] == "plus"
|
||||
|
||||
Reference in new issue
Block a user