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:
1 parent
8d9a059e24
commit
5d5b7e7d3f
20 files changed
+422
-124
No files matched your search
+40
-1
@@ -147,7 +147,7 @@ def test_migration_20_seeds_an_old_file_and_leaves_collisions(tmp_path: Path) ->
|
||||
"VALUES (?, ?, '', '')", (key, name))
|
||||
conn.execute("PRAGMA user_version = 19")
|
||||
reopened = Store(path)
|
||||
assert reopened.migrations_applied == [20]
|
||||
assert reopened.migrations_applied == [20, 21]
|
||||
assert reopened.duplicate_companies() == [("orsted", ["orsted", "ørsted"])]
|
||||
assert len(reopened.companies()) == 3
|
||||
|
||||
@@ -158,3 +158,42 @@ def test_the_step_runs_twice_without_harm(tmp_path: Path) -> None:
|
||||
with sqlite3.connect(path) as conn:
|
||||
undo_v20(conn)
|
||||
_add_company_aliases(conn)
|
||||
|
||||
|
||||
def test_migration_21_tags_the_favourites_and_the_boards_that_read_all_roles(tmp_path: Path) -> None:
|
||||
path = tmp_path / "old.db"
|
||||
store = Store(path)
|
||||
store.add_company("Mistral AI")
|
||||
store.add_company("Acme")
|
||||
store.add_subscription("ats", "smartrecruiters:mistral", label="Mistral AI",
|
||||
company="Mistral AI", board="smartrecruiters",
|
||||
params={"reach": "all", "note": "kept"})
|
||||
store.add_subscription("ats", "workday:acme", label="Acme", company="Acme",
|
||||
board="workday", params={"countries": ["DK"]})
|
||||
# A board whose company has no row: its params are cleaned, no flag lands.
|
||||
store.add_subscription("ats", "greenhouse:ghost", label="Ghost", company="Ghost",
|
||||
board="greenhouse", params={"reach": "all"})
|
||||
# A favourite of any agent, enabled or not, is tagged: favourite no
|
||||
# longer widens the fetch, the tag does.
|
||||
store.add_company("Black Forest Labs")
|
||||
store.add_company("Liked")
|
||||
off = store.save_agent("Off", enabled=False)
|
||||
store.set_affinity(off.id, "black-forest-labs", 2) # type: ignore[arg-type]
|
||||
store.set_affinity(off.id, "liked", 1) # type: ignore[arg-type]
|
||||
with sqlite3.connect(path) as conn:
|
||||
conn.execute("ALTER TABLE companies DROP COLUMN all_roles")
|
||||
conn.execute("PRAGMA user_version = 20")
|
||||
reopened = Store(path)
|
||||
assert reopened.migrations_applied == [21]
|
||||
assert {c.key: c.all_roles for c in reopened.companies()} == {
|
||||
"mistral-ai": 1, "acme": 0, "black-forest-labs": 1, "liked": 0}
|
||||
params = {s.target: s.params for s in reopened.subscriptions(source="ats")}
|
||||
assert params == {"smartrecruiters:mistral": {"note": "kept"},
|
||||
"workday:acme": {"countries": ["DK"]}, "greenhouse:ghost": {}}
|
||||
|
||||
|
||||
def test_a_merge_keeps_the_all_roles_tag(store: Store) -> None:
|
||||
store.add_company("Mistral")
|
||||
store.add_company("Mistral AI")
|
||||
store.set_all_roles("mistral", True)
|
||||
assert store.merge_companies("mistral-ai", "mistral").all_roles == 1
|
||||
Reference in new issue
Block a user