Close a role of a swept board only when two finished sweeps in a row missed it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 13:23:57 +02:00
1 parent a19c528e3f
commit a91032b60f
5 files changed
+373 -11

No files matched your search

+22
View File
@@ -269,6 +269,28 @@ def test_a_board_over_the_page_cap_is_swept_across_pulls() -> None:
assert [index for index, _ in module.asked] == [0, 1, 2, 3, 4]
assert "ats:sweep:fake:acme" not in state
assert json.loads(state["ats:count:fake:acme"])["count"] == 5
assert state["ats:swept:fake:acme"] == "1"
def test_a_board_read_in_one_pull_is_not_swept() -> None:
pages = [["1"], ["2"]]
state: dict[str, str] = {}
listing = _runner.read(state, "ats", "fake:acme", _paged(pages, total=2), "acme",
_pages_web(pages), limits=NO_DELAY)
_runner.stamp(state, "ats", "fake:acme", "r", listing, listing.ids)
assert (listing.complete, listing.swept, state["ats:swept:fake:acme"]) == (True, False, "")
def test_a_sweep_restarted_by_a_changed_ask_is_not_swept() -> None:
pages = [["1"], ["2"], ["3"]]
module = _paged(pages, filters=Filters(country="many"))
web, state = _pages_web(pages), {}
limits = _runner.Limits(max_pages=2, page_delay=0)
first = _runner.read(state, "ats", "t", module, "acme", web, Ask(), limits=limits)
_runner.stamp(state, "ats", "t", "r", first, first.ids)
again = _runner.read(state, "ats", "t", module, "acme", web, Ask(countries=("DK",)),
limits=NO_DELAY)
assert (again.complete, again.swept) == (True, False)
def test_a_sweep_starts_again_when_the_ask_changed() -> None: