Tag a company All roles to read its big boards with the agents' wide reach; favourite scores only

Migration 21 adds companies.all_roles, tags every favourite of any agent and each company whose board had params {"reach": "all"} (logged per board, the param removed). reach.plan reads a tagged company's boards with the union of the enabled agents' require reach and the base reach; favourite no longer widens the fetch. POST /api/companies/{key}/all-roles sets it and queues a pull when on. The Companies list, the reader and the company strip draw the toggle beside the affinity buttons, the list filters on it, and the board's reach editor drops its All roles option.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 10:44:41 +02:00
1 parent 8d9a059e24
commit 5d5b7e7d3f
20 files changed
+422 -124

No files matched your search

+13 -3
View File
@@ -116,7 +116,7 @@ _EXCERPT_RAW = 240
_COMPANY_FIELDS = ("name", "domain", "status", "careers_url", "notes", "ats", "country", "city",
"ats_slug", "watch", "careers_opened_at", "hand_reason", "sector", "stage",
"size_band", "founded", "last_funding", "last_funding_currency",
"facts_source", "facts_at")
"facts_source", "facts_at", "all_roles")
#: A company as the store serves it: the row and the asked-for agent's affinity.
_COMPANY_SELECT = """SELECT c.*, COALESCE(ac.affinity, 0) AS affinity FROM companies c
@@ -1835,6 +1835,13 @@ class Store:
self._alias(conn, key, fields["name"])
return self._company(key)
def set_all_roles(self, key: str, on: bool) -> Company:
"""Tag a company All roles, or untag it: its boards are read with the
agents' wide reach, Europe today, from the next pull
(`app/jobs/reach.py`). Global, not per agent. Raises KeyError for an
unknown company."""
return self.update_company(key, all_roles=int(bool(on)))
def remove_company(self, key: str) -> bool:
"""Delete the row and every agent's stance on it, in one transaction:
`agent_companies` holds the key with no foreign key to hold it back, so
@@ -1891,8 +1898,8 @@ class Store:
def merge_companies(self, keep: str, other: str) -> Company:
"""Fold company `other` into `keep`, in one transaction: its roles and
subscriptions move to `keep`, each agent's stance moves unless the
agent has one on `keep` already, its aliases and its name become
aliases of `keep`, and its row goes. Copies are not recomputed
agent has one on `keep` already, an All roles tag carries over, its
aliases and its name become aliases of `keep`, and its row goes. Copies are not recomputed
(`rebuild_dupes`). Raises KeyError for an unknown company and
ValueError for merging one into itself."""
if keep == other:
@@ -1915,6 +1922,9 @@ class Store:
(keep, other))
conn.execute("DELETE FROM company_aliases WHERE company_key=?", (other,))
self._alias(conn, keep, rows[other])
conn.execute("UPDATE companies SET all_roles = MAX(all_roles, "
"(SELECT all_roles FROM companies WHERE key=?)) WHERE key=?",
(other, keep))
conn.execute("DELETE FROM companies WHERE key=?", (other,))
return self._company(keep)