Workers see the claimable pool (drill-caught)

Worker list_items was slice-only, so an unassigned external worker saw an empty board — a pull queue nobody can see.
Open+unassigned items are now visible to workers while claims are open; hidden again under lead-only.
This commit is contained in:
Rohit C Prasad
2026-08-16 18:20:44 -07:00
committed by Rohit P
parent 36aa1da728
commit f10bfca9d9
3 changed files with 41 additions and 1 deletions
+15 -1
View File
@@ -495,7 +495,21 @@ class TeamStore:
items = [_row_to_item(row) for row in rows]
if actor.role == Role.WORKER:
visible = self._worker_slice(space, actor.id)
items = [item for item in items if item["id"] in visible]
# On an open-claims board the claimable pool is visible too — a
# pull queue nobody can see is not a queue (drill-caught: an
# external worker with no assignment saw an empty board). Under
# lead-only policy workers can't act on it, so it stays hidden.
claims_open = self.policy(space)["claims"] == "open"
items = [
item
for item in items
if item["id"] in visible
or (
claims_open
and item["state"] == ItemState.OPEN.value
and not item["assignee"]
)
]
for item in items:
item["links"] = self._links_of(space, item["id"])
return items
+5
View File
@@ -47,6 +47,11 @@ def test_workers_file_items_open_and_unassigned(store):
assert filed["id"] in visible
with pytest.raises(AuthorityError):
store.assign(SPACE, WORKER, filed["id"], "worker-1")
# open + unassigned = claimable, so OTHER sees it in the pool (open-claims
# default); under lead-only policy the strict slice rule returns
other_worker = {item["id"] for item in store.list_items(SPACE, OTHER)}
assert filed["id"] in other_worker
store.set_policy(SPACE, LEAD, claims="lead-only")
other_worker = {item["id"] for item in store.list_items(SPACE, OTHER)}
assert filed["id"] not in other_worker
+21
View File
@@ -102,6 +102,27 @@ def test_claim_feeds_journal_grants_like_assignment(store):
assert "case-alpha" in store.journal.cases(NIA)
def test_workers_see_the_claimable_pool(store):
"""A pull queue nobody can see is not a queue (drill-caught 2026-08-16):
an unassigned worker must be able to DISCOVER open items to claim them."""
item = seed(store)
mine = store.create_item("proj", NIA, title="Mine", criteria="c")
# WEBB sees every open unassigned item — including NIA's filing (claimable)
assert {i["id"] for i in store.list_items("proj", WEBB)} == {
item["id"],
mine["id"],
}
# …but only while claims are open; under lead-only the slice rule stands
store.set_policy("proj", LEAD, claims="lead-only")
assert store.list_items("proj", WEBB) == []
# own filings stay visible regardless of policy
assert {i["id"] for i in store.list_items("proj", NIA)} == {mine["id"]}
# a claimed item leaves the pool for everyone else
store.set_policy("proj", LEAD, claims="open")
store.claim("proj", NIA, item["id"])
assert {i["id"] for i in store.list_items("proj", WEBB)} == {mine["id"]}
# ------------------------------------------------------------------ dialects