Recheck a board's size from the Companies row, the route and app companies size

POST /api/sources/{id}/size sizes the board again, keeps the day and queues a pull; /api/companies returns size and size_checked, and the row shows "999 roles · checked 30 Sep" with Recheck beside Change. app companies size <key> does the same from the CLI, and --missing sizes every board without a size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 13:44:54 +02:00
1 parent a0882e9659
commit 6085017943
5 files changed
+209 -5

No files matched your search

+27 -1
View File
@@ -491,6 +491,10 @@ class CompanyOut(BaseModel):
#: what a pull asks its board for (`jobs.reach.line`).
reach_params: dict[str, Any] = {}
reach: str = ""
#: The roles the board listed when it was last sized, and that day
#: (ISO); None and "" before it is sized (`jobs.reach.SIZE`).
size: int | None = None
size_checked: str = ""
def _company_boards(store: Store) -> dict[str, tuple[int, str, bool, str]]:
@@ -534,7 +538,10 @@ def _company_outs(store: Store, agent: int | None) -> list[CompanyOut]:
all_roles=bool(c.all_roles),
reach_params={k: v for k, v in (sub.params if sub else {}).items()
if k in jobs.reach.OVERRIDE_KEYS},
reach=jobs.reach.line(plan, sub) if sub else ""))
reach=jobs.reach.line(plan, sub) if sub else "",
size=plan.sizes.get(target) if sub else None,
size_checked=store.state.get(
jobs.reach.SIZE_CHECKED + target, "") if sub else ""))
return out
@@ -897,6 +904,25 @@ def set_reach(sub_id: int, body: ReachBody, store: StoreDep) -> dict[str, Any]:
"reach": jobs.reach.line(jobs.reach.plan(store, [sub]), sub)}
@router.post("/sources/{sub_id}/size")
def recheck_size(sub_id: int, store: StoreDep, queue: QueueDep) -> dict[str, Any]:
"""Size a board again, the one way its size changes once it was added
(`jobs.sources.size_board`): its reach may change with it, so a pull is
queued right after, as the other routes that change what is read do. 422
when the board does not answer; the size it had stays."""
sub = store.subscription(sub_id)
if sub is None or sub.source != "ats":
raise HTTPException(404, f"no such board: {sub_id}")
try:
size = jobs.sources.size_board(store, sub.target)
except ValueError as exc:
raise HTTPException(422, str(exc)) from exc
queue.enqueue("pull")
checked = store.state.get(jobs.reach.SIZE_CHECKED + sub.target, "")
return {"size": size, "size_checked": checked,
"reach": jobs.reach.line(jobs.reach.plan(store, [sub]), sub)}
class ReaderOut(BaseModel):
"""What a reader declares (`plugins/readers/_contract.py`), for the
Sources page: `filters` holds only the dimensions it filters."""