Size a board once with board_size, before a pull reads it with no size, and name what a site's ids leave out

set_board sizes a board from page 1's total, or reads to the end on a host that states none, instead of reading it whole up to page 100. A pull no longer rewrites ats:size; a board with none is handed the agents' reach marked unsized and is sized in its batch first, or by its whole read on a host that cannot narrow the reach. reach.sizes drops the open-role fallback. The Companies line names countries a Workday or Oracle site does not list and a missing remote option.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 13:43:52 +02:00
1 parent a19c528e3f
commit a0882e9659
8 files changed
+579 -67

No files matched your search

+29 -10
View File
@@ -46,10 +46,11 @@ def set_board(store: Store, key: str, board: str, *, name: str = "",
check: bool = True, **fields: str) -> tuple[Subscription, int | None, int]:
"""Read company `key` from `board` (`host:slug`): attach it to a company
that has none, replace the one it has, or create the company from `name`
when there is no row. The board is fetched first and refused if its host
is unknown or it does not answer; a board listing zero roles is kept, since
a company between openings is still one to follow. `check=False` skips the
fetch, for the seed, whose boards were read once when it was written.
when there is no row. The board is sized first (`board_size`) and refused
if its host is unknown or it does not answer; a board listing zero roles
is kept, since a company between openings is still one to follow.
`check=False` skips the request, for the seed, whose boards were read
once when it was written; such a board is sized by its first pull.
The row's `ats` and `ats_slug` become the board's host and slug, its
`careers_url` the board's page where it was empty or the old board's, and
@@ -59,7 +60,7 @@ def set_board(store: Store, key: str, board: str, *, name: str = "",
change in one transaction (`Store.set_company_board`), and replacing a
board closes the old one's open roles. Returns the subscription, how many
roles the board lists (None unchecked) and how many roles closed."""
from plugins.ats import careers_url, fetch_board, is_known_target
from plugins.ats import board_size, careers_url, is_known_target, keep_size
board, name = board.strip(), name.strip()
key = key.strip() or company_key(name)
@@ -72,10 +73,10 @@ def set_board(store: Store, key: str, board: str, *, name: str = "",
raise ValueError(f"no company {key!r}; a new company needs a name")
if company_key(name) != key:
raise ValueError(f"{name!r} is not the company {key!r}")
rows: list[Any] | None = None
size: int | None = None
if check:
try:
rows, _complete = fetch_board(board)
size = board_size(board)
except Exception as exc:
raise ValueError(f"{board} did not answer: {exc}") from exc
host, _, slug = board.partition(":")
@@ -95,7 +96,23 @@ def set_board(store: Store, key: str, board: str, *, name: str = "",
assert sub is not None
if before is not None and before.target != board:
_forget_failing(store, before.target)
return sub, None if rows is None else len(rows), closed
if size is not None:
keep_size(store.state, board, size)
return sub, size, closed
def size_board(store: Store, board: str) -> int:
"""Size `board` again (`plugins.ats.board_size`) and keep it with the
day: how a board's size changes once it was added (a Recheck, `app
companies size`). Raises ValueError when it does not answer."""
from plugins.ats import board_size, keep_size
try:
size = board_size(board)
except Exception as exc:
raise ValueError(f"{board} did not answer: {exc}") from exc
keep_size(store.state, board, size)
return size
def detach_board(store: Store, key: str) -> int:
@@ -118,9 +135,11 @@ def _forget_failing(store: Store, target: str) -> None:
record of `target` failing would otherwise outlive the board, and count
in `app companies check` for good. The `ats` plugin's robots.txt verdict
and its lists of roles read and failed in detail go with it, since they
are about that board alone and would only grow stale."""
are about that board alone and would only grow stale, as would its size,
which a board attached again gets anew."""
store.state.pop(FAILING + target, None)
for key in ("ats:robots:", "ats:detailed:", "ats:detailfailed:"):
for key in ("ats:robots:", "ats:detailed:", "ats:detailfailed:", "ats:size:",
"ats:sizechecked:"):
store.state.pop(key + target, None)