Show and set each board's reach on the Companies list, list the readers' declarations on Sources, and document filtering at the source

A company row says what a pull asks its board for; its editor sets the board's own reach (the agents', all roles, or countries and remote) through /api/sources/{id}/reach. /api/readers lists each reader's listing, text, filters, places and robots decision, folded under the Follow form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 10:03:41 +02:00
1 parent 3462a4abe7
commit dafca5435e
8 files changed
+333 -8

No files matched your search

+31
View File
@@ -36,6 +36,8 @@ from typing import Any
from app import places
from app.models import Agent, Gate, Subscription, company_key
from app.storage import Store
from plugins import readers
from plugins.readers import _runner
#: A board that listed fewer roles than this when last read whole is read
#: whole.
@@ -233,3 +235,32 @@ def reaches(store: Store, subs: Iterable[Subscription]) -> Mapping[str, dict[str
subs = list(subs)
found = plan(store, subs)
return {s.target: r for s in subs if (r := found.for_subscription(s)) is not None}
#: Why a board is read whole, as the Companies list says it.
_WHOLE = {"small": f"under {SMALL} roles", "unknown": "not read whole yet",
"override": "set here", "favourite": "favourite, too many countries to ask",
"agents": "an agent takes any place"}
def line(found: Plan, sub: Subscription) -> str:
"""What a pull asks `sub`'s board for, once its reader has narrowed the
reach, in a few words: "DK, SE, remote · agents", "all roles · under 300
roles", "all roles · Greenhouse cannot filter"."""
module = readers.HOSTS.get(sub.target.partition(":")[0])
if module is None:
return ""
given, why = found.why(sub)
ask = _runner.ask_for(module, sub.params, given.params())
if _runner.filtered(ask):
words = sorted(ask.countries) if len(ask.countries) <= 4 \
else [f"{len(ask.countries)} countries"]
if ask.remote:
words.append("remote")
return f"{', '.join(words)} · {'set here' if why == 'override' else why}"
if why in ("agents", "favourite") and not given.everywhere:
if not module.READS.filters.declared():
return f"all roles · {module.LABEL} cannot filter"
if why == "agents":
return f"all roles · {module.LABEL} cannot ask for these"
return f"all roles · {_WHOLE[why]}"