From f3c07123c7d3669c3c3791040c8d347be6294405 Mon Sep 17 00:00:00 2001 From: Dusk1e Date: Wed, 20 May 2026 10:18:08 +0300 Subject: [PATCH] fix(kanban): sort priority-desc from highest priority first --- hermes_cli/kanban_db.py | 2 +- tests/hermes_cli/test_kanban_db.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/hermes_cli/kanban_db.py b/hermes_cli/kanban_db.py index d557354238c0..5a7de5d02ea1 100644 --- a/hermes_cli/kanban_db.py +++ b/hermes_cli/kanban_db.py @@ -1590,7 +1590,7 @@ def get_task(conn: sqlite3.Connection, task_id: str) -> Optional[Task]: "created": "created_at ASC, id ASC", "created-desc": "created_at DESC, id DESC", "priority": "priority DESC, created_at ASC", - "priority-desc": "priority ASC, created_at ASC", + "priority-desc": "priority DESC, created_at ASC", "status": "status ASC, created_at ASC", "assignee": "assignee ASC, created_at ASC", "title": "title ASC, id ASC", diff --git a/tests/hermes_cli/test_kanban_db.py b/tests/hermes_cli/test_kanban_db.py index 64ed630db1c0..fb828c1b7c85 100644 --- a/tests/hermes_cli/test_kanban_db.py +++ b/tests/hermes_cli/test_kanban_db.py @@ -899,6 +899,18 @@ def test_list_tasks_order_by(kanban_home): except ValueError as e: assert "order_by must be one of" in str(e) + +def test_list_tasks_order_by_priority_desc_sorts_highest_first(kanban_home): + with kb.connect() as conn: + low = kb.create_task(conn, title="low", priority=1) + mid = kb.create_task(conn, title="mid", priority=5) + high = kb.create_task(conn, title="high", priority=9) + + by_priority_desc = kb.list_tasks(conn, order_by="priority-desc") + + assert [t.id for t in by_priority_desc] == [high, mid, low] + + def test_delete_task_removes_task_and_cascades(kanban_home): with kb.connect() as conn: t = kb.create_task(conn, title="to-delete", assignee="alice")