Let the model report a verdict per must-have and cap career at 39 in code when one is broken
The judge numbers an agent's must-haves (one per line) and answers met, broken or unclear for each; career is stored as the model gave it and counts as at most BROKEN_CAP when a role is served, in cv_score, Store.judgement and the SQL of Best CV match. Migration 29 adds role_judgements.musts and broken; the judge's input_key carries a format version so earlier judgements are made again. The reader lists the must-haves with their verdicts and the cap. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
64fecf57ad
commit
001fc9002b
19 files changed
+336
-61
No files matched your search
+25
-3
@@ -16,7 +16,7 @@ from pydantic import ValidationError
|
||||
from app import prep
|
||||
from app.config import Config
|
||||
from app.jobs import extract
|
||||
from app.models import CvLanguage, RoleLanguage, cv_score, iso_day, language_flag
|
||||
from app.models import CvLanguage, RoleLanguage, cv_score, iso_day, language_flag, must_lines
|
||||
from app.storage import Store
|
||||
from desk import modeltask
|
||||
from desk.models import Item
|
||||
@@ -93,7 +93,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]
|
||||
assert migrated.migrations_applied == [28, 29]
|
||||
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)
|
||||
@@ -105,7 +105,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]
|
||||
assert Store(path).migrations_applied == [28, 29]
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- deadline
|
||||
@@ -236,3 +236,25 @@ def test_a_stored_language_list_survives_a_bad_entry(store: Store) -> None:
|
||||
(json.dumps([{"language": "da", "level": "fluent", "kind": "required"},
|
||||
{"language": "en", "level": "superb"}]), item.uid))
|
||||
assert [lang.language for lang in store.role(item.uid).languages_required] == ["da"]
|
||||
|
||||
|
||||
def test_v29_adds_the_musts_and_broken_columns_and_runs_twice(tmp_path: Path) -> None:
|
||||
path = tmp_path / "v28.db"
|
||||
Store(path)
|
||||
with sqlite3.connect(path) as conn:
|
||||
for column in ("musts", "broken"):
|
||||
conn.execute(f"ALTER TABLE role_judgements DROP COLUMN {column}")
|
||||
conn.execute("PRAGMA user_version = 28")
|
||||
|
||||
assert Store(path).migrations_applied == [29]
|
||||
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]
|
||||
|
||||
|
||||
def test_the_musts_text_is_one_must_have_per_line() -> None:
|
||||
assert must_lines("- A\n* B c\n\u2022 D\n1. E\n2) F\n \nG\n-H") == [
|
||||
"A", "B c", "D", "E", "F", "G", "-H"]
|
||||
assert must_lines("") == []
|
||||
Reference in new issue
Block a user