From d840859fc960126ab68c105daef43f752baa4f73 Mon Sep 17 00:00:00 2001 From: gahusb Date: Fri, 12 Jun 2026 07:30:03 +0900 Subject: [PATCH] =?UTF-8?q?fix(co-gahusb):=20update=5Ftask=20=EC=A1=B4?= =?UTF-8?q?=EC=9E=AC=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20task=5Fid=20?= =?UTF-8?q?not=5Ffound=20=EA=B0=80=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- co-gahusb/app/store.py | 2 ++ co-gahusb/tests/test_tasks.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/co-gahusb/app/store.py b/co-gahusb/app/store.py index cc66279..00107e5 100644 --- a/co-gahusb/app/store.py +++ b/co-gahusb/app/store.py @@ -106,6 +106,8 @@ async def update_task(r, task_id, status, role, note=None): if status not in VALID_STATUS: raise ValueError(f"invalid status: {status}") key = TASK_PREFIX + str(task_id) + if not await r.exists(key): + return {"ok": False, "error": "not_found"} mapping = {"status": status} if note is not None: mapping["note"] = note diff --git a/co-gahusb/tests/test_tasks.py b/co-gahusb/tests/test_tasks.py index 03369cb..70a99a1 100644 --- a/co-gahusb/tests/test_tasks.py +++ b/co-gahusb/tests/test_tasks.py @@ -48,3 +48,9 @@ async def test_invalid_status_rejected(r): tid = (await store.create_task(r, "x", "FE", created_by="Producer"))["task_id"] with pytest.raises(ValueError): await store.update_task(r, tid, "bogus", "FE") + + +async def test_update_nonexistent_task_returns_not_found(r): + res = await store.update_task(r, 999, "done", "FE") + assert res["ok"] is False + assert res["error"] == "not_found"