Runs is the queue's elements and a Problems log; a Kill lands between boards

Run one stage goes: the cascade is the unit of work and app job keeps the
per-stage entry points. The pull button is disabled while a pull runs and
the lede no longer hardcodes the cadence. Messages folds into Runs as
Problems. pull_batch checks for a cancel before every board, one plugin per
target, and both plugins now close their HTTP client.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Fable 5.1 committed 2026-09-28 16:10:38 +02:00
1 parent cebe62ddc9
commit 8532e4e739
15 files changed
+284 -242

No files matched your search

+37 -16
View File
@@ -549,18 +549,22 @@ def test_every_settings_page_has_the_rail_and_not_the_tab_row(client: TestClient
def test_a_moved_section_is_one_the_sources_page_shows(client: TestClient) -> None:
"""Every old path that lands on a fragment of Sources names a section of
`SECTIONS`, and each is a `<section data-section>` on the page, which is
what sources.js shows one of."""
`SECTIONS` or an element inside one, and each section is a `<section
data-section>` on the page, which is what sources.js shows one of. The
old Messages paths land on `#messages`, the log at the end of Runs."""
anchors = [anchor for anchor, _ in SECTIONS["/settings/sources"]]
assert anchors == ["job-boards", "company-boards", "runs", "messages"]
for to in MOVED.values():
path, _, anchor = to.partition("#")
if anchor:
assert path == "/settings/sources" and anchor in anchors, to
assert anchors == ["job-boards", "company-boards", "runs"]
page = client.get("/settings/sources").text
assert page.count("data-section>") == len(anchors)
for anchor in anchors:
assert f'<section class="card" id="{anchor}" data-section>' in page
runs = page[page.index('id="runs"'):]
for to in MOVED.values():
path, _, anchor = to.partition("#")
if anchor:
assert path == "/settings/sources", to
assert anchor in anchors or f'id="{anchor}"' in runs, to
assert MOVED["/messages"] == MOVED["/settings/messages"] == "/settings/sources#messages"
def test_settings_is_search_agents(client: TestClient) -> None:
@@ -586,8 +590,9 @@ def test_an_old_tab_moves_permanently_and_keeps_its_query(
def test_each_page_loads_only_its_own_script(client: TestClient) -> None:
"""Sources is four sections' scripts on one page, each guarding on its own
root element; every other page is one."""
"""Sources is four scripts on one page, one per section and one for the
log in Runs, each guarding on its own root element; every other page is
one."""
scripts = {"roles.js", "applications.js", "agents.js", "companies.js", "sources.js",
"jobs.js", "messages.js"}
for path, container, own in [
@@ -632,14 +637,15 @@ def test_the_agents_page_lists_and_edits_search_agents(client: TestClient) -> No
def test_the_sources_page_has_a_section_per_plugin(client: TestClient) -> None:
"""Job boards, company boards, the runs and the message log, in that
order, each linked from the rail; no jump row any more."""
"""Job boards, company boards and the runs, in that order, each linked
from the rail; no jump row any more."""
page = client.get("/settings/sources").text
assert '<aside class="settings-rail"' in page and 'class="jump"' not in page
for anchor in ("job-boards", "company-boards", "runs", "messages"):
for anchor in ("job-boards", "company-boards", "runs"):
assert f'href="/settings/sources#{anchor}"' in page and f'id="{anchor}"' in page
assert page.index('id="job-boards"') < page.index('id="company-boards"') \
< page.index('id="runs"') < page.index('id="messages"')
< page.index('id="runs"')
assert 'href="/settings/sources#messages"' not in page
# Job boards: the Jobindex areas and the Adzuna countries, from plugins.search.
assert 'id="searches-list"' in page and 'id="search-form"' in page
assert 'value="1" selected>Region Hovedstaden' in page
@@ -650,9 +656,16 @@ def test_the_sources_page_has_a_section_per_plugin(client: TestClient) -> None:
assert '<option value="greenhouse">' in page and '<option value="personio">' in page
boards = page[page.index('id="company-boards"'):page.index('id="runs"')].lower()
assert "hidden" in boards and "mute" not in boards
# Runs: Pull now, the queue's elements, one stage at a time, the log.
assert 'id="pull-now"' in page and 'id="kinds"' in page
assert 'id="notices"' in page and 'id="clear-all"' in page
# Runs: the pull button, the queue's elements, and the log as its last
# block. No button per stage, and no cadence in the lede.
runs = page[page.index('id="runs"'):page.index("</section>", page.index('id="runs"'))]
assert '<button type="button" id="pull-now" class="secondary">Run the pull now</button>' in runs
assert 'id="kinds"' not in page and "Run one stage" not in page
assert "On the schedule below the pull reads every board" in runs
assert "Every 6 hours" not in runs
assert '<p class="muted small" id="idle" hidden>' in runs
assert runs.index("<desk-schedules>") < runs.index('<div id="messages">') \
< runs.index("<h3>Problems</h3>") < runs.index('id="clear-all"') < runs.index('id="notices"')
def test_the_modules_bring_their_own_elements(client: TestClient) -> None:
@@ -685,6 +698,14 @@ def test_the_jobs_tab_offers_pull_once_and_no_batch(client: TestClient) -> None:
assert not {"pull_batch", "extract_batch", "advance"} & set(kinds)
def test_save_and_score_queues_a_score(client: TestClient, queue: Any) -> None:
"""The Search agents page's "Save and score" posts `{kind: "score"}`: a
task on its own, now that no stage has a button of its own."""
res = client.post("/api/jobs", json={"kind": "score", "payload": {}})
assert res.status_code == 202
assert queue.jobs.last("score", states=("queued", "running", "done")) is not None
def test_an_error_is_one_sentence(client: TestClient) -> None:
"""`api()` toasts `detail` as it is, so a 422 is a sentence, not a list."""
res = client.post("/api/agents", json={"name": "Bad",