From 7f04c10e9e9df07a09d40372c5b8180a11adf6ec Mon Sep 17 00:00:00 2001 From: Wolf Date: Tue, 29 Sep 2026 19:43:24 +0200 Subject: [PATCH] Forget a replaced or detached board's robots.txt verdict and detail lists with its failure record Co-Authored-By: Claude Opus 5.5 --- app/jobs/sources.py | 6 +++++- tests/test_sources.py | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app/jobs/sources.py b/app/jobs/sources.py index 4eedbea..f9bb354 100644 --- a/app/jobs/sources.py +++ b/app/jobs/sources.py @@ -109,8 +109,12 @@ def detach_board(store: Store, key: str) -> int: def _forget_failing(store: Store, target: str) -> None: """Drop what the pull recorded about a board nobody reads any more: a record of `target` failing would otherwise outlive the board, and count - in `app companies check` for good.""" + in `app companies check` for good. The `ats` plugin's robots.txt verdict + and its lists of roles read and failed in detail go with it, since they + are about that board alone and would only grow stale.""" store.state.pop(FAILING + target, None) + for key in ("ats:robots:", "ats:detailed:", "ats:detailfailed:"): + store.state.pop(key + target, None) def add_board(store: Store, board: str, name: str) -> tuple[Subscription, int]: diff --git a/tests/test_sources.py b/tests/test_sources.py index 7665d3f..5570b95 100644 --- a/tests/test_sources.py +++ b/tests/test_sources.py @@ -305,6 +305,24 @@ def test_replacing_or_detaching_a_board_forgets_that_it_was_failing( assert failing_boards(store) == {} +def test_replacing_or_detaching_a_board_forgets_its_robots_and_detail_records( + store: Store, boards: Boards) -> None: + kept = ("ats:robots:", "ats:detailed:", "ats:detailfailed:") + sources.set_board(store, "acme", "greenhouse:acme", name="Acme") + for key in kept: + store.state[key + "greenhouse:acme"] = "[]" + store.state["ats:robots:lever:other"] = "{}" + + sources.set_board(store, "acme", "ashby:acme") + assert not any(key + "greenhouse:acme" in store.state for key in kept) + assert "ats:robots:lever:other" in store.state + + for key in kept: + store.state[key + "ashby:acme"] = "[]" + sources.detach_board(store, "acme") + assert not any(key + "ashby:acme" in store.state for key in kept) + + def test_search_params_keeps_only_what_the_provider_reads() -> None: assert sources.search_params("jobindex", " python ", area=1, region="CaRE_1nn_cSU") == { "q": "python", "area": 1}