Paged boards are read to their stated total, and a board failing for 21 days closes

Workable and SmartRecruiters page their lists, and both parsers read page one
only, so the settle closed every role past it (Delivery Hero: 980 stated, 100
open). `_paged` follows nextPage and offset, and the plugin stamps
`ats:complete` only when the distinct ids read equal the stated total; a 429
after page one keeps what was read and closes nothing. Adzuna completes on its
`count`, Jobindex counts raw items and raises on an answer with no channel.

A board whose fetch raises is recorded under `ats:failing:<target>` with the
first failure's time and the latest reason; after STALE_DAYS the settle closes
its roles, and its next answer reopens them. `/api/companies`, the Companies
list and `app companies check` show it.

Co-Authored-By: Claude Opus <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus committed 2026-09-29 14:02:49 +02:00
1 parent 0558ef19ed
commit c7da12b93d
18 files changed
+695 -91

No files matched your search

+15 -8
View File
@@ -264,7 +264,9 @@ class CompanyOut(BaseModel):
board's subscription, whether it is on, and how many of its roles are
still open. `ats` is the host its careers site runs on whether or not the
app reads it, so a followed company with no `board` and an `ats` is one
the app cannot read yet; `careers_url` is where a person can."""
the app cannot read yet; `careers_url` is where a person can.
`failing_since` and `failing_reason` say since when the board has failed
on every fetch and why it last did, both empty while it answers."""
key: str
name: str
@@ -276,17 +278,19 @@ class CompanyOut(BaseModel):
ats: str = ""
careers_url: str = ""
country: str = ""
failing_since: str = ""
failing_reason: str = ""
def _company_boards(store: Store) -> dict[str, tuple[int, str, bool]]:
"""`company_key -> (subscription id, ats host, on)`, read off each
def _company_boards(store: Store) -> dict[str, tuple[int, str, bool, str]]:
"""`company_key -> (subscription id, ats host, on, target)`, read off each
company's own subscription. Same join as `Store.company_boards`, with the
id and switch state a company row needs to draw its own on/off control
rather than fetching `/api/sources` as well."""
boards: dict[str, tuple[int, str, bool]] = {}
boards: dict[str, tuple[int, str, bool, str]] = {}
for sub in store.subscriptions(source="ats"):
boards.setdefault(company_key(sub.company), (sub.id, sub.board,
bool(sub.subscribed and sub.fetch)))
boards.setdefault(company_key(sub.company), (
sub.id, sub.board, bool(sub.subscribed and sub.fetch), sub.target))
return boards
@@ -296,13 +300,16 @@ def list_companies(store: StoreDep, agent: int | None = None) -> list[CompanyOut
absent) has it; 0 throughout when there is no agent."""
boards = _company_boards(store)
counts = store.open_role_counts()
failing = jobs.pull.failing_boards(store)
out = []
for c in store.companies(_agent_id(store, agent)):
sub_id, host, on = boards.get(c.key, (None, "", None))
sub_id, host, on, target = boards.get(c.key, (None, "", None, ""))
since, reason = failing.get(target, ("", ""))
out.append(CompanyOut(key=c.key, name=c.name, board=host,
subscription_id=sub_id, on=on, affinity=c.affinity,
open_roles=counts.get(c.key, 0), ats=c.ats,
careers_url=c.careers_url, country=c.country))
careers_url=c.careers_url, country=c.country,
failing_since=since, failing_reason=reason))
return out