From 8a033e028d107c5633800896ba84a6697ac567df Mon Sep 17 00:00:00 2001 From: Wolf Date: Sat, 3 Oct 2026 12:31:21 +0200 Subject: [PATCH] Hand search roles without text to enrich too, so a Jobbank role above the bar is read on its own page Co-Authored-By: Claude Opus 5.5 --- app/storage/store.py | 4 ++-- tests/test_enrich.py | 10 ---------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/app/storage/store.py b/app/storage/store.py index 25caa73..279050a 100644 --- a/app/storage/store.py +++ b/app/storage/store.py @@ -1770,7 +1770,7 @@ class Store: def enrich_waiting(self, top: int, floor: float, uids: Sequence[str] | None = None) -> list[dict[str, Any]]: - """Open `ats` roles without text that an enabled agent with a prompt + """Open board and search roles without text that an enabled agent with a prompt ranks ungated among its best `top` and at `floor` or above, best first by the highest such score, as `{uid, source_id, subscription_id, title, url, published_at, raw, score}`. The ranking @@ -1780,7 +1780,7 @@ class Store: dealt.""" fields = ("r.uid, r.source_id, r.subscription_id, r.title, r.original_url AS url, " "r.published_at, r.raw") - waiting = ("r.closed_at IS NULL AND r.dup_of IS NULL AND r.source = 'ats' " + waiting = ("r.closed_at IS NULL AND r.dup_of IS NULL AND r.source IN ('ats', 'search') " "AND r.subscription_id IS NOT NULL AND r.description = '' " "AND r.article_text = ''") if uids is not None: diff --git a/tests/test_enrich.py b/tests/test_enrich.py index 4dd2f8a..831724e 100644 --- a/tests/test_enrich.py +++ b/tests/test_enrich.py @@ -245,12 +245,6 @@ AD = (ROOT / "tests" / "fixtures" / "search" / "jobbank-detail.html").read_bytes AD_URL = "https://jobbank.dk/job/1234/acme/role" -#: `Store.enrich_waiting` hands over `source = 'ats'` roles only, and a search's -#: are `search`: until it takes both, the tests that need its answer fail. -needs_waiting = pytest.mark.xfail( - reason="Store.enrich_waiting reads source 'ats' only", strict=False) - - def search(store: Store, target: str = "jobbank:cph") -> Any: return store.add_subscription("search", target, label=target, params={"q": "x"}) @@ -269,7 +263,6 @@ def search_role(store: Store, target: str, native: str, *, provider: str = "") - return item.uid -@needs_waiting def test_a_search_whose_reader_has_detail_is_planned_like_a_board( store: Store, tmp_path: Path, web: dict[str, Any]) -> None: search(store) @@ -291,7 +284,6 @@ def test_a_search_whose_reader_has_detail_is_planned_like_a_board( assert enrich.plan(config(tmp_path), store) == [("fake:acme", [f])] -@needs_waiting def test_a_search_role_read_waits_for_the_retry_and_a_failed_one_goes_last( store: Store, tmp_path: Path, web: dict[str, Any]) -> None: search(store) @@ -307,7 +299,6 @@ def test_a_search_role_read_waits_for_the_retry_and_a_failed_one_goes_last( assert enrich.plan(config(tmp_path), store) == [("jobbank:cph", [three, two])] -@needs_waiting def test_a_batch_reads_a_search_roles_page_and_stores_its_text( store: Store, tmp_path: Path, web: dict[str, Any]) -> None: search(store) @@ -330,7 +321,6 @@ def test_a_batch_reads_a_search_roles_page_and_stores_its_text( assert enrich.plan(config(tmp_path), store) == [] -@needs_waiting def test_a_search_batch_counts_a_404_as_read_as_a_board_does( store: Store, tmp_path: Path, web: dict[str, Any]) -> None: search(store)