Give an agent a CV, languages, avoid and must texts, and read a posting's languages with a level and its deadline (migration 28)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ed6d641373
commit
4fc474c437
15 files changed
+716
-79
No files matched your search
@@ -148,7 +148,7 @@ def test_migration_20_seeds_an_old_file_and_leaves_collisions(tmp_path: Path) ->
|
||||
"VALUES (?, ?, '', '')", (key, name))
|
||||
conn.execute("PRAGMA user_version = 19")
|
||||
reopened = Store(path)
|
||||
assert reopened.migrations_applied == [20, 21, 22, 23, 24, 25, 26, 27]
|
||||
assert reopened.migrations_applied == [20, 21, 22, 23, 24, 25, 26, 27, 28]
|
||||
assert reopened.duplicate_companies() == [("orsted", ["orsted", "ørsted"])]
|
||||
assert len(reopened.companies()) == 3
|
||||
|
||||
@@ -186,7 +186,7 @@ def test_migration_21_tags_the_favourites_and_the_boards_that_read_all_roles(tmp
|
||||
conn.execute("ALTER TABLE companies DROP COLUMN all_countries")
|
||||
conn.execute("PRAGMA user_version = 20")
|
||||
reopened = Store(path)
|
||||
assert reopened.migrations_applied == [21, 22, 23, 24, 25, 26, 27]
|
||||
assert reopened.migrations_applied == [21, 22, 23, 24, 25, 26, 27, 28]
|
||||
# The tag of 21 is All countries and All roles since 24.
|
||||
tagged = {"mistral-ai": 1, "acme": 0, "black-forest-labs": 1, "liked": 0}
|
||||
assert {c.key: c.all_roles for c in reopened.companies()} == tagged
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
"""The CV match's fields: an agent's CV, languages, avoid and must texts,
|
||||
migration 28, the deadline from host and model, the languages extract reads
|
||||
with a level, and the language flag. Nothing here reaches a model."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import sqlite3
|
||||
from datetime import UTC, datetime
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
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.storage import Store
|
||||
from desk import modeltask
|
||||
from desk.models import Item
|
||||
from desk.tools import agent
|
||||
from prepped import upsert
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def store(tmp_path: Path) -> Store:
|
||||
return Store(tmp_path / "roledesk.db")
|
||||
|
||||
|
||||
def posting(source_id: str, body: str = "We build things.", **raw: object) -> Item:
|
||||
item = Item(source_id=source_id, location=f"https://boards.example/{source_id}",
|
||||
title="Head of Data", body=body,
|
||||
published_at=datetime(2026, 9, 20, tzinfo=UTC), raw=dict(raw))
|
||||
item.source = "search"
|
||||
return item
|
||||
|
||||
|
||||
# ------------------------------------------------------------------ agents
|
||||
|
||||
def test_an_agent_keeps_its_cv_fields_when_a_save_leaves_them_out(store: Store) -> None:
|
||||
made = store.save_agent("Data", "data leadership", cv_text=" VP Data. ",
|
||||
cv_languages=[CvLanguage(language="DA", level="native"),
|
||||
CvLanguage(language="en", level="fluent"),
|
||||
CvLanguage(language="da", level="basic")],
|
||||
avoid_text="Pure reporting.", must_text="Permanent contract.")
|
||||
assert made.cv_text == "VP Data."
|
||||
assert [(lang.language, lang.level) for lang in made.cv_languages] == \
|
||||
[("da", "native"), ("en", "fluent")]
|
||||
assert (made.avoid_text, made.must_text) == ("Pure reporting.", "Permanent contract.")
|
||||
|
||||
kept = store.save_agent("Data", "data leadership", agent_id=made.id)
|
||||
assert (kept.cv_text, kept.avoid_text, kept.must_text) == \
|
||||
("VP Data.", "Pure reporting.", "Permanent contract.")
|
||||
assert len(kept.cv_languages) == 2
|
||||
|
||||
cleared = store.save_agent("Data", "data leadership", agent_id=made.id, cv_text="",
|
||||
cv_languages=[], avoid_text="", must_text="")
|
||||
assert (cleared.cv_text, cleared.cv_languages, cleared.avoid_text, cleared.must_text) \
|
||||
== ("", [], "", "")
|
||||
|
||||
|
||||
def test_a_cv_language_is_a_code_and_a_level_of_the_ladder() -> None:
|
||||
with pytest.raises(ValidationError):
|
||||
CvLanguage(language="Danish", level="native")
|
||||
with pytest.raises(ValidationError):
|
||||
CvLanguage(language="da", level="good")
|
||||
|
||||
|
||||
def test_new_agents_have_judge_limits_by_default(store: Store) -> None:
|
||||
made = store.save_agent("Data")
|
||||
assert (made.limits.judge_top, made.limits.judge_min) == (150, 0.55)
|
||||
|
||||
|
||||
# --------------------------------------------------------------- migration
|
||||
|
||||
def test_v28_adds_the_cv_columns_and_the_host_deadline_and_runs_twice(tmp_path: Path) -> None:
|
||||
path = tmp_path / "v27.db"
|
||||
store = Store(path)
|
||||
store.save_agent("Data", "data leadership")
|
||||
store.upsert_role(posting("a", applicationDeadline="2026-10-18T00:00:00"))
|
||||
store.upsert_role(posting("b"))
|
||||
with sqlite3.connect(path) as conn:
|
||||
conn.execute("DROP INDEX idx_roles_deadline")
|
||||
conn.execute("DROP INDEX idx_role_judgements_agent")
|
||||
conn.execute("DROP TABLE role_judgements")
|
||||
for column in ("languages_required", "deadline_host", "deadline_model", "deadline"):
|
||||
conn.execute(f"ALTER TABLE roles DROP COLUMN {column}")
|
||||
for column in ("cv_text", "cv_languages", "avoid_text", "must_text"):
|
||||
conn.execute(f"ALTER TABLE agents DROP COLUMN {column}")
|
||||
conn.execute("PRAGMA user_version = 27")
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [28]
|
||||
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)
|
||||
assert rows["a"]["languages_required"] is None and rows["b"]["deadline_host"] == ""
|
||||
[data] = migrated.agents()
|
||||
assert (data.cv_text, data.cv_languages, data.avoid_text, data.must_text) == \
|
||||
("", [], "", "")
|
||||
prep.run(migrated, remap=True, dupes=False)
|
||||
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]
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- deadline
|
||||
|
||||
def test_iso_day_reads_a_date_or_a_timestamp() -> None:
|
||||
assert iso_day("2026-10-18T00:00:00") == "2026-10-18"
|
||||
assert iso_day("2026-10-18") == "2026-10-18"
|
||||
assert iso_day("18.10.2026") == iso_day("2026-13-01") == iso_day(None) == ""
|
||||
|
||||
|
||||
def test_the_deadline_is_the_hosts_first_then_the_models(store: Store) -> None:
|
||||
host = posting("host", applicationDeadline="2026-10-18T00:00:00")
|
||||
model = posting("model")
|
||||
upsert(store, host)
|
||||
upsert(store, model)
|
||||
store.set_extracted(host.uid, {"deadline": "2026-11-01"})
|
||||
store.set_extracted(model.uid, {"deadline": "2026-11-01"})
|
||||
prep.run_roles(store, [host.uid, model.uid])
|
||||
assert store.role(host.uid).deadline == "2026-10-18"
|
||||
assert store.role(model.uid).deadline == "2026-11-01"
|
||||
|
||||
# A pull whose host no longer states one leaves the model's.
|
||||
upsert(store, posting("host"))
|
||||
assert store.role(host.uid).deadline == "2026-11-01"
|
||||
|
||||
|
||||
# ----------------------------------------------------------------- extract
|
||||
|
||||
class Model:
|
||||
def __init__(self, reply: Any) -> None:
|
||||
self.reply = reply
|
||||
self.asked: list[list[dict[str, Any]]] = []
|
||||
|
||||
def __call__(self, settings: Any, **kwargs: Any) -> agent.Reply:
|
||||
roles = kwargs["question"]["roles"]
|
||||
self.asked.append(roles)
|
||||
return agent.Reply(data={"roles": self.reply(roles)}, backend="api")
|
||||
|
||||
|
||||
def answer(uid: str, **fields: Any) -> dict[str, Any]:
|
||||
return {"uid": uid, "place": "", "country": "", "remote": "", "remote_where": [],
|
||||
"seniority": "director", "salary_min": None, "salary_max": None,
|
||||
"currency": "", "function": "", "permit": "", "languages_required": [],
|
||||
"deadline": "", **fields}
|
||||
|
||||
|
||||
def test_extract_reads_levels_kinds_and_the_deadline(
|
||||
store: Store, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
item = posting("1")
|
||||
upsert(store, item)
|
||||
store.replace_scores(store.save_agent("Data", "data").id, [(item.uid, 0.9, "")])
|
||||
model = Model(lambda roles: [answer(r["uid"], deadline="2026-10-30", languages_required=[
|
||||
{"language": "DA", "level": "fluent", "kind": "required"},
|
||||
{"language": "en", "level": "", "kind": "required"},
|
||||
{"language": "sv", "level": "excellent", "kind": "plus"},
|
||||
{"language": "da", "level": "basic", "kind": "plus"},
|
||||
{"language": "danish", "level": "", "kind": "required"}]) for r in roles])
|
||||
monkeypatch.setattr(agent, "backend", lambda settings: "api")
|
||||
monkeypatch.setattr(agent, "ask_json", model)
|
||||
config = Config(database=str(tmp_path / "roledesk.db"), extract={"enabled": True})
|
||||
|
||||
modeltask.run(extract.TASK, config, store)
|
||||
|
||||
role = store.role(item.uid)
|
||||
assert role.languages == ["da", "en"]
|
||||
assert [lang.model_dump() for lang in role.languages_required] == [
|
||||
{"language": "da", "level": "fluent", "kind": "required"},
|
||||
{"language": "en", "level": "", "kind": "required"},
|
||||
{"language": "sv", "level": "", "kind": "plus"}]
|
||||
assert role.deadline == "2026-10-30"
|
||||
assert model.asked[0][0]["posted"] == role.posted_at[:10]
|
||||
assert store.extract_pending() == 0
|
||||
|
||||
|
||||
def test_a_role_extracted_before_is_read_once_more_for_the_new_fields(store: Store) -> None:
|
||||
item = posting("1")
|
||||
upsert(store, item)
|
||||
store.replace_scores(store.save_agent("Data", "data").id, [(item.uid, 0.9, "")])
|
||||
store.set_extracted(item.uid, {"seniority": "director"})
|
||||
assert store.extract_pending() == 0
|
||||
with store.transaction() as conn:
|
||||
conn.execute("UPDATE roles SET languages_required = NULL")
|
||||
assert store.extract_pending() == 1
|
||||
|
||||
|
||||
def test_the_excerpt_keeps_the_opening_and_the_closing_lines() -> None:
|
||||
short = "word " * 100
|
||||
assert extract.excerpt(short) == short.strip()
|
||||
long = "A" * 3000 + " " + "Z" * 3000
|
||||
cut = extract.excerpt(long)
|
||||
assert cut.startswith("A" * extract.HEAD) and cut.endswith("Z" * extract.TAIL)
|
||||
assert len(cut) == extract.HEAD + extract.TAIL + 3
|
||||
|
||||
|
||||
# ------------------------------------------------------------------- flags
|
||||
|
||||
def langs(*pairs: tuple[str, str]) -> list[CvLanguage]:
|
||||
return [CvLanguage(language=code, level=level) for code, level in pairs]
|
||||
|
||||
|
||||
def asks(*triples: tuple[str, str, str]) -> list[RoleLanguage]:
|
||||
return [RoleLanguage(language=code, level=level, kind=kind) for code, level, kind in triples]
|
||||
|
||||
|
||||
def test_the_language_flag() -> None:
|
||||
mine = langs(("da", "native"), ("en", "fluent"), ("de", "professional"))
|
||||
assert language_flag(asks(("sv", "fluent", "required")), mine) == \
|
||||
("missing", "requires Swedish (fluent); yours: none")
|
||||
assert language_flag(asks(("de", "fluent", "required")), mine) == \
|
||||
("below", "requires German (fluent); yours: professional")
|
||||
assert language_flag(asks(("de", "", "required"), ("da", "", "plus")), mine) == \
|
||||
("plus", "Danish is a plus; yours: native")
|
||||
assert language_flag(asks(("en", "fluent", "required"), ("fr", "", "plus")), mine) == \
|
||||
("", "")
|
||||
assert language_flag(asks(("sv", "fluent", "required")), []) == ("", "")
|
||||
|
||||
|
||||
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)
|
||||
|
||||
|
||||
def test_a_stored_language_list_survives_a_bad_entry(store: Store) -> None:
|
||||
item = posting("1")
|
||||
upsert(store, item)
|
||||
with store.transaction() as conn:
|
||||
conn.execute("UPDATE roles SET languages_required = ? WHERE uid = ?",
|
||||
(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"]
|
||||
@@ -261,7 +261,7 @@ def test_a_v17_file_gains_dup_of_with_its_first_rebuild(tmp_path: Path) -> None:
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [18, 19, 20, 21, 22, 23, 24, 25, 26, 27]
|
||||
assert migrated.migrations_applied == [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]
|
||||
assert dup_of(migrated) == {first.uid: None, second.uid: first.uid}
|
||||
with sqlite3.connect(path) as conn:
|
||||
assert conn.execute("SELECT 1 FROM sqlite_master WHERE name = 'idx_roles_dup_of'"
|
||||
|
||||
@@ -32,7 +32,7 @@ def answer(uid: str, **fields: Any) -> dict[str, Any]:
|
||||
empty: dict[str, Any] = {
|
||||
"place": "", "country": "", "remote": "", "seniority": "", "salary_min": None,
|
||||
"salary_max": None, "currency": "", "function": "", "permit": "",
|
||||
"languages_required": []}
|
||||
"languages_required": [], "deadline": ""}
|
||||
return {"uid": uid, **empty, **fields}
|
||||
|
||||
|
||||
@@ -139,7 +139,8 @@ def test_closed_and_answered_roles_are_not_offered(
|
||||
conn.execute("UPDATE roles SET closed_at = '2026-09-22T00:00:00+00:00' "
|
||||
"WHERE source_id = 'closed'")
|
||||
conn.execute("UPDATE roles SET extracted_at = '2026-09-22T00:00:00+00:00', "
|
||||
"seniority_model = 'senior', remote_where_model = '[]' "
|
||||
"seniority_model = 'senior', remote_where_model = '[]', "
|
||||
"languages_required = '[]' "
|
||||
"WHERE source_id = 'done'")
|
||||
model = stub(monkeypatch, lambda roles: [answer(r["uid"]) for r in roles])
|
||||
|
||||
|
||||
@@ -434,7 +434,7 @@ def test_migration_23_gives_every_agent_no_terms(tmp_path: Path) -> None:
|
||||
conn.execute("ALTER TABLE agents DROP COLUMN fetch_terms")
|
||||
conn.execute("PRAGMA user_version = 22")
|
||||
migrated = Store(path)
|
||||
assert migrated.migrations_applied == [23, 24, 25, 26, 27]
|
||||
assert migrated.migrations_applied == [23, 24, 25, 26, 27, 28]
|
||||
assert migrated.agents()[0].fetch_terms == []
|
||||
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ def test_migration_24_splits_the_tag_and_moves_terms_off(tmp_path: Path) -> None
|
||||
conn.execute("UPDATE companies SET all_roles=1 WHERE key='mistral-ai'")
|
||||
conn.execute("PRAGMA user_version = 23")
|
||||
migrated = Store(path)
|
||||
assert migrated.migrations_applied == [24, 25, 26, 27]
|
||||
assert migrated.migrations_applied == [24, 25, 26, 27, 28]
|
||||
flags = {c.key: (c.all_countries, c.all_roles) for c in migrated.companies()}
|
||||
assert flags == {"mistral-ai": (1, 1), "acme": (0, 1), "plain": (0, 0)}
|
||||
params = {s.target: s.params for s in migrated.subscriptions(source="ats")}
|
||||
|
||||
+1
-1
@@ -316,7 +316,7 @@ def test_migration_22_fills_the_host_words_from_raw(tmp_path: Path) -> None:
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [22, 23, 24, 25, 26, 27]
|
||||
assert migrated.migrations_applied == [22, 23, 24, 25, 26, 27, 28]
|
||||
one = row(migrated, "1")
|
||||
assert (one["seniority_host"], one["employment_host"], one["remote_host"],
|
||||
one["country_host"]) == ("senior", "full_time", "true", "DK")
|
||||
|
||||
@@ -530,7 +530,7 @@ def test_migration_27_keeps_an_older_readers_remote_as_the_hosts_word(tmp_path:
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [27]
|
||||
assert migrated.migrations_applied == [27, 28]
|
||||
assert migrated.gazetteer().anywhere is not None
|
||||
row = migrated._row("SELECT remote_host, remote_model, remote_where_model FROM roles "
|
||||
"WHERE uid = ?", (board,))
|
||||
@@ -540,7 +540,7 @@ def test_migration_27_keeps_an_older_readers_remote_as_the_hosts_word(tmp_path:
|
||||
assert area(migrated, search.uid) == ("", "")
|
||||
with sqlite3.connect(path) as conn:
|
||||
conn.execute("PRAGMA user_version = 26")
|
||||
assert Store(path).migrations_applied == [27]
|
||||
assert Store(path).migrations_applied == [27, 28]
|
||||
|
||||
|
||||
def test_a_role_waits_for_extract_until_it_was_asked_where(store: Store) -> None:
|
||||
|
||||
+10
-10
@@ -70,7 +70,7 @@ def test_schema_creates_on_an_empty_file(tmp_path: Path) -> None:
|
||||
"application_events", "agents", "scores", "state"} <= tables
|
||||
assert "idx_roles_cluster" in indexes
|
||||
assert store.migrations_applied == []
|
||||
assert LATEST == 27
|
||||
assert LATEST == 28
|
||||
# A second open finds it current and applies nothing.
|
||||
assert Store(path).migrations_applied == []
|
||||
|
||||
@@ -173,7 +173,7 @@ def test_a_v1_file_migrates_to_the_shape_a_new_file_has(tmp_path: Path) -> None:
|
||||
assert Store(old).migrations_applied == list(range(2, LATEST + 1))
|
||||
# ALTER appends, so the order differs; every read is by column name.
|
||||
for table in ("roles", "agents", "agent_prompts", "scores", "vectors", "companies",
|
||||
"role_tags", "agent_companies", "role_votes"):
|
||||
"role_tags", "agent_companies", "role_votes", "role_judgements"):
|
||||
assert sorted(_columns(old, table)) == sorted(_columns(fresh, table))
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ def test_a_v14_file_gains_the_watchlist_columns_and_leaves_companies_unrated(
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]
|
||||
assert migrated.migrations_applied == [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]
|
||||
acme = migrated.company("acme")
|
||||
assert acme is not None
|
||||
assert (acme.ats, acme.careers_url) == ("teamtailor", "https://a.example")
|
||||
@@ -392,7 +392,7 @@ def test_v14_makes_each_intent_the_agents_one_prompt_with_its_vector(tmp_path: P
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]
|
||||
assert migrated.migrations_applied == [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]
|
||||
assert migrated.agent(backend.id).prompts == [ # type: ignore[union-attr]
|
||||
Prompt(name="Backend", text="python backend")]
|
||||
assert migrated.agent(blank.id).prompts == [] # type: ignore[union-attr]
|
||||
@@ -416,7 +416,7 @@ def test_v16_gives_a_company_no_reason_and_keeps_its_row(tmp_path: Path) -> None
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]
|
||||
assert migrated.migrations_applied == [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]
|
||||
acme = migrated.company("acme")
|
||||
assert acme is not None
|
||||
assert (acme.careers_url, acme.notes, acme.hand_reason) == (
|
||||
@@ -445,7 +445,7 @@ def test_v17_folds_every_place_and_levels_the_titles_extract_has_not_read(
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]
|
||||
assert migrated.migrations_applied == [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]
|
||||
with sqlite3.connect(path) as conn:
|
||||
rows = {uid: (fold, level) for uid, fold, level in conn.execute(
|
||||
"SELECT uid, place_fold, seniority FROM roles")}
|
||||
@@ -688,7 +688,7 @@ def test_v19_gives_every_role_its_places_and_splits_its_level(tmp_path: Path) ->
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [19, 20, 21, 22, 23, 24, 25, 26, 27]
|
||||
assert migrated.migrations_applied == [19, 20, 21, 22, 23, 24, 25, 26, 27, 28]
|
||||
assert [p.name for p in migrated.role_places(joined.uid)] == ["Copenhagen", "Malmö"]
|
||||
assert [p.name for p in migrated.role_places(detailed.uid)] == ["Aarhus"]
|
||||
assert migrated.role_places(stated.uid) == []
|
||||
@@ -730,7 +730,7 @@ def test_v25_clears_the_model_levels_the_ladder_splits_and_sets_the_level(
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [25, 26, 27]
|
||||
assert migrated.migrations_applied == [25, 26, 27, 28]
|
||||
with sqlite3.connect(path) as conn:
|
||||
found = {sid: rest for sid, *rest in conn.execute(
|
||||
"SELECT source_id, seniority_model, seniority_stated, seniority_title, seniority "
|
||||
@@ -748,12 +748,12 @@ def test_v26_adds_posting_url_empty_and_runs_twice_without_harm(tmp_path: Path)
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [26, 27]
|
||||
assert migrated.migrations_applied == [26, 27, 28]
|
||||
role = migrated.role(posting("a").uid)
|
||||
assert role is not None and role.posting_url == ""
|
||||
with sqlite3.connect(path) as conn:
|
||||
conn.execute("PRAGMA user_version = 25") # the column is there already
|
||||
assert Store(path).migrations_applied == [26, 27]
|
||||
assert Store(path).migrations_applied == [26, 27, 28]
|
||||
|
||||
|
||||
def test_a_pull_keeps_the_posting_url(store: Store) -> None:
|
||||
|
||||
+6
-3
@@ -1182,8 +1182,10 @@ def test_an_agents_limits_are_saved_listed_and_checked(client: TestClient) -> No
|
||||
0..1 is 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}
|
||||
narrow = {"extract_top": 50, "extract_min": 0.6, "summarise_top": 5, "summarise_min": 0.7}
|
||||
"summarise_top": 30, "summarise_min": 0.65,
|
||||
"judge_top": 150, "judge_min": 0.55}
|
||||
narrow = {"extract_top": 50, "extract_min": 0.6, "summarise_top": 5, "summarise_min": 0.7,
|
||||
"judge_top": 20, "judge_min": 0.6}
|
||||
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]
|
||||
@@ -1227,7 +1229,8 @@ def test_list_roles_serves_the_row_projection_and_not_the_big_columns(
|
||||
"uid", "company_key", "company", "title", "place", "country", "remote", "function",
|
||||
"seniority", "salary_min", "salary_max", "currency", "salary_text", "salary_state",
|
||||
"original_url", "posting_url", "posted_at", "score", "gated_reason", "prompt", "vote",
|
||||
"voted_at", "read_at", "tags", "excerpt", "copies", "remote_where",
|
||||
"voted_at", "read_at", "tags", "excerpt", "copies", "remote_where", "deadline",
|
||||
"lang_flag", "lang_note", "cv_score",
|
||||
}
|
||||
assert row["uid"] == uid
|
||||
assert row["company"] == "Acme" and row["place"] == "Berlin, Germany"
|
||||
|
||||
Reference in new issue
Block a user