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:
WolfandClaude Opus 5.5 committed 2026-10-04 21:40:32 +02:00
1 parent 6cad9713ac
commit 6d82287402
27 files changed
+390 -247

No files matched your search

+51 -9
View File
@@ -75,7 +75,7 @@ def test_new_agents_have_the_cut_by_default(store: Store) -> None:
made = store.save_agent("Data")
assert made.limits.model_dump() == {"cut_fit_top": 500, "cut_fit_min": 0.6,
"cut_cv_top": 150, "cut_cv_min": 0.6,
"summarise_top": 50}
"summarise_top": 30}
# --------------------------------------------------------------- migration
@@ -98,7 +98,7 @@ def test_v28_adds_the_cv_columns_and_the_host_deadline_and_runs_twice(tmp_path:
migrated = Store(path)
assert migrated.migrations_applied == [28, 29, 30, 31, 32]
assert migrated.migrations_applied == [28, 29, 30, 31, 32, 33]
rows = {r["source_id"]: r for r in migrated._rows(
"SELECT source_id, languages_required, deadline_host, deadline FROM roles")}
assert (rows["a"]["deadline_host"], rows["a"]["deadline"]) == ("2026-10-18", None)
@@ -110,7 +110,7 @@ def test_v28_adds_the_cv_columns_and_the_host_deadline_and_runs_twice(tmp_path:
assert migrated.role(posting("a").uid).deadline == "2026-10-18"
with sqlite3.connect(path) as conn:
conn.execute("PRAGMA user_version = 27")
assert Store(path).migrations_applied == [28, 29, 30, 31, 32]
assert Store(path).migrations_applied == [28, 29, 30, 31, 32, 33]
# ---------------------------------------------------------------- deadline
@@ -229,8 +229,9 @@ def test_the_language_flag() -> None:
def test_the_cv_score_weighs_skills_and_career_above_experience() -> None:
assert cv_score(100, 100, 100) == 100.0
assert cv_score(80, 60, 40) == round((2400 + 1500 + 1200) / 85, 1)
assert cv_score(10, 10, 10) == 100.0
assert cv_score(8, 6, 4) == round(10 * (240 + 150 + 120) / 85, 1)
assert cv_score(8, 6, 9, broken=1) == cv_score(8, 6, 4)
def test_a_stored_language_list_survives_a_bad_entry(store: Store) -> None:
@@ -251,12 +252,12 @@ def test_v29_adds_the_musts_and_broken_columns_and_runs_twice(tmp_path: Path) ->
conn.execute(f"ALTER TABLE role_judgements DROP COLUMN {column}")
conn.execute("PRAGMA user_version = 28")
assert Store(path).migrations_applied == [29, 30, 31, 32]
assert Store(path).migrations_applied == [29, 30, 31, 32, 33]
with sqlite3.connect(path) as conn:
columns = {r[1] for r in conn.execute("PRAGMA table_info(role_judgements)")}
assert {"musts", "broken"} <= columns
conn.execute("PRAGMA user_version = 28")
assert Store(path).migrations_applied == [29, 30, 31, 32]
assert Store(path).migrations_applied == [29, 30, 31, 32, 33]
def test_v30_adds_like_text_and_runs_twice(tmp_path: Path) -> None:
@@ -268,12 +269,53 @@ def test_v30_adds_like_text_and_runs_twice(tmp_path: Path) -> None:
migrated = Store(path)
assert migrated.migrations_applied == [30, 31, 32]
assert migrated.migrations_applied == [30, 31, 32, 33]
[data] = migrated.agents()
assert (data.like_text, data.avoid_text) == ("", "Reporting.")
with sqlite3.connect(path) as conn:
conn.execute("PRAGMA user_version = 29")
assert Store(path).migrations_applied == [30, 31, 32]
assert Store(path).migrations_applied == [30, 31, 32, 33]
def test_v33_clears_every_judgement_and_lowers_the_old_summarise_default(
tmp_path: Path) -> None:
"""A judgement on the 0 to 100 scale is never shown on the 0 to 10 one:
migration 33 clears every row and gives the tries back, and the judge
reads the pair again. `summarise_top` 50, migration 32's default, is 30;
any other value, and a limits object without the key, stay."""
path = tmp_path / "v32.db"
store = Store(path)
item = posting("1")
upsert(store, item)
old = store.save_agent("Old", "data leadership", cv_text="CV.")
own = store.save_agent("Own", "data leadership")
bare = store.save_agent("Bare", "data leadership")
musts = [{"id": "M1", "text": "Remote", "verdict": "broken"}]
assert store.set_judgement(old.id, item.uid, "key", 80, 70, 90, ["Good."], ["Bad."], musts)
store.judge_missed([(own.id, item.uid)])
with sqlite3.connect(path) as conn:
conn.execute("UPDATE agents SET limits = json_set(limits, '$.summarise_top', 50) "
"WHERE id = ?", (old.id,))
conn.execute("UPDATE agents SET limits = json_set(limits, '$.summarise_top', 12) "
"WHERE id = ?", (own.id,))
conn.execute("UPDATE agents SET limits = '{}' WHERE id = ?", (bare.id,))
conn.execute("PRAGMA user_version = 32")
for _ in range(2): # runs twice without harm
migrated = Store(path)
assert migrated.migrations_applied == [33]
assert migrated.judgement(old.id, item.uid) is None
with sqlite3.connect(path) as conn:
rows = conn.execute(
"SELECT skills, experience, career, cv_score, strengths, gaps, musts, broken, "
"input_key, tries, judged_at FROM role_judgements").fetchall()
assert rows == [(None, None, None, None, "[]", "[]", "[]", 0, "", 0, None)] * 2
conn.execute("PRAGMA user_version = 32")
assert {a.name: a.limits.summarise_top for a in migrated.agents()} == {
"Old": 30, "Own": 12, "Bare": 30}
with sqlite3.connect(path) as conn:
assert conn.execute("SELECT limits FROM agents WHERE id = ?",
(bare.id,)).fetchone() == ("{}",)
def test_the_musts_text_is_one_must_have_per_line() -> None: