Viewing as leads the Roles rail; settings get a rail, agent cards, one Sources section at a time

A search agent is a persona, and every like or pass belongs to the one
being viewed. The rail now opens on Viewing as: a full-width chooser,
the name alone with one agent, a note with none, remembered in the URL
and localStorage. The vote buttons, the reader's affinity control, the
feed, the tag counts and the reader fetch all carry that agent; before,
votes sent none and every one landed on the default agent. Best first
and Newest first are back as the segmented control under Order,
independent of the agent. The rail selects no longer clip descenders:
Chrome ignores line-height on a select, so the fixed box is gone in
favour of padding and a min-height.

Settings render inside a sticky rail (Search agents; Sources with Job
boards, Company boards, Runs, Messages; Account), a strip under the
header on a phone, so Runs is one click away however long the company
list gets. Sources shows one section at a time, chosen by the fragment,
so the old redirects still land. Search agents are cards, newest first:
name, an On/Off switch with its word, the intent in full, the weights,
Edit in place, New agent on top, and a link to Roles as that agent.
Switching one on rescores it.

replace_scores writes nothing for an agent deleted while score was
running, instead of failing the run on the foreign key.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Fable 5.1 committed 2026-09-28 15:05:55 +02:00
1 parent 063771d617
commit c4f2bcc0c9
20 files changed
+836 -326

No files matched your search

+45 -6
View File
@@ -17,6 +17,7 @@ from app.config import Config, ServerConfig
from app.main import create_app
from app.storage import Store
from app.web import MOVED, SETTINGS, TABS
from app.web.pages import SECTIONS
from auth import AuthConfig
from desk.models import Item
@@ -512,7 +513,7 @@ def test_every_page_renders_with_the_whole_nav(client: TestClient) -> None:
assert '<link rel="manifest" href="/static/manifest.json">' in res.text
def test_the_cog_and_one_sub_tab_are_current_on_a_settings_page(client: TestClient) -> None:
def test_the_cog_and_one_rail_entry_are_current_on_a_settings_page(client: TestClient) -> None:
page = client.get("/settings/sources").text
assert 'class="icon active"' in page
for tab in SETTINGS:
@@ -523,6 +524,38 @@ def test_the_cog_and_one_sub_tab_are_current_on_a_settings_page(client: TestClie
assert 'class="icon active"' not in client.get("/").text
def test_every_settings_page_has_the_rail_and_not_the_tab_row(client: TestClient) -> None:
"""The rail replaces the `<h1>Settings</h1>` and the sub-tab row: every
page, then the Sources sections indented under Sources, from any page."""
for tab in SETTINGS:
page = client.get(tab.path).text
assert '<aside class="settings-rail"' in page, tab.path
assert 'class="subtabs"' not in page and "<h1>Settings</h1>" not in page
rail = page[page.index('<aside class="settings-rail"'):page.index("</aside>")]
assert [rail.index(f'href="{t.path}"') for t in SETTINGS] == sorted(
rail.index(f'href="{t.path}"') for t in SETTINGS)
for anchor, label in SECTIONS["/settings/sources"]:
link = f'href="/settings/sources#{anchor}" data-section="{anchor}">{label}</a>'
assert rail.index('href="/settings/sources"') < rail.index(link) \
< rail.index('href="/settings/account"')
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."""
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
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
def test_settings_is_search_agents(client: TestClient) -> None:
res = client.get("/settings", follow_redirects=False)
assert res.status_code == 302 and res.headers["location"] == "/settings/agents"
@@ -553,7 +586,7 @@ def test_each_page_loads_only_its_own_script(client: TestClient) -> None:
for path, container, own in [
("/", 'id="roles-list"', ["roles.js"]),
("/applications", 'id="applications-list"', ["applications.js"]),
("/settings/agents", 'id="agent-form"', ["agents.js"]),
("/settings/agents", 'id="agents-list"', ["agents.js"]),
("/settings/sources", 'id="searches-list"',
["sources.js", "companies.js", "jobs.js", "messages.js"])]:
page = client.get(path).text
@@ -569,8 +602,13 @@ def test_each_page_loads_only_its_own_script(client: TestClient) -> None:
def test_the_agents_page_lists_and_edits_search_agents(client: TestClient) -> None:
"""A card per agent, filled by agents.js, and the form as a `<template>`
it clones into the card being edited, or a new one on top."""
page = client.get("/settings/agents").text
assert 'id="agents-list"' in page and 'id="agents-count"' in page
assert page.index('id="a-new"') < page.index('id="agents-list"')
template = page[page.index('<template id="agent-form-template">'):page.index("</template>")]
assert 'id="agent-form"' in template and 'id="a-cancel"' in template
assert 'id="a-name"' in page and 'placeholder="My search"' in page
assert 'id="a-intent"' in page and "<details" in page and 'id="a-gates"' in page
for weight in ("a-fit", "a-recency", "a-affinity", "a-taste"):
@@ -581,11 +619,12 @@ 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 and the runs, in that order, with the
message log at the end of the runs and a jump row to each section."""
"""Job boards, company boards, the runs and the message log, in that
order, each linked from the rail; no jump row any more."""
page = client.get("/settings/sources").text
for anchor in ("job-boards", "company-boards", "runs"):
assert f'href="#{anchor}"' in page and f'id="{anchor}"' in page
assert '<aside class="settings-rail"' in page and 'class="jump"' not in page
for anchor in ("job-boards", "company-boards", "runs", "messages"):
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"')
# Job boards: the Jobindex areas and the Adzuna countries, from plugins.search.