diff --git a/app/jobs/judge.py b/app/jobs/judge.py index 98a5fee..9b63419 100644 --- a/app/jobs/judge.py +++ b/app/jobs/judge.py @@ -14,8 +14,8 @@ career count as at most `app.models.BROKEN_CAP` (4), when the role is served. Culture and location are left out: the first is guessed from ad text, the second is what the fetch gate does. -The work is pairs, `(agent, role)`: an enabled agent with a CV and a prompt, -and an open role in its cut (`scores.cut`, see `app.jobs.score`: the best by +The work is pairs, `(agent, role)`: an enabled agent with a CV, with or +without a prompt, and an open role in its cut (`scores.cut`, see `app.jobs.score`: the best by fit, the best by CV closeness that those leave out, and the liked and saved) with some text, that has no judgement yet, or one read from another CV, prompts, like, avoid or must text or role text than today's (`input_key`). @@ -189,10 +189,10 @@ def input_key(agent: Agent, text: str) -> str: def _judged(agent: Agent) -> bool: - """Whether `judge` reads for this agent at all: enabled, with a CV and a - prompt with text (without one nothing of its cut is in by fit).""" - return agent.enabled and bool(agent.cv_text.strip()) \ - and any(p.text.strip() for p in agent.prompts) + """Whether `judge` reads for this agent at all: enabled, with a CV. An + agent without a prompt is judged too: its cut is the CV list and the + kept, and the profile goes without `` (`system`).""" + return agent.enabled and bool(agent.cv_text.strip()) def waiting(store: Store, keys: Sequence[str] | None = None, diff --git a/tests/test_judge.py b/tests/test_judge.py index 077f792..48e5208 100644 --- a/tests/test_judge.py +++ b/tests/test_judge.py @@ -194,12 +194,28 @@ def hashlib_old_key(agent: Any, text: str) -> str: return hashlib.sha1(blob.encode()).hexdigest()[:16] -def test_only_enabled_agents_with_a_cv_and_a_prompt_are_judged(store: Store) -> None: +def test_only_enabled_agents_with_a_cv_are_judged(store: Store) -> None: for name, kwargs in (("No CV", {"cv": " "}), ("Off", {"enabled": False})): ranked(store, hunter(store, name, **kwargs), name) bare = store.save_agent("No prompt", cv_text=CV) - ranked(store, bare, "bare") - assert judge.waiting(store) == [] + [uid] = ranked(store, bare, "bare") + assert [(a.id, row["uid"]) for a, row, _, _ in judge.waiting(store)] == [(bare.id, uid)] + + +def test_an_agent_without_a_prompt_is_judged_without_wants( + store: Store, config: Config, monkeypatch: pytest.MonkeyPatch) -> None: + """A CV alone is enough: the cut is the CV list, and the profile has no + `` block.""" + bare = store.save_agent("No prompt", cv_text=CV) + [uid] = ranked(store, bare, "1") + model = stub(monkeypatch) + + modeltask.run(judge.TASK, config, store) + + found = store.judgement(bare.id, uid) + assert found is not None and (found.skills, found.experience, found.career) == (8, 7, 9) + [system] = model.systems + assert CV in system and " None: