Score each role's closeness to the agent's CV, let the judge also read the 50 closest the score leaves out, and order CV match's unjudged roles by it

The CV is cut into chunks inside e5's window, embedded like a prompt and
cached per agent under a hash of the model, chunking and text. A role's
cv_fit (scores.cv_fit, migration 31) is its best chunk cosine, scaled with
its own calibration band: fit's clipped 88 of agent 2's ungated roles to 1.
It is no term of the Agent match score. judge_cv_top (default 50) sits
beside judge_top and judge_min on the agents page and card.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-10-03 23:35:21 +02:00
1 parent b481cb5692
commit c23594507a
23 files changed
+603 -85

No files matched your search

+2 -2
View File
@@ -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, 28, 29, 30]
assert reopened.migrations_applied == [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
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, 28, 29, 30]
assert reopened.migrations_applied == [21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
# 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
+6 -6
View File
@@ -96,7 +96,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]
assert migrated.migrations_applied == [28, 29, 30, 31]
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)
@@ -108,7 +108,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]
assert Store(path).migrations_applied == [28, 29, 30, 31]
# ---------------------------------------------------------------- deadline
@@ -249,12 +249,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]
assert Store(path).migrations_applied == [29, 30, 31]
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]
assert Store(path).migrations_applied == [29, 30, 31]
def test_v30_adds_like_text_and_runs_twice(tmp_path: Path) -> None:
@@ -266,12 +266,12 @@ def test_v30_adds_like_text_and_runs_twice(tmp_path: Path) -> None:
migrated = Store(path)
assert migrated.migrations_applied == [30]
assert migrated.migrations_applied == [30, 31]
[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]
assert Store(path).migrations_applied == [30, 31]
def test_the_musts_text_is_one_must_have_per_line() -> None:
+286
View File
@@ -0,0 +1,286 @@
"""CV closeness: the CV cut into chunks, embedded and cached like the
prompts, each role's `cv_fit` beside its score, the judge window it widens and
the CV match order of the roles not judged yet. The embedder is a fake;
nothing here downloads a model or reaches a board."""
from __future__ import annotations
import sqlite3
from collections.abc import Iterator, Sequence
from datetime import UTC, datetime
from pathlib import Path
from typing import Any
import numpy as np
import pytest
from app.config import CALIBRATION, Calibration, Config
from app.jobs import embed, judge, score
from app.models import Gate, Limits, Prompt
from app.storage import Store
from app.storage.schema import MIGRATIONS
from desk.models import Item
from pipeline import RunContext
from prepped import upsert
NOW = datetime(2026, 10, 3, 9, 0, tzinfo=UTC)
E5 = CALIBRATION["intfloat/multilingual-e5-small"]
WORDS = ("backend", "python", "frontend", "react", "data")
class FakeEmbedder:
"""One dimension per word of `WORDS` and a constant one, as in
test_score; records what it was asked to encode."""
model_id = "fake"
def __init__(self) -> None:
self.calls: list[list[str]] = []
def encode(self, texts: Sequence[str]) -> np.ndarray:
self.calls.append(list(texts))
rows = []
for text in texts:
lower = text.lower()
vec = np.asarray([lower.count(w) for w in WORDS] + [0.1], dtype=np.float32)
rows.append(vec / np.linalg.norm(vec))
return np.vstack(rows)
@pytest.fixture
def fake(monkeypatch: pytest.MonkeyPatch) -> FakeEmbedder:
embedder = FakeEmbedder()
monkeypatch.setattr(embed, "load_embedder", lambda model: embedder)
return embedder
@pytest.fixture
def store(tmp_path: Path) -> Iterator[Store]:
s = Store(tmp_path / "roledesk.db")
s.clock = lambda: NOW
yield s
@pytest.fixture
def config(tmp_path: Path) -> Config:
return Config(database=str(tmp_path / "roledesk.db"),
embed={"model": "fake", "calibration": {"fake": E5.model_dump()}})
def role(store: Store, source_id: str, title: str, body: str = "", **raw: Any) -> str:
item = Item(source_id=source_id, location=f"https://boards.example/{source_id}",
title=title, body=body or title, published_at=datetime(2026, 9, 30, tzinfo=UTC),
raw={"company": "Acme", **raw})
item.source = "ats"
upsert(store, item)
return item.uid
def run(config: Config, store: Store, job: Any) -> dict[str, Any]:
return dict(job(config, store, context=RunContext()))
def cv_fits(store: Store, agent_id: int) -> dict[str, float | None]:
with store.transaction() as conn:
return dict(conn.execute(
"SELECT uid, cv_fit FROM scores WHERE agent_id = ?", (agent_id,)).fetchall())
def level(text: str, against: str) -> float:
role_vec, other = FakeEmbedder().encode([text, against])
lo, hi = E5.cv_band
return min(max((score.cosine(role_vec, other) - lo) / (hi - lo), 0.0), 1.0)
# ------------------------------------------------------------------ chunks
def test_a_cv_is_cut_at_paragraphs_and_joined_again_up_to_the_limit() -> None:
cv = "Experience\n\nLed data.\n\n\n Skills: Python \n\n"
assert embed.cv_chunks(cv, limit=40) == ["Experience\n\nLed data.\n\nSkills: Python"]
assert embed.cv_chunks(cv, limit=21) == ["Experience\n\nLed data.", "Skills: Python"]
assert embed.cv_chunks(" \n\n ") == []
def test_a_long_paragraph_is_cut_by_line_then_sentence_then_word() -> None:
lines = "\n".join(["a" * 30, "b" * 30, "c" * 30])
assert embed.cv_chunks(lines, limit=65) == ["a" * 30 + "\n" + "b" * 30, "c" * 30]
sentences = "One two three. Four five six. Seven eight nine."
assert embed.cv_chunks(sentences, limit=30) == ["One two three. Four five six.",
"Seven eight nine."]
words = " ".join(["word"] * 20)
found = embed.cv_chunks(words, limit=24)
assert all(len(c) <= 24 for c in found) and " ".join(found) == words
assert embed.cv_chunks("x" * 50, limit=20) == ["x" * 20, "x" * 20, "x" * 10]
def test_no_chunk_of_a_long_cv_runs_past_the_model_window() -> None:
cv = "\n\n".join(f"Role {n}. " + "Built Python data platforms. " * 60 for n in range(5))
found = embed.cv_chunks(cv)
assert found and all(len(c) <= embed.CV_CHUNK_CHARS for c in found)
# ------------------------------------------------------------------- score
def test_the_cv_band_is_its_own_and_falls_back_to_fits() -> None:
assert E5.cv is not None and E5.cv_band == E5.cv != E5.fit
assert Calibration(fit=(0.7, 0.9), taste=(-0.1, 0.2)).cv_band == (0.7, 0.9)
with pytest.raises(ValueError):
Calibration(fit=(0.7, 0.9), taste=(-0.1, 0.2), cv=(0.9, 0.8))
def test_cv_fit_is_the_best_chunk_scaled_with_the_cv_band_and_no_term_of_the_score(
store: Store, config: Config, fake: FakeEmbedder) -> None:
backend = role(store, "1", "Backend Python")
frontend = role(store, "2", "Frontend React")
cv = "Backend engineer, python services.\n\nSome react on the side."
plain = store.save_agent("Plain", prompts=[Prompt(name="Data", text="data")])
with_cv = store.save_agent("With CV", prompts=[Prompt(name="Data", text="data")],
cv_text=cv)
run(config, store, embed.run_embed)
run(config, store, score.run_score)
texts = {uid: embed.document(r) for uid in (backend, frontend)
if (r := store.role(uid)) is not None}
chunks = embed.cv_chunks(cv)
assert len(chunks) == 1, "two short paragraphs are one chunk"
fits = cv_fits(store, with_cv.id)
for uid in (backend, frontend):
assert fits[uid] == pytest.approx(max(level(texts[uid], c) for c in chunks), abs=1e-6)
assert fits[backend] > fits[frontend]
assert set(cv_fits(store, plain.id).values()) == {None}, "no CV, no closeness"
assert store.scores(plain.id) == store.scores(with_cv.id), "not a term of the score"
def test_the_best_chunk_wins(store: Store, config: Config, fake: FakeEmbedder,
monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(embed, "CV_CHUNK_CHARS", 20)
uid = role(store, "1", "Frontend React")
owner = store.save_agent("CV", prompts=[Prompt(name="P", text="data")],
cv_text="Backend python python.\n\nFrontend react work.")
run(config, store, embed.run_embed)
run(config, store, score.run_score)
text = embed.document(store.role(uid)) # type: ignore[arg-type]
assert cv_fits(store, owner.id)[uid] == pytest.approx(
level(text, "Frontend react work."), abs=1e-6)
def test_a_gated_role_and_a_role_without_a_vector_have_no_cv_fit(
store: Store, config: Config, fake: FakeEmbedder) -> None:
kept = role(store, "1", "Backend Python", country="DK")
gated = role(store, "2", "Backend Python", country="SE")
owner = store.save_agent("CV", prompts=[Prompt(name="P", text="python")],
gates=[Gate(field="country", values=["DK"])],
cv_text="Backend python.")
run(config, store, embed.run_embed)
later = role(store, "3", "Backend Python later", country="DK")
run(config, store, score.run_score)
fits = cv_fits(store, owner.id)
assert fits[kept] is not None and fits[gated] is None and fits[later] is None
def test_the_cv_is_embedded_once_per_text_with_the_query_prefix(
store: Store, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
embedder = FakeEmbedder()
monkeypatch.setattr(embed, "load_embedder", lambda model: embedder)
config = Config(database=str(tmp_path / "roledesk.db"),
embed={"model": "intfloat/multilingual-e5-small"})
role(store, "1", "Backend Python")
owner = store.save_agent("CV", prompts=[Prompt(name="P", text="python")],
cv_text="Backend python.")
run(config, store, score.run_score)
assert embedder.calls == [["query: python"], ["query: Backend python."]]
embedder.calls.clear()
run(config, store, score.run_score)
assert embedder.calls == [], "an unchanged CV is read from the cache"
store.save_agent("CV", prompts=owner.prompts, agent_id=owner.id, cv_text="Frontend react.")
run(config, store, score.run_score)
assert embedder.calls == [["query: Frontend react."]]
key = score.cv_key("intfloat/multilingual-e5-small", "Frontend react.")
assert store.cv_vectors(owner.id, key) is not None
assert store.cv_vectors(owner.id, "stale") is None
# ------------------------------------------------------------------- judge
def ranked(store: Store, owner: Any, rows: Sequence[tuple[str, float, str, float | None]]
) -> list[str]:
uids = [role(store, sid, f"Head of AI {sid}", "Lead the data science team.")
for sid, _, _, _ in rows]
store.replace_scores(owner.id, [(uid, value, reason, "", fit)
for uid, (_, value, reason, fit) in zip(uids, rows,
strict=True)])
return uids
def window(store: Store) -> list[str]:
return [row["uid"] for _, row, _, _ in judge.waiting(store)]
def test_the_judge_also_reads_the_closest_to_the_cv_the_score_leaves_out(
store: Store) -> None:
owner = store.save_agent("Data", prompts=[Prompt(name="AI", text="Head of AI")],
cv_text="VP Data.",
limits=Limits(judge_top=2, judge_min=0.5, judge_cv_top=2))
top, second, low, near, nearer, nearest_gated, far = ranked(store, owner, [
("top", 0.9, "", 0.1), ("second", 0.8, "", 0.99), ("low", 0.4, "", 0.2),
("near", 0.3, "", 0.6), ("nearer", 0.2, "", 0.7), ("gated", 0.0, "country SE", None),
("far", 0.1, "", 0.05)])
assert window(store) == [top, second, nearer, near]
store.save_agent("Data", prompts=owner.prompts, agent_id=owner.id,
limits=Limits(judge_top=2, judge_min=0.85, judge_cv_top=2))
assert window(store) == [top, second, nearer], \
"a role under the bar is no part of the first set, so it may come in by the CV"
store.save_agent("Data", prompts=owner.prompts, agent_id=owner.id,
limits=Limits(judge_top=2, judge_min=0.5, judge_cv_top=0))
assert window(store) == [top, second]
assert low and far and nearest_gated
def test_a_gated_role_stays_out_of_the_window_however_close(store: Store) -> None:
owner = store.save_agent("Data", prompts=[Prompt(name="AI", text="Head of AI")],
cv_text="VP Data.",
limits=Limits(judge_top=1, judge_min=0.5, judge_cv_top=5))
top, _gated = ranked(store, owner, [("top", 0.9, "", 0.1), ("gated", 0.0, "remote", 1.0)])
assert window(store) == [top]
# ------------------------------------------------------------------- order
def test_cv_match_orders_the_unjudged_by_closeness_then_score(store: Store) -> None:
owner = store.save_agent("Data", prompts=[Prompt(name="AI", text="Head of AI")],
cv_text="VP Data.")
judged, close, far, none_a, none_b = ranked(store, owner, [
("judged", 0.1, "", 0.1), ("close", 0.2, "", 0.9), ("far", 0.9, "", 0.3),
("none_a", 0.5, "", None), ("none_b", 0.6, "", None)])
store.set_judgement(owner.id, judged, "k", 50, 50, 50, ["One."], ["Two."])
page = store.roles_page(agent=owner.id, by_cv=True)
assert [r.uid for r in page] == [judged, close, far, none_b, none_a]
assert [r.cv_fit for r in page] == [0.1, 0.9, 0.3, None, None]
assert [r.uid for r in store.roles(agent=owner.id, by_cv=True)] == [
judged, close, far, none_b, none_a]
assert [r.uid for r in store.roles_page(agent=owner.id)] == [
far, none_b, none_a, close, judged], "Agent match ignores it"
found = store.role(close, owner.id)
assert found is not None and found.cv_fit == 0.9
# --------------------------------------------------------------- migration
def test_migration_31_adds_the_column_and_the_table_and_runs_twice(tmp_path: Path) -> None:
path = tmp_path / "old.db"
Store(path)
with sqlite3.connect(path) as conn:
conn.execute("DROP TABLE agent_cv_vectors")
conn.execute("ALTER TABLE scores DROP COLUMN cv_fit")
conn.execute("PRAGMA user_version = 30")
assert Store(path).migrations_applied == [31]
step = {v: s for v, _, s in MIGRATIONS}[31]
with sqlite3.connect(path) as conn:
assert callable(step)
step(conn)
assert "cv_fit" in {r[1] for r in conn.execute("PRAGMA table_info(scores)")}
assert conn.execute("SELECT COUNT(*) FROM agent_cv_vectors").fetchone() == (0,)
+1 -1
View File
@@ -278,7 +278,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, 28, 29, 30]
assert migrated.migrations_applied == [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
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'"
+1 -1
View File
@@ -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, 28, 29, 30]
assert migrated.migrations_applied == [23, 24, 25, 26, 27, 28, 29, 30, 31]
assert migrated.agents()[0].fetch_terms == []
+1 -1
View File
@@ -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, 28, 29, 30]
assert migrated.migrations_applied == [24, 25, 26, 27, 28, 29, 30, 31]
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
View File
@@ -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, 28, 29, 30]
assert migrated.migrations_applied == [22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
one = row(migrated, "1")
assert (one["seniority_host"], one["employment_host"], one["remote_host"],
one["country_host"]) == ("senior", "full_time", "true", "DK")
+2 -2
View File
@@ -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, 28, 29, 30]
assert migrated.migrations_applied == [27, 28, 29, 30, 31]
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, 28, 29, 30]
assert Store(path).migrations_applied == [27, 28, 29, 30, 31]
def test_a_role_waits_for_extract_until_it_was_asked_where(store: Store) -> None:
+9 -9
View File
@@ -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 == 30
assert LATEST == 31
# A second open finds it current and applies nothing.
assert Store(path).migrations_applied == []
@@ -190,7 +190,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, 28, 29, 30]
assert migrated.migrations_applied == [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
acme = migrated.company("acme")
assert acme is not None
assert (acme.ats, acme.careers_url) == ("teamtailor", "https://a.example")
@@ -395,7 +395,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, 28, 29, 30]
assert migrated.migrations_applied == [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
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]
@@ -419,7 +419,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, 28, 29, 30]
assert migrated.migrations_applied == [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
acme = migrated.company("acme")
assert acme is not None
assert (acme.careers_url, acme.notes, acme.hand_reason) == (
@@ -448,7 +448,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, 28, 29, 30]
assert migrated.migrations_applied == [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
with sqlite3.connect(path) as conn:
rows = {uid: (fold, level) for uid, fold, level in conn.execute(
"SELECT uid, place_fold, seniority FROM roles")}
@@ -691,7 +691,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, 28, 29, 30]
assert migrated.migrations_applied == [19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
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) == []
@@ -733,7 +733,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, 28, 29, 30]
assert migrated.migrations_applied == [25, 26, 27, 28, 29, 30, 31]
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 "
@@ -751,12 +751,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, 28, 29, 30]
assert migrated.migrations_applied == [26, 27, 28, 29, 30, 31]
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, 28, 29, 30]
assert Store(path).migrations_applied == [26, 27, 28, 29, 30, 31]
def test_a_pull_keeps_the_posting_url(store: Store) -> None:
+3 -3
View File
@@ -1184,9 +1184,9 @@ def test_an_agents_limits_are_saved_listed_and_checked(client: TestClient) -> No
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_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_top": 20, "judge_min": 0.6, "judge_cv_top": 10}
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]
@@ -1231,7 +1231,7 @@ def test_list_roles_serves_the_row_projection_and_not_the_big_columns(
"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", "deadline",
"lang_flag", "lang_note", "cv_score",
"lang_flag", "lang_note", "cv_score", "cv_fit",
}
assert row["uid"] == uid
assert row["company"] == "Acme" and row["place"] == "Berlin, Germany"