Skip to content

Commit 3611ea5

Browse files
chaoskcursoragent
andcommitted
Assign tickets to any real account; main no longer has a system actor.
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent f1802a1 commit 3611ea5

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

backend/druks/contrib/software_factory/issues/routes.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,10 @@ async def require_ticket(identifier: str) -> Ticket:
4545

4646

4747
async def require_assignee(assignee_id: str) -> None:
48-
"""A ticket is assigned to a real, non-system account or to nobody. The
49-
assignee FK is RESTRICT, so a bad id would surface as a 500 IntegrityError
50-
on write — check it here instead, where the answer is a 404 the form can
51-
show. The system account is druks' own actor, never someone to hand work to."""
52-
if not await Account.get(assignee_id, exclude_system=True):
48+
"""A ticket is assigned to a real account or to nobody. The assignee FK is
49+
RESTRICT, so a bad id would surface as a 500 IntegrityError on write —
50+
check it here instead, where the answer is a 404 the form can show."""
51+
if not await Account.get(assignee_id):
5352
raise HTTPException(http_status.HTTP_404_NOT_FOUND, f"no account {assignee_id!r}")
5453

5554

backend/tests/software_factory/test_issues_routes.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from druks.accounts.constants import SYSTEM_ACCOUNT_ID
21
from druks.accounts.models import Account
32
from druks.api.server import app as api
43
from druks.contrib.software_factory.issues.enums import Status
@@ -218,25 +217,25 @@ async def test_blank_title_and_body_are_refused(druks_client):
218217
assert commented.status_code == 422
219218

220219

221-
async def test_unknown_ticket_and_system_assignee_are_404(druks_client):
220+
async def test_unknown_ticket_and_unknown_assignee_are_404(druks_client):
222221
missing = await druks_client.get(f"{_TICKETS}/DRU-99")
223222
assert missing.status_code == 404
224223

225224
project = await _open_project(druks_client)
226225
assigned = await druks_client.post(
227226
_TICKETS,
228227
json={
229-
"title": "handed to the system",
228+
"title": "handed to nobody real",
230229
"project_id": project["id"],
231-
"assignee_id": SYSTEM_ACCOUNT_ID,
230+
"assignee_id": "not-an-account",
232231
},
233232
)
234233
assert assigned.status_code == 404
235234

236235
ticket = await _open_ticket(druks_client, project["id"])
237236
updated = await druks_client.patch(
238237
f"{_TICKETS}/{ticket['identifier']}",
239-
json={"assignee_id": SYSTEM_ACCOUNT_ID},
238+
json={"assignee_id": "not-an-account"},
240239
)
241240
assert updated.status_code == 404
242241

0 commit comments

Comments
 (0)